I am trying to make my first coded sensor in configuration.yaml and it is not going very well. I would like to make a sensor showing the difference between two temperature sensors.
Attached is a picture of my code and the error message. Hope to get some help to make the code work.
I think your line alignment is a bit off. It should be something like:
- binary_sensor:
- name: test
device_class: door
state: >
{% if is_state('input_boolean.test', 'off') %}
off
{% elif is_state('input_boolean.test', 'on') %}
on
{% endif %}