I have an ambient weather station, since last update of HA or AW API stop working on the same day… so i decide to go with the local AWN integration.
The problem now it that i don’t see the last time it rain. it look this information was imported from AWN API.
I would like to know how can i created a sensor from the data that my daily or hourly rain sensor have. i want to have a sensor called “Last Rain” and have it display either minutes, hours, yesterda a week ago etc… of when was the last time it registers rain.
could this be possible?
i did search the forum but none of does yalm code are working for me… don’t know what i’m doing wrong.
Keep in mind that there are thousands of integrations for Home Assistant. There are many users here that can help you, but who don’t use the specific integration you are using, so we need you to provide as much detail as you can.
Share what you have tried, the results, and any error messages that those methods created. Share information about your rain sensor entity from the Developer Tools > States tool so we can understand what data there is to work with. Or explain how the sensor works. Does it return to 0 when the rain stops or is it an increasing total type sensor?
sensor.wp4olm_s_wx_last_rain is the one that stopped working. so i’m trying to do a similar sensor (timestamp) with any of the information provide by one of the other 2 sensor mark with red circle.
I’m trying to mark any update above 0 to any of does 2 sensors as the last time it rain.
this is the error i get on the check configuration:
Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/sensor.yaml”, line 126, column 7
expected , but found ‘’
in “/config/sensor.yaml”, line 129, column 8
That’s a number showing the last rain amount not a date/time. You could use states.sensor.wp4olm_s_wx_daily_rain.last_changed but there is a better way as that datetime will also change when the sensor resets daily. Try this instead:
(configuration.yaml)
template:
- trigger:
- platform: state
entity_id: sensor.wp4olm_s_wx_daily_rain
to: # A null "to:" triggers on all state changes, ignores attribute changes
sensor:
- name: "Last Rained"
icon: "mdi:water"
state: >
{% if trigger.to_state|float(0) != 0 %}
{{ now() }} {# format this as you wish #}
{% else %}
{{ this.state }} {# ignore changes to zero or unavailable states #}
{% endif %}