briis / hass-weatherflow

Home Assistant Integration for WeatherFlow Stations
MIT License
67 stars 11 forks source link

Retrying setup: '>' not supported between instances of 'NoneType' and 'float' #12

Closed dhover closed 2 years ago

dhover commented 2 years ago

I get this error directly after adding the integration version 0.1.11

error

In the logfile:

2021-12-06 17:47:36 ERROR (MainThread) [custom_components.weatherflow] Unexpected error fetching weatherflow data: '>' not supported between instances of 'NoneType' and 'float'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/weatherflow/__init__.py", line 105, in async_update_data
data: ObservationDescription = await weatherflowapi.update_observations()
File "/usr/local/lib/python3.9/site-packages/pyweatherflowrest/api.py", line 191, in update_observations
beaufort_data: BeaufortDescription = self.calc.beaufort_value(obervations.get("wind_avg"))
File "/usr/local/lib/python3.9/site-packages/pyweatherflowrest/helpers.py", line 266, in beaufort_value
if wind_speed > float(k):
TypeError: '>' not supported between instances of 'NoneType' and 'float'
2021-12-06 17:47:36 DEBUG (MainThread) [custom_components.weatherflow] Finished fetching weatherflow data in 1.144 seconds (success: False)
2021-12-06 17:47:36 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Weerstation Markelo' for weatherflow integration not ready yet: '>' not supported between instances of 'NoneType' and 'float'; Retrying in background
dhover commented 2 years ago

Maybe I know what the problem is. I see my station is in power saving mode. Battery voltage is 2.35 V. In mode 3 wind sampling is increased to 5 minutes.

Power Save Modes
Here are details on how the Tempest may conserve power in order to operate for as long as possible. Most Tempests never go below Mode 0 and more than 90% will never go below Mode 1.

Mode 0: Voltage ≥ 2.455

All sensors enabled and operating at full performance
Wind sampling interval every 3 seconds
Mode 1: Voltage ≤ 2.415 from Mode 0 or ≥  2.41 from Mode 2

Wind sampling interval set to 6 seconds
Mode 2: Voltage ≤ 2.39 from Mode 1 or ≥  2.375 from Mode 3

Wind sampling interval set to one minute
Mode 3: Voltage ≤ 2.355

Wind sampling interval set to 5 minutes
All other sensors' sampling interval set to 5 minutes
Haptic Rain sensor disabled from active listening

Could that be the problem? The old integration is working fine but all wind measurements are zero.

wind

briis commented 2 years ago

I can see you are from Holland, and I have the same issue here in DK, when we don't get enough sunlight to charge the battery. I still thought I had fixed this issue in .11 but I will give it another go, so that the setup does not fail.

dhover commented 2 years ago

Yes, indeed. My station ID is 32725. Can I use both integrations at the same time?

briis commented 2 years ago

If you mean SmartWeather and this one, the answer is yes.

Btw: Found why it crashed, and I am now just returning empty values, if wind_avg is not present, so it will startup nicely and just supply values when/if they are present. Will be included in next release.

dhover commented 2 years ago

Good news. I'll test it when the release is available.

briis commented 2 years ago

Will be sometime tomorrow.

briis commented 2 years ago

Released V0.1.12 which fixes this issue. Re-Open if it does not work.