Hi, I have multiple MQTT sensors (Tasmota with automatic discovery). I defined a few binary sensors on top of it as input triggers/conditions for automation, e.g.
binary_sensor:
- platform: template
sensors:
return_warmer:
friendly_name: "Return water from panel is warmer than input"
value_template: "{{ (states('sensor.panel_input_temperature') | float) < (states('sensor.panel_return_temperature') | float) }}"
Some of my sensors don’t send data intermittently (honestly I don’t know why but they are never missing data for very long, maybe 2-3 minutes or so). If there is a missing value this will randomly become true or false depending on which value is missing (I think).
So I tried to make things consistent by adding a condition for unavailability, like this:
value_template: "{{ false if (states('sensor.panel_input_temperature') == 'unavailable' or states('sensor.panel_return_temperature') == 'unavailable') else (states('sensor.panel_input_temperature') | float) < (states('sensor.panel_return_temperature') | float) }}"
But now whenever one of the sensors goes offline it will just turn to false.
What I actually want is that the sensors retain the previous value for longer before becoming unavailable. Is this configurable? I’d love to just set it to 5-10 minutes. The temperatures in mys solar system don’t change that quickly.