I have a garage roller door that is triggered via a momentary switch (switch.sonoff_shed_door_relay_2). There is no way for the switch to know whether the garage door is open or closed as it goes on for 1 second then back to off.
I have a zigbee door sensor attached to the garage door that tells me whether it is open or closed (binary_sensor.shed_door_sensor_contact).
What I would like is to have the icon colour of the button I have assigned to trigger the shed switch get it’s state colour from the state of the door sensor. eg, it’s yellow when open, blue when closed.
Now to try to understand the instructions on that page and why I’m getting errors…
: Invalid config for [switch.template]: invalid slug Garage (try garage) for dictionary value @ data[‘switches’].
Not sure why, but this fixed the random error I was getting, but still not getting state from the door sensor to show as state for the templated switch.
This definitely looks close to what I want, still for the life of me can’t work out what I am doing wrong though. I’ve got the cover template actuating the shed door, but still not showing the correct state.
In the developer tools|states panel, tell us that the state of binary_sensor.shed_door_sensor_contact is when the door is open and closed.
position_template takes a value between 0 (closed) and 100 (open). Your binary sensor will be false or true I think. You may need to convert it to an int, and multiply by 100. But I am guessing until I know the states.
The main problem for me is, that with this kind of cover Alexa is asking for a code to open the garage door and there is no option to decativate the code request.
This makes it unusable for me and I need to figure out another approach.