Lovelace Icon to change state if entities underneath it are on or off

Hi Guys,

I have a dashboard which has a set of three buttons in a ‘Horizontal Stack Card Configuration’. One of those buttons is called ‘Lights’ and when pressed shows all of the light entities in my house so that I can individually control them. The current icon on the main button is ‘mdi:lamp’.

I was looking to have the ‘Lights’ button change to show me if any of the entities underneath were on. For example, if none of the entities underneath are on then it should be ‘mdi:lamp-outline’ and if even just one of those lights is on, the main button should show ‘mdi:lamp’.

Thanks in advance.

Any help appreciated guys

Hi,

I don’t know how to chance an icon of the light button based on the light state, but you can try to make a “Helper” switch (boolean) in combination with a automation that turns on the boolean if any of the lights are on, and turn off the boolean when they are all off (Make a light group with all lights in it).

What is your card setup? with a push action?

I am using a Horizontal Stack Card Configuration.

image

When you click the ‘Lights’ button it takes you into a new screen with multiple buttons on horizontal stack cards.