I am trying to set up a switch template for turning a night light on and off with various automations.
I want to be able to change the input boolean to on or off and have it switch the light.
Problem i’m getting, if I switch the switch the boolean updates and the light goes on or off. If I update the input boolean, the template switch also changes but the light does not go on or off.
I made a card for it while testing, you will see what I mean…
You’re describing expected behaviour. Common misconception is that the switch will react to the template change, but in fact the template is only there to establish the state of the switch with the turn_off and turn_on being executed when the switch is changed only.
What you want there is an automation that synchronises the states, or there’s an appdaemon app on hacs (name escapes me) that links entities together for this purpose.
What I’m not understanding is why you need an input boolean (and hence the need for a template switch/appdaemon app) at all if the only thing it ever does is just always follows the state of the light switch?
Why don’t you just use the light switch itself wherever you would use the input boolean?
That is how I had it set up a few days ago, (I think so… i’ve changed it so many times now I can’t remember what is up and what is down anymore!)
The light wasn’t always turning on through the automation. Then I read somewhere that it would be more reliable if you use a template switch. Something about when it gets multiple On commands and it thinks it’s already on (but its not) it discards them or something…