jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
MIT License
301 stars 47 forks source link

Incorrect calculation including rain precip #308

Closed elenril2 closed 6 months ago

elenril2 commented 7 months ago

What happened?

The integration takes into account incorrect rain values from the weather station. I checked data from the calculate_et_for_day function. I noticed that it took the precip value as 1.4895833333333333, even though my sensor (set to last) was reading 3.8mm that day. I have the forecast days set to 0, so it seems to me that the actual rainfall should be directly taken into account when calculating eto. Based on the number of decimal places, it looks like it may be an average, not the last value. config_entry-smart_irrigation-f2f59f4233cca0fb6e63c993212765fb.json.txt

How to reproduce

Werify the calculated eto, precip and delta on a day when there was rainfall.

Relevant log output

Diagnostics file from today after data reset, fault detected during yesterday's calculation.

Which version are you running?

v2023.9.2

Diagnostics file

Additional information

Data from the calculate_et_for_day function:


2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=13.54375
2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=13.0
2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=20.1
2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=5.454166666666667
2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1013.175
2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=40.06520833333333
2023-10-12 23:55:00.326 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=1.4895833333333333
2023-10-12 23:55:00.327 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=2.5425836225175558
jeroenterheerdt commented 7 months ago

thanks - so the first question is: how much time was between this calculation and the previous? Since the ET per day is really per 24 hours, so have introduced a capability to reduce the results by a certain factor depending on how many hours were between the first and the last data point collected on which we did the calculation. If that is indeed the cause of the reduction then I think the time elapsed before this calculation was about 9 hours. Is that correct?

Alternatively, is it just the rain amount that is not correct? Are all other values the same as you expected? If so can you try to set the aggregation for precip to something else and then to Last again to see if that changes anything? Please render another diag file after the change.

elenril2 commented 7 months ago

If I understood you correctly, that could be the reason. The rainfall stopped around 3 p.m. image But shouldn't rain always be considered in its full value?

The remaining data, also looking at the calculated ETO, seems to be correct.

jeroenterheerdt commented 7 months ago

Is the other data was correct, then please try the change aggregation trick I mentioned to see if that helps.

elenril2 commented 6 months ago

Sorry for the delay in replying. I checked several cases and the problem did not recur. Only the first measurement with the last option was incorrect. Although I wonder if it is better not to set max mode rather than last.


rain: 2,5mm stopped at 17:36 mode: last
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=12.87872340425532
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=10.2
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=21.4
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=7.31663829787234
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1007.2
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=43.68531914893617
2023-10-14 23:55:00.205 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=0.7021276595744681
2023-10-14 23:55:00.206 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=2.4101199291332023

2023-10-17
rain: 10mm mode: max
2023-10-17 23:55:00.266 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=2.1069767441860465
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=-1.6
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=10.1
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=1.155
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1020.9488372093024
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=50.2206976744186
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=10.0
2023-10-17 23:55:00.267 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.7320484931466347

2023-10-18
rain: 6mm mode: last
2023-10-18 23:55:00.246 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-18 23:55:00.246 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=1.0166666666666666
2023-10-18 23:55:00.246 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=-3.2
2023-10-18 23:55:00.247 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=12.0
2023-10-18 23:55:00.247 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=1.2833333333333334
2023-10-18 23:55:00.247 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1016.1583333333333
2023-10-18 23:55:00.247 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=66.78791666666666
2023-10-18 23:55:00.247 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=6.0
2023-10-18 23:55:00.247 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.6018017196527041

2023-10-19
rain: 7,1mm stopped at 23:27 mode: last
2023-10-19 23:55:00.358 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-19 23:55:00.358 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=2.3625
2023-10-19 23:55:00.358 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=0
2023-10-19 23:55:00.359 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=7.0
2023-10-19 23:55:00.359 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=2.2971666666666666
2023-10-19 23:55:00.359 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1003.9854166666667
2023-10-19 23:55:00.359 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=27.519375
2023-10-19 23:55:00.359 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=7.1
2023-10-19 23:55:00.359 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.5029365744900272

2023-10-20
rain: 1,5mm stopped at 18:07 mode: last
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=7.883333333333333
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=7.0
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=10.3
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=5.5440000000000005
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=994.1979166666666
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=15.947291666666667
2023-10-20 23:55:00.351 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=1.5
2023-10-20 23:55:00.352 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.5600571317295745

2023-10-21
rain: 1,3mm stopped at 10:28 mode: last
2023-10-21 23:55:00.353 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-21 23:55:00.353 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=11.9875
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=10.3
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=20.3
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=1.5063125
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=999.8291666666667
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=42.537083333333335
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=1.3
2023-10-21 23:55:00.354 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=1.2791109460414285

2023-10-22
rain: 22,8mm stopped at 23:54 mode: last
2023-10-22 23:55:00.360 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-22 23:55:00.360 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=12.1125
2023-10-22 23:55:00.360 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=10.9
2023-10-22 23:55:00.361 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=14.1
2023-10-22 23:55:00.361 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=3.551625
2023-10-22 23:55:00.361 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1006.5916666666667
2023-10-22 23:55:00.361 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=17.652708333333333
2023-10-22 23:55:00.361 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=22.6
2023-10-22 23:55:00.361 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.5891960212101858

2023-10-27
rain: 1mm stopped at 23:48 (after the last daily data update, before was 0,7mm) mode: last
2023-10-27 23:55:00.380 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=7.915217391304348
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=6.9
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=11.2
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=0.7884130434782609
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=994.2934782608696
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=27.904565217391305
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=0.7
2023-10-27 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.14645243110191491

2023-10-28
rain: 6,6mm stopped at 23:49 (after the last daily data update, before was 6,6mm) mode: last
2023-10-28 23:55:00.393 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=8.419148936170213
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=8.2
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=12.3
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=2.3951914893617023
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=1001.1042553191489
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=24.167021276595744
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=6.3
2023-10-28 23:55:00.394 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.3771131815583267

2023-11-03
rain: 14,2mm stopped at 23:18 mode: last
2023-11-03 23:55:00.375 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-11-03 23:55:00.375 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=8.559574468085106
2023-11-03 23:55:00.375 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=6.6
2023-11-03 23:55:00.375 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=12.3
2023-11-03 23:55:00.376 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=7.829425531914894
2023-11-03 23:55:00.376 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=988.1680851063829
2023-11-03 23:55:00.376 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=10.351702127659575
2023-11-03 23:55:00.376 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=14.2
2023-11-03 23:55:00.376 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.3925395802978441

2023-11-04
rain: 0,2mm stopped at 00:58 mode: last
2023-11-04 23:55:00.387 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-11-04 23:55:00.387 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=5.197872340425532
2023-11-04 23:55:00.387 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=3.4
2023-11-04 23:55:00.387 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=11.5
2023-11-04 23:55:00.388 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=6.46636170212766
2023-11-04 23:55:00.388 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=994.0744680851063
2023-11-04 23:55:00.388 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=36.435744680851066
2023-11-04 23:55:00.388 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=0.2
2023-11-04 23:55:00.388 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.07670548337659377

2023-11-05
rain: 5,6mm stopped at 19:34 mode: last
2023-11-05 23:55:00.380 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Calculating ET for day:
2023-11-05 23:55:00.380 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Dewpoint=5.98936170212766
2023-11-05 23:55:00.380 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Min Temp=4.4
2023-11-05 23:55:00.380 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Max Temp=9.4
2023-11-05 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Wind ms=7.169191489361702
2023-11-05 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Pres=987.6893617021277
2023-11-05 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Solrad=13.43127659574468
2023-11-05 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] Precip=5.6
2023-11-05 23:55:00.381 INFO (MainThread) [custom_components.smart_irrigation.calcmodules.pyeto] ETO=0.22909095993080397```