binary_sensor.door_sensor_1 works OK, tested in template editor.
garage_door_state is always ‘off’ and shows on dashboard as ‘Closed’ due to ‘device_class: window’
Doesn’t matter what I put in the comparison, result is always ‘off’.
Also the ‘icon:’ statement does nothing.
What am I missing? After hours of reading forum where there is a mix of old and new way of doing this and reading documentation, i am stuck.
The availability template will make the state unavailable instead of off if the door sensor is neither on nor off.
Finally you probably don’t even need a template sensor. You can do this from the frontend by clicking on binary_sensor.door_sensor_1 then clicking on the cog icon at the top of the pop-up card:
You can change the name and entity id to whatever you want too. But be careful if you have already used the entity id elsewhere in automations or scripts. You will need to change them too.
Hi
Thank you very much for corrections and suggestions.
Indentations, have to do some more homework on it. Thanks for spotting this.
Will consider using cover template you suggested, LiQuid_cOOled.
With
state: “{{ is_state(‘binary_sensor.door_sensor_1’,‘on’) }}”
and correct “icon:>” indentation
it was OK.
I learned one more thing.
When I created a dashboard card, I specified an icon, as suggested by “Entity Card Configuration”.
This prevented displaying of open/close door icons specified in my template or those provided by the system according to device-class.
I did the same mistake when I first configured the sensor.
I ended up using the shortest version provided by Tom.
And you are right, Tom, I don’t really need a template sensor, it was just my first template-exercise
Thank you all very much. I really appreciate your very kind and helpful attitude.
Yep that will override the device class icons. I’ve asked for two icons (one for on and one for off, I don’t know if it will ever happen though. See: WTH can't we define two icons?