I have a water flood sensor, wifi, which just connects to wifi when water is detected… for some seconds… and then disconnects to save battery…
When it disconnects expecting to some flood :)… HA lists it as unavailable… even after any flood the sensor went from “alarm”, to “normal”… and then to “unavailable” when disconnected to to energy saving mode…
Is there any simple way to just make HA remember last non-unavailable state?
That’s normal operation; if the physical sensor ceases to be accessible, its state is unavailable.
You could use a Template Sensor (to monitor the flood sensor and only report the desired values). It can be configured to ignore unavailable and only report the states you want.
that sounds very good, I was trying to do it but couldn;t figure it out.
I must create a new one in configuration.yaml, right, no way in UI…?
Would one new like:
binary_sensor:
- platform: template
with some rules to only give on are off with the states I say?
My case is a binary_sensor which only provides “alarm”, which is my “on”… and "normal"which is my off. I’d like to keep it that way and also put as normal/off when unavailable
Thanks, I had to change it because it was not working, it seems that my current sensor is binary so it was not recognized the “alarm”, but it was as “on”. This is the final config that worked: