Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106416

Value Templates

$
0
0

More template fun from me today, I see historically you could use value templates when creating a template sensor, but I can’t see anything like that in the documentation for the modern templates,

Basically I am trying to take the value from a sensor and pass it on, unless it’s ‘unavailable’ in which case replace it with N/A or Off.

sensor:
  - name: Kitchen_timer
    value_template: >
      {% if states('sensor.kitchen_echo_next_timer') == "unavailable" %}
        {{states('N/A')}}
      {% else %}
      {{states('sensor.kitchen_echo_next_timer')}}
      {% endif %}

This is what I’ve come up with based on a sensor template info I’ve managed to find, but obviously I am doing sometehing wrong, anyone got any ideas.

4 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 106416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>