jeroenterheerdt / HAsmartirrigation

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

Too high evaporation rates when using Solar radiation sensor #338

Closed wauswaus closed 1 month ago

wauswaus commented 1 month ago

What happened?

In V1 of this awesome integration I always used the solar radiation sensor of my weather station. After switching over to V2 I noticed really high calculated evaporation values. After some testing, I noticed that the calculated values would be normal if I do not use a Solar radiation sensor and made use of "Estimate from temperature" for solrad behaviour (in the Moduled --> PyETO setting page). So the issues lies somewhere with using the Solar radiation sensor I also used in the V1 version but I cannot see where the issue lies.

I live in the netherlands. The calculated evaporation transpiration for 01 April (monday) was 4.55mm (bucket went from 12mm to 7.45mm) with hardly sun or wind (see calculation log) which was way too high for that day (bit of googling gave a value of 2mm for that day). image In the calculation log I saw an average of 54 w/m2 which seems right, so i do not see an issue there.

Could you help to debug this?

How to reproduce

Start using the solar radiation sensor: image image

Relevant log output

2024-04-01 23:59:00.401 DEBUG (MainThread) [custom_components.smart_irrigation] apply_aggregates_to_mapping_data returns {'data_multiplier': 0.989616801550926, 'Dewpoint': 7.51625, 'Humidity': 82.475625, 'Precipitation': 0.0, 'Pressure': 998.9625019570184, 'Solar Radiation': 54.04802083333333, 'Maximum Temperature': 14.38, 'Minimum Temperature': 8.55, 'Temperature': 10.450208333333334, 'Windspeed': 1.1634615641592252}

All these values seem right. Could there maybe be an issue with converting from one unit to another?

Which version are you running?

v2024.3.1

Diagnostics file

Additional information

config_entry-smart_irrigation-5881d6768e50d37609c438ee283ca797.json

jeroenterheerdt commented 1 month ago

Hmm, thanks for letting me know. I myself don't use a solar radiation set up so could be a unit conversion issue.

jeroenterheerdt commented 1 month ago

@wauswaus the solar radiation is has to be converted in to MJ / m2 / day from W/m2. The factor used is 0.0864, which seems to be correct to me. I.E., 1 W / m2 is 0.0864 Mj/m2/day. That is what the code does and what my understanding is as well. So when it's being used the average of 54 W/m2 is then converted 4.6656 Mj/m2/day which is passed into the pyeto module here. Now the documentation for the pyeto module is lacking severly, but here's the function. Please read the description there and let me know if you think I am passing in the wrong values here.

wauswaus commented 1 month ago

Thanks for the quick look. I will also dive into this. In the meanwhile I have to question:

jeroenterheerdt commented 1 month ago

V1 had many many bugs, so arguably was often more incorrect than actual correct. I use an estimate from temperature for solar radiation since I don't have the sensor. I spotted a couple of issues though, working through them now. Looks like if the system is metric (as it is for you) then the conversion to MJ/m2/day doesn't actually happen. Oops.

jeroenterheerdt commented 1 month ago

@wauswaus can you install https://github.com/jeroenterheerdt/HAsmartirrigation/releases/tag/v2024.4.3? (make sure to find it in HACS with 'show beta versions' enabled). You will need to update your weather data to see the new changes as I made changes to the logic when the data is collected. Basically, you should see your pressure, wind speed, solar radiation values stored in hpa, m/s, mj/m2/day respectively, so the values should not line up with that the sensor returns if the unit is not that (for example your solar radiation is provided in w/m2 and should be stored in the storage file in mj/m2/day.

Please let me know if this gives you better results so I can publish it.

wauswaus commented 1 month ago

Man, you are on fire! Thanks. I installed the beta and it looks promising. I just have to wait out the coming rainy days to know for sure if it is all good.

jeroenterheerdt commented 1 month ago

Please monitor it and let me know what you're seeing. The numbers in the storage file should now be converted into mj/m2/day for solar radiation and m/s for windspeed.

wauswaus commented 1 month ago

Did a peek and it all looks good to me! I will continue to monitor, but the evaporation looks better. Many thanks!