Hi,
I am new to Home assistant and just trying a few things out.
I have magnet sensors on all my doors and windows. By default they have a square icon that changes based on their state.
I want to use another mdi icon and read about templates.
What am I doing wrong here? This is a test for just one sensor, but I would rather have it for all off the same device_Class “Opening”.
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
- binary_sensor:
- name: Opening
state: >
{{ is_state("binary_sensor.lumi_lumi_sensor_magnet_aq2_821ef106_on_off", "on") }}
icon: >
{% if is_state("binary_sensor.lumi_lumi_sensor_magnet_aq2_821ef106_on_off", "on") %}
mdi:lock
{% else %}
mdi:lock-open-variant
{% endif %}
Could someone explain it to me like I was 5?
This seems to be such a basic task to do, yet I struggle to find any similar example and the docs are still a bit confusing for me.