Display icon on/off as needed

Hi there,

Here another “took me forever … thought I’d share it”.

Problem:
For my Pool Automation I am using Valve Actuators, controlled by a 4Ch Sonoff. In order to move the valve to “Warerfall mode” or “Spa mode” I switch the actuator on for 20 or so secs and then off. And vice versa. So after moving the valve my Sonoff channels are “off” and the corresponding icons are “off”. However - I want to show what mode I am currently running. So, I need an icon that I can control based on my “last valve movement”. For sure this can be transferred to any “I need to display an icon that I can control” situation.

Solution:
“Helpers”!! Took me forever to find those damn little things. A helper basically is a boolean variable that you can control with automations. So when my automation runs that switch on the relevant Sonoff channel, I set the Helper “Spa” to “on”. And vice versa.

Now the kicker is that you can display a “Helper” like a button. So it will show what it is currently set to (yes, I have a heart-shaped Spa :roll_eyes:). In this application I am switching between 2 helpers (Waterfall or Spa) with the help of a conditional card.
Screenshot 2023-10-28 at 2.41.14 PM

Here a screenshot of what I have so far. The left group is the main pool power, controlled by an Enbrighten 40amps Z-Wave switch. It’s status can be displayed directly as it is a “button”. Same for the group on the right. Those are Valve actuators controlled by Sonoff channels. The middle group is as discussed above.

Let me know what you guys think.

One problem I still have. When the conditional card gets swapped out it loses it’s background color that is set via card-mod. Some CSS voodoo going on here … See the background here is black and not partly transparent as set via card-mod. This happens every other time. Independently of the card that is shown (Waterfall or Spa). Any ideas?
Screenshot 2023-10-28 at 3.06.13 PM

Thanks,
Truwolf