Closed dutch-erik closed 3 years ago
I'm seeing the same issue on both my test and prod environment. Running HA core 2021.7.4 I used this 'Next rain forecast' sensor to send me a notification when rain is ahead and a window is still open, but now that the sensor is not in minutes anymore but it's showing a real time it's a lot harder to trigger any automation.
+1 I also used the next rain forecast, bt than for my awning. I hope it can changed to minutes again instead of a timestamp.
That explains why I didn't get any notifications anymore... I guess this is an unintended change as the unit of measurement is still minutes.
cc @StevenLooman
Yes, this is an unintended change. Although, Home Assistant does state that timestamps should be used instead of relative times. Can't find the 'official statement', but the [release page of 2020.12] does state the following for some sensors:
In order to optimize stability and performance of Home Assistant, sensors should use only absolute time values (store the date of the event) and not relative time values (seconds from event) so the value doesn’t change each second.
A users posted in their comments, lower at that page, that this can be worked around by using a template sensor:
- condition: template
value_template: "{{ (((as_timestamp(now()) - as_timestamp(states('sensor.uptime'))) % 3600) / 60) | int > 1 }}"
The example it is for the uptime
-integration/sensor, but I'm sure it'll work for the buienalarm
integration/sensor too.
I don't mind adding another sensor, or renaming the current next-rain-forecast sensor and adding a relative sensor, but this shouldn't be needed. Your call...
Well, that's up to @gieljnssns. Something has to change at least as the unit of measurement does not match the actual sensor data.
Something has to change at least as the unit of measurement does not match the actual sensor data.
Agreed. Also, the sensors should do some rounding where relevant.
Anyone had any luck to create a template sensor to calculate te minutes till rain? I tried, but didn't had any luck.
I'll try to do some work on this, this weekend.
I'll try to do some work on this, this weekend.
Thank you!
The README includes an example:
template:
- sensor:
- name: "Buienalarm Next rain forecast (min)"
unit_of_measurement: "min"
state: >
{% if as_timestamp(states('sensor.buienalarm_next_rain_forecast')) %}
{{ ( ( as_timestamp(states('sensor.buienalarm_next_rain_forecast')) - as_timestamp(now()) ) / 60 ) | round }}
{% else %}
{{ states('nonexistent') }}
{% endif %}
Be sure to upgrade the integration. Please let me know if you run into anything.
Thank you!
I think this issue can be close, @gieljnssns ?
Not 100% sure, but below changed couple of days ago. See next rain forecast and Precipitation forecast average.