I created an Input Select Helper with 3 options to control the volume of my Sonos System. I created 3 scripts for every volume option. (low, medium, high)
Now I want to have three buttons on my dashboard were I can toggle between these 3 options. I manage to add the buttons and to activate the scripts via an automation.
The only thing I have not yet managed to do is show the status of the switches. Apparently that is only possible when the action is: toggle. In my case the action is: call service
One thing you could do is create a template binary sensor for each of the three states (high, medium, and low) and add those sensors as the entity for each button. I’m pretty sure this would work with the button cards you are using.
I do something similar with some custom-button-cards (I had other ways in which I wanted to control the style, which is why I’ve used those cards). Here’s an edited version of my cards (superfolous styles, etc have been removed).
Thanks for your help. I finally got it working. The buttons do what they’re supposed to do. There’s still one thing I can’t get done. The color. I want the color of the logo to change to orange when active. Any ideas? This is my code:
in case anyone is wondering about implementation, I needed the same function. Now the color changes based on the state of the input_select.
Using a button_card.
Much shorter in my dashboard file.
Everything seems to work except the color changing, which I assume it is due to this:
if (parseFloat(states['input_select.area_name'].state) == 'variables.name' )
I also tried it without the parseFloat (got that from some of my google searches)
if (states['input_select.area_name'].state == 'variables.name' )
Any idea what’s wrong. The cde I posted earlier works, so it is something with the comparison of the strings, or the retrieval of the variables.name…either way, not sure how to debug it because I can’t use the Developer->Template
I removed the quotes but still not workng. For completion, this is the code in the main yaml. I am only working the template development on a single button to test. This is the non-template code that works as expected.
(not sure why the code above does not have the proper spacing when pasted)
All code seems to work. The template code works as expected except the background color change. I mean when clicked, it changes the input_select variable to the right value, just not the color.
For whatever reason, I this morning, tried it again, and it worked.
Maybe a refresh/caching issue, although I did clear it for my testing. I’ll take it.