i have a binary_sensor
- platform: mqtt
state_topic: "home/433toMQTT"
name: "Campainha"
payload_on: "10340193"
payload_off: "10340193off"
sensor_class: sound
the entity id is: binary.sensor.campainha...
now i trying to use a template and i make this:
- platform: template
sensors:
campainha:
friendly_name: 'Campainha'
sensor_class: 'sound'
value_template: >-
{%- if is_state("binary_sensor.campainha", "off") -%}
Ninguem está a tocar
{%- else -%}
Tocou
{%- endif %}
entity_id:
- binary_sensor.campainha
but when binary.sensor.campainha is off or on not show me template on front.
what is wrong?
not should show Campainha-------------------------Ninguem esta a tocar.
or
Campainha-------------------------tocou
???
solved:
- platform: template
sensors:
campainha_escada:
friendly_name: 'Campainha da Escada'
value_template: >
{%- if is_state('binary_sensor.campainha', 'off') -%}
Ninguem está a tocar
{%- else -%}
tocou
{%- endif -%}