Hiding switches that are 'Not Available'

I have several Sonoff Tasmota switches in my HA setup. Some of them are on things that are used only during certain seasons, like Christmas lights. Is there anyway to hide these switches when they are unplugged and the LWT mqtt message indicated it is ‘offline’? I imagine I can hack it with automatons, but I really don’t want to do a automation for each one. I know I can manually change the switches to be hidden when I am not using them, but I’d prefer not to take that manual step. I’d love something similar to ‘Hide when away’ for device trackers. Thanks!

You can do what you want using custom-ui from @andrey:

Here is a way that I hide an input_boolean if it’s off:

customize:
  binary_sensor.ha_update_avail_template:
    templates:
      hidden: "return (state === 'off' );"

I think there’s a few examples in lovelace for doing that as well

Thanks @finity I’ll give that a try!

Lovelace has a conditional card which can be used to show/hide a card depending on entity ‘state’ or ‘state_not’ values. If you’re able to use an existing state for your condition this will work, else you’ll need to setup a template sensor to do the job.

1 Like