I have my template working but want to change the icon color when motion is detected. I have tried different examples that I found in the forum but none of them are working. How can I change the color when motion is detected?
- platform: template
sensors:
living_room_motion:
friendly_name: "Living Room Motion"
value_template: >-
{% if is_state('binary_sensor.living_room_motion_44662', 'off') %}
{% elif is_state('binary_sensor.living_room_motion_44662', 'on') %}
Detected
{% else %}
failed
{% endif %}
icon_template: >-
{% if is_state('binary_sensor.living_room_motion_44662', 'off') %}
mdi:walk
{% elif is_state('binary_sensor.living_room_motion_44662', 'on') %}
mdi:run
{% endif %}