I have a template binary sensor which is indicating whether my washing machine is running or not. It does this by interpreting the power measured from an energy monitoring plug (TP-link HS110). It looks like this:
The problem is that these plugs are notorious (see here and here) for having issues where they intermittently lose connection and show “unavailable”. In my case the plug seems to lose connection and regain it after about 5 seconds:
How can I avoid this? Is there a way to say “only allow the washing machine binary template sensor to go to state unavailable if the source sensor (energy plug) has been unavailable for at least 1 minute” ? I basically want to ignore short periods of unavailable states in the source sensor.
Add an availability check in the sensor. Then it will not post some wild numbers or zeros, it will report a gap in data, Probably the best you can hope for with that hardware.
@Sir_Goodenough I assume you are talking about this setting? As far as I can see, it allows only to set True/False. But I would like the binary sensor to still go unavailable (so I know there is a problem), but to only do it if it’s been unavailable for some time.
yes, that’s true or false that there is data available. If you also add the default, it will show the default at that point when data is not available.
Search in the Docs for template examples or here in the forums.