jeroenterheerdt / HAsmartirrigation

Smart Irrigation custom component for Home Assistant
MIT License
308 stars 48 forks source link

[Bug] Dew Point Negative Temperature Error #80

Closed natosys closed 9 months ago

natosys commented 2 years ago

Describe the bug Dew point values that are negative cause an error.

To Reproduce Have a negative dew_point value input.

Expected behavior I'm not familiar with the calculation for evapotranspiration so I cannot say whether a negative dew point is suitable for input. If one is not suitable perhaps we could floor the dew_point value to 0 with inputs <0.

Screenshots I'm not sure a screenshot is helpful, but an excerpt from the error log below.

File "/config/custom_components/smart_irrigation/OWMClient.py", line 61, in get_data
    self.validationError(k,data[k],OWM_validators[k]["min"],OWM_validators[k]["max"])
  File "/config/custom_components/smart_irrigation/OWMClient.py", line 84, in validationError
    raise ValueError("Value {0} is not valid for {1}. Excepted range: {2}-{3}".format(value,key,minval,maxval))
ValueError: Value -5.95 is not valid for dew_point. Excepted range: 0-35
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/config/custom_components/smart_irrigation/__init__.py", line 533, in _async_initial_update
    await self.handle_calculate_hourly_adjusted_run_time(call=None)
  File "/config/custom_components/smart_irrigation/__init__.py", line 406, in handle_calculate_hourly_adjusted_run_time
    self.data = await self._async_update_data()
  File "/config/custom_components/smart_irrigation/__init__.py", line 546, in _async_update_data
    raise UpdateFailed(exception)
homeassistant.helpers.update_coordinator.UpdateFailed: Value -5.95 is not valid for dew_point. Excepted range: 0-35

Installed version 0.74

Additional context Previous versions have not shown the issue and rolling back to previous versions has resolved this issue. I currently use an ecowitt weather vain for most of the inputs to this integration and it generates negative dew point values.

Thanks for a great integration!

jeroenterheerdt commented 2 years ago

Hi @natosys that's interesting. I thought dewpoint could not be below 0. What was the temperature around that time?

jeroenterheerdt commented 2 years ago

but it seems like I was wrong. I'll change the code - it seems like the lowest dewpoint recorded was -21 degrees Celsius.

natosys commented 2 years ago

I think at <0 it would be referred to as the frost point rather than the dew point, but I'm not sure that matters for this use case.

Thanks for what you do.

karwosts commented 2 years ago

I had this same issue, and I will add that the integration seems like it really did not handle this scenario gracefully. I thought it would just catch the error and drop the reading if the range was out of bounds, but instead it seems like the entire integration completey died and every entity state/attribute just got replaced with "unavailable" or "unknown". I had to reboot to get it capturing data again.

Just FYI.

jeroenterheerdt commented 2 years ago

hmm, seems like we need to handle it more gracefully. I thought I tested this... sorry.

jeroenterheerdt commented 2 years ago

Please install the latest pre-release (https://github.com/jeroenterheerdt/HAsmartirrigation/releases/tag/0.0.76b) and see if you still are having issues.

natosys commented 2 years ago

Just installed, will come back to you.

natosys commented 2 years ago

went to reinstall and i'm having some trouble with the integration not appearing in the add integration menu for some reason... i haven't given up just yet though.

natosys commented 2 years ago

Okay, so I've had some other issues (availability of my sensors) which resulted in me setting up alternate sensors. However, I keep having an issue with the version number... This might be a really simple thing to fix that I have just not run into before but it appears to not like the letter at the back end. Has anyone handled this before?

jeroenterheerdt commented 2 years ago

any updates on this @natosys?

natosys commented 2 years ago

I've had an issue where the daily watering time stays permanently at 0. I'm not sure what is doing it though as I've deleted the smart irrigation component and re-added older versions, as well as using local weather sensors and OWM sensors and the issue persists. I can see the hourly adjusted runtime floating but the daily adjusted remains at zero at all times.

jeroenterheerdt commented 2 years ago

can you post some logs please?

natosys commented 2 years ago

righto, just switched logs to debug for smart irrigation. I will let it run for a couple of days and post the results.

natosys commented 2 years ago

Hi @jeroenterheerdt, log as promised. It looks like, regardless of the precipitation amount it calculates a water_budget and adjusted_run_time of 0. debug log.txt

jeroenterheerdt commented 9 months ago

closing this issue because of staleness, please re-open an issue if this is still a problem in 2.0 version (now in beta)