Hi everyone, I have a temperature sensor that occasionally becomes unavailable for a few seconds and then reconnects.
I would like to filter the unavailable status so that when I disconnect, the last value sent by the sensor appears instead of “unknown”. I tried with a sensor template but I can’t. How could I do?
I tried to do such a thing (I think) but it doesn’t work in the sense that when the state becomes unavalaible with the code I wrote the sensor value disappears because in the condition I didn’t write anything, how could I tell it to leave the value as it is 'is?
Hi
I tried, but when the media_player entity is on I see the state (eg. Channel), when the media_player entity is “unknow” the template state is “null”
{% if states('media_player.lg_webos_smart_tv') not in ['unavailable', 'unknown'] %}
{{ state_attr('media_player.lg_webos_smart_tv', 'media_title') }}
{% else %}
{{ this.state }}
{% endif %}
The problem could be that:
media_title attribute is present only when the tv is on, when the tv is off this attribute disappears.
My idea was to create a sensor that tells me the current tv channel, using the media_title attribute of the media_player.lg_webos_smart_tv entity (and I managed to get that), but set a custom state (e.g. off) when the tv is off .