Hi
I am new to HA .I am trying to create a template switch . With the below code, I am able to get the switch in UI but when I toggle it to ON , it turns on the soundbar and toggle icon just goes back to its previous state (off) . The soundbar doesn’t turn off though .
I believe you need to enclose the on and off in the value_template in single quotes as they also have other special meanings. That should be in the Templating documentation. Also media_players tend to have states other than on and off like pause, stop, idle ,etc. I’m not sure about the Bose media_player but you should check the documentation.
Appreciate the response . I just tried this removing the on and off in value_template and I have the same issue again .I have bose soundtouch 300 . I don’t see any specifics to turning on/off the soundtouch in integration page .As you can see from the screen shot, the switch shows as off but the sound bar is actually turned on . As soon as I turn on the switch ,it turns on the soundbar but the switch goes back to OFF .
Go into the Developer Tools/States and locate the media_player.bose. What does the State column report? It probably isn’t ‘on’. Media players can report a State of ‘on’, ‘off’, ‘pause’, ‘idle’, etc. Likely your bose is in ‘idle’ state which isn’t ‘on’ hence the switch turns off. You will probably want to say
Thank you for tagging my post with the Solution tag. However, I believe you should tag micque’s post as the Solution because it was offered first and also fixes the problem you reported.