jeroenterheerdt / HAsmartirrigation

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

Solar Radiance is scaled when read from sensor even if already given in target unit #461

Closed ChrisHomeAssistant closed 1 month ago

ChrisHomeAssistant commented 1 month ago

What happened?

The value for the solar radiance sensor seems to be multiplied by the conversion factor from W/m2 to MJ/day/m2 even if the sensor already has the target unit.

See chart below with a sensor value of ~8.57 and the log output with 0.741644 which is roughly a factor of 0.0864

I tried to find some clues in issue #363, however, as far as I understood this was in a setup with continuous updates for sensors.

How to reproduce

Continuous updates for sensors is disabled

I created a sensor based on the solar radiance data of my weather station (in W/m2). This sensor aggregates the solar radiance values over one day and converts the value to MJ per day /m2 image

In the sensor group I select last value and the corresponding unit image

Relevant log output

2024-07-30 17:27:19.091 DEBUG (MainThread) [custom_components.smart_irrigation] calculate_module for zone: {'id': 2, 'name': 'Rasen oben', 'size': 13.0, 'throughput': 3.3333333, 'state': 'automatic', 'bucket': 10.131047597889518, 'old_bucket': 10.647927608971992, 'delta': -0.5168800110824744, 'duration': 0, 'module': 0, 'multiplier': 1.0, 'explanation': "Note: this explanation uses '.' as decimal separator, shows rounded and metric values. Module returned Evapotranspiration deficiency of -0.5. Bucket was 10.6.<br/>maximum bucket size is 15.0.New bucket value is [old_bucket]+[delta]=10.6+-0.5=10.1.<br/>Since bucket >= 0, no irrigation is necessary and duration is set to 0", 'mapping': 2, 'lead_time': 0.0, 'maximum_duration': 1200.0, 'maximum_bucket': 15, 'last_calculated': datetime.datetime(2024, 7, 30, 16, 26, 18, 468933), 'last_updated': datetime.datetime(2024, 7, 30, 17, 25, 56, 697094), 'number_of_data_points': 104}, weatherdata: {'data_multiplier': 0.7222234734143518, 'Dewpoint': 13.34, 'Humidity': 64.16190476190476, 'Precipitation': 0.0, 'Pressure': 960.2428571428571, 'Solar Radiation': 0.74164444992, 'Maximum Temperature': 30.3, 'Minimum Temperature': 13.3, 'Temperature': 21.316190476190478, 'Windspeed': 0.026640211640211662}, forecastdata: None
2024-07-30 17:27:19.097 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] weather_data: {'data_multiplier': 0.7222234734143518, 'Dewpoint': 13.34, 'Humidity': 64.16190476190476, 'Precipitation': 0.0, 'Pressure': 960.2428571428571, 'Solar Radiation': 0.74164444992, 'Maximum Temperature': 30.3, 'Minimum Temperature': 13.3, 'Temperature': 21.316190476190478, 'Windspeed': 0.026640211640211662}
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] et_radvar: 37.975579383041044
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] cs_radvar: 28.886504213504
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: solrad_behavior: 3 and sol_rad: 0.74164444992
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] sol_rad passed to net_in_sol_radvar: 0.74164444992
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] net_in_sol_radvar: 0.5710662264384
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] avp_from_tdew: 1.5314092786779978 for tdew 13.34
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] net_out_lw_radvar: -1.9609129690522038
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] net_radvar: 2.531979195490604
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] eto: 0.7607686738731996
2024-07-30 17:27:19.098 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] precip: 0.0
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] delta returned: -0.7607686738731996
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] collected deltas: [-0.7607686738731996]
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate]: mean of deltas returned: -0.7607686738731996
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: retrieved from module: -0.7607686738731996
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: hour_multiplier: 0.7222234734143518
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: new delta: -0.5494449941095324
2024-07-30 17:27:19.099 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: newbucket: 9.581602603779986

Which version are you running?

2024.7.2

Diagnostics file

Additional information

config_entry-smart_irrigation-0f088d3d2840348cf5a2ff15d2ce2bef.json

jeroenterheerdt commented 1 month ago

thanks, that is a bug then.

jeroenterheerdt commented 1 month ago

somewhere during the collecting of the weatherdata it seems like an unnecessary conversion is hitting. can you please install the latest version, turn on debug logging (like you had) and then try to update the weatherdata, and post the logs - you should see a bunch of log statements with [convert_between] and the like in there.

ChrisHomeAssistant commented 1 month ago

Thanks for the update. I gave it a try after updating to the new version. The log output is down below. I don't know if you changed anything in the different steps but there is no conversion any more - just as one would expect it to be.

2024-08-09 10:14:30.526 INFO (MainThread) [custom_components.smart_irrigation] Updating zone Rasen oben 2024-08-09 10:14:30.533 DEBUG (MainThread) [custom_components.smart_irrigation] check_mapping_sources for mapping_id 2 returns OWM: False, sensor: True, static: False 2024-08-09 10:14:30.538 DEBUG (MainThread) [custom_components.smart_irrigation.helpers] [convert_mapping_to_metric]: unit set, converting 1.9668444 from MJ/day/m2 to MJ/day/m2 2024-08-09 10:14:30.538 DEBUG (MainThread) [custom_components.smart_irrigation.helpers] [convert_between]: Converting 1.9668444 from MJ/day/m2 to MJ/day/m2 2024-08-09 10:14:30.538 DEBUG (MainThread) [custom_components.smart_irrigation.helpers] [convert_between]: No conversion necessary, returning value 1.9668444 2024-08-09 10:14:30.538 DEBUG (MainThread) [custom_components.smart_irrigation.helpers] [convert_between]: Converting 0.0 from km/h to meter/s 2024-08-09 10:14:30.539 DEBUG (MainThread) [custom_components.smart_irrigation.helpers] [convert_between]: Converting speeds 2024-08-09 10:14:30.539 DEBUG (MainThread) [custom_components.smart_irrigation] async_update_zone_config for mapping 2 new mapping_data: {'Dewpoint': 19.0, 'Humidity': 70.0, 'Precipitation': 0.0, 'Pressure': 959.9, 'Solar Radiation': 1.9668444, 'Temperature': 24.8, 'Windspeed': 0.0, 'retrieved': datetime.datetime(2024, 8, 9, 10, 14, 30, 539136)} 2024-08-09 10:14:30.577 DEBUG (MainThread) [custom_components.smart_irrigation] calling register start event from async_update_zone_config 2024-08-09 10:14:30.578 INFO (MainThread) [custom_components.smart_irrigation] Start irrigation event smart_irrigation_start_irrigation_all_zones will fire at 1200 seconds before sunrise 2024-08-09 10:14:33.085 WARNING (MainThread) [homeassistant.components.rest.util] REST result could not be parsed as JSON 2024-08-09 10:14:33.667 INFO (MainThread) [custom_components.smart_irrigation] Calculating zone Rasen oben 2024-08-09 10:14:33.680 DEBUG (MainThread) [custom_components.smart_irrigation] apply_aggregates_to_mapping_data: {'id': 2, 'name': 'Wetterstation', 'mappings': {'Dewpoint': {'source': 'sensor', 'sensorentity': 'sensor.wetterstation_dewpoint'}, 'Evapotranspiration': {'source': 'none'}, 'Humidity': {'source': 'sensor', 'sensorentity': 'sensor.wetterstation_humidity'}, 'Precipitation': {'source': 'sensor', 'sensorentity': 'sensor.wetterstation_daily_rain_rate_piezo', 'aggregate': 'last'}, 'Pressure': {'source': 'sensor', 'sensorentity': 'sensor.gw2000a_v2_2_4_absolute_pressure'}, 'Solar Radiation': {'source': 'sensor', 'aggregate': 'last', 'sensorentity': 'sensor.solar_radiation_daily_minute_base', 'unit': 'MJ/day/m2'}, 'Temperature': {'source': 'sensor', 'sensorentity': 'sensor.wetterstation_outdoor_temperature'}, 'Windspeed': {'source': 'sensor', 'sensorentity': 'sensor.wetterstation_wind_speed', 'unit': 'km/h'}}, 'data': [{'Dewpoint': 15.6, 'Humidity': 91, 'Precipitation': 0, 'Pressure': 959.6, 'Solar Radiation': 0, 'Temperature': 17.1, 'Windspeed': 0, 'retrieved': '2024-08-09T00:03:03.087720'}, {'Dewpoint': 15.5, 'Humidity': 91, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0, 'Temperature': 17, 'Windspeed': 0, 'retrieved': '2024-08-09T00:13:03.089712'}, {'Dewpoint': 15.7, 'Humidity': 92, 'Precipitation': 0, 'Pressure': 959.6, 'Solar Radiation': 0, 'Temperature': 17, 'Windspeed': 0, 'retrieved': '2024-08-09T00:23:03.089913'}, {'Dewpoint': 15.8, 'Humidity': 93, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0, 'Temperature': 16.9, 'Windspeed': 0, 'retrieved': '2024-08-09T00:33:03.090837'}, {'Dewpoint': 15.7, 'Humidity': 93, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0, 'Temperature': 16.8, 'Windspeed': 0, 'retrieved': '2024-08-09T00:43:03.090986'}, {'Dewpoint': 15.6, 'Humidity': 94, 'Precipitation': 0, 'Pressure': 959.4, 'Solar Radiation': 0, 'Temperature': 16.6, 'Windspeed': 0, 'retrieved': '2024-08-09T00:53:03.092613'}, {'Dewpoint': 15.5, 'Humidity': 94, 'Precipitation': 0, 'Pressure': 959.6, 'Solar Radiation': 0, 'Temperature': 16.5, 'Windspeed': 0, 'retrieved': '2024-08-09T01:03:03.093603'}, {'Dewpoint': 15.8, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.6, 'Solar Radiation': 0, 'Temperature': 16.6, 'Windspeed': 0, 'retrieved': '2024-08-09T01:13:03.092144'}, {'Dewpoint': 15.7, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.5, 'Solar Radiation': 0, 'Temperature': 16.5, 'Windspeed': 0, 'retrieved': '2024-08-09T01:23:03.095541'}, {'Dewpoint': 15.6, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.6, 'Solar Radiation': 0, 'Temperature': 16.4, 'Windspeed': 0, 'retrieved': '2024-08-09T01:33:03.096421'}, {'Dewpoint': 15.6, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.5, 'Solar Radiation': 0, 'Temperature': 16.4, 'Windspeed': 0, 'retrieved': '2024-08-09T01:43:03.097935'}, {'Dewpoint': 15.4, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 16.2, 'Windspeed': 0, 'retrieved': '2024-08-09T01:53:03.098173'}, {'Dewpoint': 15.3, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.4, 'Solar Radiation': 0, 'Temperature': 16.1, 'Windspeed': 0, 'retrieved': '2024-08-09T02:03:03.105114'}, {'Dewpoint': 15.2, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 16, 'Windspeed': 0, 'retrieved': '2024-08-09T02:13:03.103478'}, {'Dewpoint': 15.1, 'Humidity': 95, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 15.9, 'Windspeed': 0, 'retrieved': '2024-08-09T02:23:03.106105'}, {'Dewpoint': 15.2, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 15.8, 'Windspeed': 0, 'retrieved': '2024-08-09T02:33:03.107167'}, {'Dewpoint': 15, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.2, 'Solar Radiation': 0, 'Temperature': 15.6, 'Windspeed': 0, 'retrieved': '2024-08-09T02:43:03.107498'}, {'Dewpoint': 14.9, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 15.5, 'Windspeed': 0, 'retrieved': '2024-08-09T02:53:03.107776'}, {'Dewpoint': 14.9, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 15.5, 'Windspeed': 0, 'retrieved': '2024-08-09T03:03:03.110113'}, {'Dewpoint': 14.9, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 15.5, 'Windspeed': 0, 'retrieved': '2024-08-09T03:13:03.109424'}, {'Dewpoint': 14.9, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0, 'Temperature': 15.5, 'Windspeed': 0, 'retrieved': '2024-08-09T03:23:03.111599'}, {'Dewpoint': 14.7, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.2, 'Solar Radiation': 0, 'Temperature': 15.3, 'Windspeed': 0, 'retrieved': '2024-08-09T03:33:03.113369'}, {'Dewpoint': 14.7, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.2, 'Solar Radiation': 0, 'Temperature': 15.3, 'Windspeed': 0, 'retrieved': '2024-08-09T03:43:03.113869'}, {'Dewpoint': 14.6, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.4, 'Solar Radiation': 0, 'Temperature': 15.2, 'Windspeed': 0, 'retrieved': '2024-08-09T03:53:03.110176'}, {'Dewpoint': 14.5, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.1, 'Solar Radiation': 0, 'Temperature': 15.1, 'Windspeed': 0, 'retrieved': '2024-08-09T04:03:03.112812'}, {'Dewpoint': 14.5, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959, 'Solar Radiation': 0, 'Temperature': 15.1, 'Windspeed': 0, 'retrieved': '2024-08-09T04:13:03.114903'}, {'Dewpoint': 14.5, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.1, 'Solar Radiation': 0, 'Temperature': 15.1, 'Windspeed': 0, 'retrieved': '2024-08-09T04:23:03.116519'}, {'Dewpoint': 14.4, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 958.9, 'Solar Radiation': 0, 'Temperature': 15, 'Windspeed': 0, 'retrieved': '2024-08-09T04:33:03.214583'}, {'Dewpoint': 14.3, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959, 'Solar Radiation': 0, 'Temperature': 14.9, 'Windspeed': 0, 'retrieved': '2024-08-09T04:43:03.220743'}, {'Dewpoint': 14.3, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 958.8, 'Solar Radiation': 0, 'Temperature': 14.9, 'Windspeed': 0, 'retrieved': '2024-08-09T04:53:03.222916'}, {'Dewpoint': 14.2, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 958.9, 'Solar Radiation': 0, 'Temperature': 14.8, 'Windspeed': 0, 'retrieved': '2024-08-09T05:03:03.224149'}, {'Dewpoint': 14.2, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 958.9, 'Solar Radiation': 0, 'Temperature': 14.8, 'Windspeed': 0, 'retrieved': '2024-08-09T05:13:03.224869'}, {'Dewpoint': 14.2, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959, 'Solar Radiation': 0, 'Temperature': 14.7, 'Windspeed': 0, 'retrieved': '2024-08-09T05:23:03.219353'}, {'Dewpoint': 14.1, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.1, 'Solar Radiation': 0, 'Temperature': 14.6, 'Windspeed': 0, 'retrieved': '2024-08-09T05:33:03.226342'}, {'Dewpoint': 14.1, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.1, 'Solar Radiation': 8.16139941690962e-05, 'Temperature': 14.6, 'Windspeed': 0, 'retrieved': '2024-08-09T05:43:03.226096'}, {'Dewpoint': 14, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.1, 'Solar Radiation': 0.0007886141643059494, 'Temperature': 14.5, 'Windspeed': 0, 'retrieved': '2024-08-09T05:53:03.227704'}, {'Dewpoint': 13.9, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.1, 'Solar Radiation': 0.003230360330578511, 'Temperature': 14.4, 'Windspeed': 0, 'retrieved': '2024-08-09T06:03:03.229632'}, {'Dewpoint': 13.8, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0.008366670241286867, 'Temperature': 14.3, 'Windspeed': 0, 'retrieved': '2024-08-09T06:13:03.229837'}, {'Dewpoint': 13.8, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.3, 'Solar Radiation': 0.01759988302872065, 'Temperature': 14.3, 'Windspeed': 0, 'retrieved': '2024-08-09T06:23:03.226427'}, {'Dewpoint': 13.8, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.4, 'Solar Radiation': 0.03200361526717557, 'Temperature': 14.3, 'Windspeed': 0, 'retrieved': '2024-08-09T06:33:03.229285'}, {'Dewpoint': 13.8, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.4, 'Solar Radiation': 0.0550738898263027, 'Temperature': 14.3, 'Windspeed': 0, 'retrieved': '2024-08-09T06:43:03.229048'}, {'Dewpoint': 13.8, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.5, 'Solar Radiation': 0.09057063050847475, 'Temperature': 14.3, 'Windspeed': 0, 'retrieved': '2024-08-09T06:53:03.226832'}, {'Dewpoint': 14.1, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.5, 'Solar Radiation': 0.13514308085106347, 'Temperature': 14.6, 'Windspeed': 0, 'retrieved': '2024-08-09T07:03:03.226744'}, {'Dewpoint': 14.3, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0.19602104757505806, 'Temperature': 14.8, 'Windspeed': 0, 'retrieved': '2024-08-09T07:13:03.229082'}, {'Dewpoint': 14.6, 'Humidity': 97, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 0.27429445056433394, 'Temperature': 15.1, 'Windspeed': 0, 'retrieved': '2024-08-09T07:23:03.236519'}, {'Dewpoint': 14.9, 'Humidity': 96, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0.3620171443708607, 'Temperature': 15.5, 'Windspeed': 0, 'retrieved': '2024-08-09T07:33:03.234011'}, {'Dewpoint': 14.9, 'Humidity': 94, 'Precipitation': 0, 'Pressure': 959.6, 'Solar Radiation': 0.44099716976241926, 'Temperature': 15.9, 'Windspeed': 0, 'retrieved': '2024-08-09T07:43:03.235416'}, {'Dewpoint': 15.2, 'Humidity': 94, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0.5051079171247358, 'Temperature': 16.2, 'Windspeed': 0, 'retrieved': '2024-08-09T07:53:03.237034'}, {'Dewpoint': 15.4, 'Humidity': 93, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 0.5706156521739134, 'Temperature': 16.5, 'Windspeed': 0, 'retrieved': '2024-08-09T08:03:03.235574'}, {'Dewpoint': 15.4, 'Humidity': 90, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 0.6743637419878299, 'Temperature': 17.1, 'Windspeed': 0, 'retrieved': '2024-08-09T08:13:03.234949'}, {'Dewpoint': 15.9, 'Humidity': 88, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 0.8110383459244538, 'Temperature': 17.9, 'Windspeed': 0, 'retrieved': '2024-08-09T08:23:03.239151'}, {'retrieved': '2024-08-09T08:26:56.560644'}, {'Dewpoint': 16, 'Humidity': 83, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 0.9344099720930198, 'Temperature': 19, 'Windspeed': 0, 'retrieved': '2024-08-09T08:36:56.590457'}, {'Dewpoint': 16.7, 'Humidity': 83, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 1.0517547558935376, 'Temperature': 19.7, 'Windspeed': 0, 'retrieved': '2024-08-09T08:46:56.594234'}, {'retrieved': '2024-08-09T08:52:12.810771'}, {'Dewpoint': 16.1, 'Humidity': 73, 'Precipitation': 0, 'Pressure': 960, 'Solar Radiation': 1.2802758376383763, 'Temperature': 21.1, 'Windspeed': 0, 'retrieved': '2024-08-09T09:02:12.853214'}, {'Dewpoint': 16.5, 'Humidity': 70, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 1.6092591652173918, 'Temperature': 22.2, 'Windspeed': 0, 'retrieved': '2024-08-09T09:12:12.857046'}, {'Dewpoint': 16.6, 'Humidity': 67, 'Precipitation': 0, 'Pressure': 959.8, 'Solar Radiation': 2.0795237807829206, 'Temperature': 23.1, 'Windspeed': 0, 'retrieved': '2024-08-09T09:22:12.850188'}, {'Dewpoint': 17, 'Humidity': 67, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 2.5179938685314727, 'Temperature': 23.5, 'Windspeed': 0, 'retrieved': '2024-08-09T09:32:12.853070'}, {'Dewpoint': 17.2, 'Humidity': 63, 'Precipitation': 0, 'Pressure': 960, 'Solar Radiation': 2.960540536082472, 'Temperature': 24.7, 'Windspeed': 0.08055555555555562, 'retrieved': '2024-08-09T09:42:12.858026'}, {'Dewpoint': 17.4, 'Humidity': 63, 'Precipitation': 0, 'Pressure': 960, 'Solar Radiation': 3.4048345621621596, 'Temperature': 24.9, 'Windspeed': 0.061111111111111165, 'retrieved': '2024-08-09T09:52:12.856508'}, {'Dewpoint': 17.7, 'Humidity': 63, 'Precipitation': 0, 'Pressure': 959.9, 'Solar Radiation': 3.9011993940199337, 'Temperature': 25.2, 'Windspeed': 0, 'retrieved': '2024-08-09T10:02:12.860737'}, {'Dewpoint': 18.2, 'Humidity': 69.0, 'Precipitation': 0.0, 'Pressure': 960.0, 'Solar Radiation': 1.9133796, 'Temperature': 24.3, 'Windspeed': 0.0, 'retrieved': datetime.datetime(2024, 8, 9, 10, 13, 0, 426327)}, {'Dewpoint': 19.0, 'Humidity': 70.0, 'Precipitation': 0.0, 'Pressure': 959.9, 'Solar Radiation': 1.9668444, 'Temperature': 24.8, 'Windspeed': 0.0, 'retrieved': datetime.datetime(2024, 8, 9, 10, 14, 30, 539136)}], 'data_last_updated': datetime.datetime(2024, 8, 9, 10, 14, 30, 539319)} 2024-08-09 10:14:33.684 DEBUG (MainThread) [custom_components.smart_irrigation] [apply_aggregates_to_mapping_data]: first_retrieved_at: 2024-08-09 00:03:03.087720, last_retrieved_at: 2024-08-09 10:14:30.539136, diff_in_seconds: 36687.451416, diff_in_hours: 10.190958726666668, hour_multiplier: 0.42462328027777785 2024-08-09 10:14:33.686 DEBUG (MainThread) [custom_components.smart_irrigation] apply_aggregates_to_mapping_data returns {'data_multiplier': 0.42462328027777785, 'Dewpoint': 15.229032258064516, 'Humidity': 90.75806451612904, 'Precipitation': 0.0, 'Pressure': 959.4806451612903, 'Solar Radiation': 1.9668444, 'Maximum Temperature': 25.2, 'Minimum Temperature': 14.3, 'Temperature': 16.891935483870967, 'Windspeed': 0.0022849462365591416} 2024-08-09 10:14:33.687 DEBUG (MainThread) [custom_components.smart_irrigation] calculate_module for zone: {'id': 2, 'name': 'Rasen oben', 'size': 13.0, 'throughput': 2.4, 'state': 'automatic', 'bucket': 2.9990550589405522, 'old_bucket': 3.3479215835854608, 'delta': -0.34886652464490875, 'duration': 0, 'module': 0, 'multiplier': 1.0, 'explanation': "Note: this explanation uses '.' as decimal separator, shows rounded and metric values. Module returned Evapotranspiration deficiency of -0.3. Bucket was 3.3.
maximum bucket size is 15.0.New bucket value is [old_bucket]+[delta]=3.3+-0.3=3.0.
Since bucket >= 0, no irrigation is necessary and duration is set to 0", 'mapping': 2, 'lead_time': 0.0, 'maximum_duration': 1200.0, 'maximum_bucket': 15, 'last_calculated': datetime.datetime(2024, 8, 9, 10, 13, 19, 97178), 'last_updated': datetime.datetime(2024, 8, 9, 10, 14, 30, 539319), 'number_of_data_points': 63}, weatherdata: {'data_multiplier': 0.42462328027777785, 'Dewpoint': 15.229032258064516, 'Humidity': 90.75806451612904, 'Precipitation': 0.0, 'Pressure': 959.4806451612903, 'Solar Radiation': 1.9668444, 'Maximum Temperature': 25.2, 'Minimum Temperature': 14.3, 'Temperature': 16.891935483870967, 'Windspeed': 0.0022849462365591416}, forecastdata: None 2024-08-09 10:14:33.692 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] weather_data: {'data_multiplier': 0.42462328027777785, 'Dewpoint': 15.229032258064516, 'Humidity': 90.75806451612904, 'Precipitation': 0.0, 'Pressure': 959.4806451612903, 'Solar Radiation': 1.9668444, 'Maximum Temperature': 25.2, 'Minimum Temperature': 14.3, 'Temperature': 16.891935483870967, 'Windspeed': 0.0022849462365591416} 2024-08-09 10:14:33.692 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] et_radvar: 35.96858917539873 2024-08-09 10:14:33.692 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] cs_radvar: 27.3598670421588 2024-08-09 10:14:33.692 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: solrad_behavior: 3 and sol_rad: 1.9668444 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] sol_rad passed to net_in_sol_radvar: 1.9668444 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] net_in_sol_radvar: 1.514470188 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] avp_from_tdew: 1.7306551540369126 for tdew 15.229032258064516 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] net_out_lw_radvar: -1.425317408193873 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] net_radvar: 2.939787596193873 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] eto: 0.8300425884706649 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] precip: 0.0 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] delta returned: -0.8300425884706649 2024-08-09 10:14:33.693 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate_et_for_day] collected deltas: [-0.8300425884706649] 2024-08-09 10:14:33.694 DEBUG (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] [pyETO: calculate]: mean of deltas returned: -0.8300425884706649 2024-08-09 10:14:33.694 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: retrieved from module: -0.8300425884706649 2024-08-09 10:14:33.694 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: hour_multiplier: 0.42462328027777785 2024-08-09 10:14:33.694 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: new delta: -0.35245540668667136 2024-08-09 10:14:33.694 DEBUG (MainThread) [custom_components.smart_irrigation] [calculate-module]: newbucket: 2.646599652253881

ChrisHomeAssistant commented 1 month ago

My initial guess was that the error occurs during the conversion to metric system as there is one case where "from_unit" is set to W/m2. This would've explained the transformation (but only if the "from_unit" would have been misinterpreted).

But currently (without any changes in my sensor group) it seems to look good.

jeroenterheerdt commented 1 month ago

I didn't change any logic just added debug. It am wondering if you maybe changed the unit but never moved away from it / deselected it, so it actually still had the old setting in the file? Just guessing here. Closing this for now, glad it looks like its resolved.

ChrisHomeAssistant commented 4 weeks ago

Yes, I’m also happy 😉 Thanks for adding all the debug infos. Definitely helpful for a better understanding!