jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
https://jeroenterheerdt.github.io/HAsmartirrigation/
MIT License
349 stars 49 forks source link

The only problem I noticed is if sensor is unavailable (for example at ha start) owm value is saved. #465

Open jeroenterheerdt opened 1 month ago

jeroenterheerdt commented 1 month ago

What happened?

reported by @omenek159 in #420

How to reproduce

reported by @omenek159 in #420

Relevant log output

No response

Which version are you running?

latest

Diagnostics file

Additional information

@omenek159 please add details here.

omenek159 commented 1 month ago

Sure. This is how it looks if everything is ok:

2024-08-04 13:19:53.515 DEBUG (SyncWorker_37) [custom_components.smart_irrigation.weathermodules.OWMClient] OWMClient get_data called API https://api.openweathermap.org/...
2024-08-04 13:19:53.515 DEBUG (SyncWorker_37) [custom_components.smart_irrigation.weathermodules.OWMClient] OWMCLIENT daily rain: 1.57
2024-08-04 13:19:53.515 DEBUG (SyncWorker_37) [custom_components.smart_irrigation.weathermodules.OWMClient] OWMCLIENT daily precipitation: 1.57
2024-08-04 13:19:53.516 DEBUG (MainThread) [custom_components.smart_irrigation] merge_weatherdata_and_sensor_values, overriding Precipitation value 1.57 from OWM with 0.0 from sensors
2024-08-04 13:19:53.516 DEBUG (MainThread) [custom_components.smart_irrigation] merge_weatherdata_and_sensor_values, overriding Temperature value 23.65 from OWM with 24.668 from sensors
2024-08-04 13:19:53.516 DEBUG (MainThread) [custom_components.smart_irrigation] async_update_all for mapping 0 new mapping_data: {'Windspeed': 3.410656902765825, 'Pressure': 1010.0000044025214, 'Humidity': 59, 'Temperature': 24.668, 'Dewpoint': 15.17, 'Precipitation': 0.0, 'retrieved': datetime.datetime(2024, 8, 4, 13, 19, 53, 516572)}

but if sensor is unavailable it's value is replaced with value from owm (look at precipitation):

2024-08-04 10:19:53.526 DEBUG (SyncWorker_23) [custom_components.smart_irrigation.weathermodules.OWMClient] OWMClient get_data called API https://api.openweathermap.org/...
2024-08-04 10:19:53.526 DEBUG (SyncWorker_23) [custom_components.smart_irrigation.weathermodules.OWMClient] OWMCLIENT daily rain: 0.93
2024-08-04 10:19:53.526 DEBUG (SyncWorker_23) [custom_components.smart_irrigation.weathermodules.OWMClient] OWMCLIENT daily precipitation: 0.93
2024-08-04 10:19:53.527 WARNING (MainThread) [custom_components.smart_irrigation] No / unknown value for sensor sensor.rain_live
2024-08-04 10:19:53.527 WARNING (MainThread) [custom_components.smart_irrigation] No / unknown value for sensor sensor.ebusd_broadcast_outsidetemp_temp2
2024-08-04 10:19:53.527 DEBUG (MainThread) [custom_components.smart_irrigation] async_update_all for mapping 0 new mapping_data: {'Windspeed': 2.4458000157991773, 'Pressure': 1010.0000044025214, 'Humidity': 57, 'Temperature': 23.5, 'Dewpoint': 14.5, 'Precipitation': 0.93, 'retrieved': datetime.datetime(2024, 8, 4, 10, 19, 53, 527899)}

I'll wait till owm shows some rain in my area so I could confirm it's still like this.