Hello All,
I am setting up a new sensor/entity following the guide here: [Template](https://www.home-assistant.io/integrations/template/#device_class)
I am using the examples from:
STATE BASED SENSOR MODIFYING ANOTHER SENSOR’S OUTPUT
template:
- sensor:
- name: "Sun State"
state: >
{% if is_state('sun.sun', 'above_horizon') %}
up
{% else %}
down
{% endif %}
and:
TATE BASED SENSOR WITH MULTILINE TEMPLATE WITH AN IF TEST
template:
- sensor:
- name: "Kettle"
state: >
{% if is_state('switch.kettle', 'off') %}
off
{% elif state_attr('switch.kettle', 'W')|float < 1000 %}
standby
{% elif is_state('switch.kettle', 'on') %}
on
{% else %}
failed
{% endif %}
This is my code I have in my configurations.yaml:
template:
- binary_sensor:
- name: "Water Level"
state: >
{% if is_state('binary_sensor.0x00158d0008796f2c_water_leak', 'Wet') %}
Normal
{% elif is_state('binary_sensor.0x00158d0008796f2c_water_leak', 'Dry') %}
Low
{% else %}
failed
{% endif %}
I have tried just sensor instead of binary_sensor with same results.
My issue is that no matter if the sensor is Wet or Dry it just stays “Normal” . I am trying to get this setup/working so I can view the state of the device more accurately for what it is being used for.
All of the guides and previous forum post I could find reference the old legacy way of writing this out. I am trying to use the new standard way. I can’t seem to get this to report correctly. I am hoping that someone on this forum is able to see what I am doing wrong.