Value_template

I have

- platform: mqtt
    name: Side Door
    state_topic: "Sonoff3/Door/Status"
    value_template: >-
      {% if is_state('Side_Door','0') %}
        Closed
      {% else %}
        Open
      {%endif %}

it display a 0 / 1 before I did

so i added the if bit only shows Open NOW
what am i missing

just tryed
{% if is_state(‘sensor.side_door’,‘0’) %}
:frowning:

try using data_template instead of value_template

nop that didnt work :frowning:

Look like more reading

Try this:

- platform: mqtt
  name: Side Door
  state_topic: "sonoff3/door/status"
  value_template: >-
    {% if is_state('sensor.side_door','0') %}Closed
    {% else %}Open
    {% endif %}

nop

only see a 1 or 0 want to change it to Open / Closed

this is day 2 of hass.io

should I have something in the sensor bit ???

FIX FIX IT well this works
value_template: >-
{% if value is equalto “0” %}
Closed
{% else %}Open
{% endif %}

1 Like

Hello. Please help me with Aqara Temperature Sensor and pressure value from it.
I’m trying to use this configuration with convertation of the value from hPa to mmHg using value_template:

type: sensor
entity: sensor.0x00158d000349c2f9_pressure
name: Pressure
detail: 2
theme: default
graph: line
hours_to_show: 24
value_template: {{ states('sensor.temperature') | float * 0.75006375541921 }}

But I receive the error:
Your config is not supported by the UI editor:
Expected a value of type undefined for value_template but received {"[object Object]":null}.
Falling back to YAML editor.

What I do wrong?

What you trying do

looks like you try to display and read something

did you read this

you have sensor reading the data

and lovelace to display format the the data

Yes, I am trying to add the sensor to lovelace. But I want to add it and change it’s value (convert pressure units from hPa to mmHg). And for this I use this lovelace config:

type: sensor
entity: sensor.0x00158d000349c2f9_pressure
name: Pressure
detail: 2
theme: default
graph: line
hours_to_show: 24
value_template: {{ states('sensor.temperature') | float * 0.75006375541921 }}

But value_template does not work with the error:
Your config is not supported by the UI editor:
Expected a value of type undefined for value_template but received {"[object Object]":null} .
Falling back to YAML editor.

Why?

1 Like

Like I said

You Have to make a Sensor First

this is off top at head at work dont tell the boss

sensor:
  - platform: template
    sensors:
      pressure_cal:
        value_template:{{ states.sensor.sensorname.state | float * 0.75006375541921 }}

and then to add pressure_cal to the lovelace file

3 Likes