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

Template sensor - Mixed numeric and text output! Possible?

$
0
0

@jim1977 wrote:

Hello!

I’ve got a sensor which I’d like to create a template sensor for.
When “sensor.battery_time_to_go” shows “0” I’d like to display the word “infinate” and any positive numerical value after that to display as normal. ie: 1.1, 10.2 etc

Template sensor:

  time_to_go:
    friendly_name: "Time to go"
    unit_of_measurement: 'Hrs'
    entity_id:
      - sensor.battery_time_to_go
    value_template: "{%if states.sensor.battery_time_to_go == '0' %}Infinate{% endif %}"

Is this possible?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95343

Trending Articles



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