I have written this script to count the open doors and windows. Counting does work, but the selection of the appropriate icon does’nt work. What is the mistake I made?
to your question; in the icon_template you need reference the full name of the sensor, so instead of ... door_count | int > 0 ...
you need ... states('sensor.door_count') | int > 0 ...
We must note that the legacy notation is not deprecated and still works.
“Switching” to the new notation is just a matter of a user’s desire.
There are some new things came up with a new notation (“trigger”), there are some things which are not supported anymore (“friendly_names”).
########### Alarm Control Panel ###########
alarm_control_panel:
platform: manual
name: Haus Alarm
code: 9257
code_arm_required: false
arming_time: 0 # The time of the ‘arming’ state before affecting a state change
delay_time: 0 # The time of the ‘pending’ state before triggering the alarm
trigger_time: 00 # The time of the ‘triggered’ state in which the alarm is firing
disarm_after_trigger: false
disarmed:
trigger_time: 0
armed_night:
arming_time: 0
delay_time: 0
armed_away:
arming_time: 0
delay_time: 0
It delivers still the same result as my YAML did. The number of open doors and windows are shown in the dashboard card correctly, but the icons are not shown and not changing. Normally, when no door or window is open the mdi:window/door-closed should been shown. That does not work and also the icon for open windows/doors is not shown.
I think you need to check again as this is the proper way to handle this and works for many people. Otherwise, you need to recreate the code in the icon_template.
Keep in mind at startup or restart, the icon will not be in sync as the state machine does not have a state yet. The icon will always show off in that case until the first state change occurs that causes the value_template to update.
If you don’t like that, you have to add the code in value_template to your icon_template.