Turn on/off a Lovelace view dynamically

I was just wondering if I’ve missed this somewhere but I’d like to make a view only be shown when I have an input boolean turned on.

Is this possible?

I’ve searched a bit but I haven’t found anything. the closest is CCH but as far as I understand it only changes views on a per user basis but not on an entity state change so it’s not really what I had in mind.

check out this example. should guide you in the right direction

Thanks. I didn’t see that.

Now I guess I’ll have to install CCH, too. :roll_eyes: :smile:

If it works I’ll pop back in and give your post the “solution”.

quick play, this hides my tab 6

  conditional_styles:                                                          #    
  - entity: input_boolean.dummy
    condition:
      state: 'off'
    tab:
      6:
        hide: true

I just installed everything and my first attempt isn’t going to well.

this is what I have so far in my ui-lovelace,yaml:

cch:
  conditional_styles:
    - entity: switch.debug_view
      condition:
        state: 'off'
      tab:
        7:
          hide: true

It looks pretty much exactly like yours but it’s not turning off the tab.

Maybe a silly question but…

how does CCH determine the tab numbering? do you have to designate that somewhere in your config or does it just “know” which tabs are which based on how they are written into the ui-lovelace.yaml file?

And as a follow on to that does CCH work if you have your lovelace config split up using !include’s

to start this is what mine looks like:

cch:                                                                           #
  active_tab_color: red                                                        #
  menu: overflow                                                               #
  options: clock                                                               #
  voice: hide                                                                  #
  clock_format: 12                                                             #
  clock_am_pm: true                                                            #
  date_locale: en-gb                                                           #
  swipe: true                                                                  #
  swipe_animate: fade                                                          #
  conditional_styles:                                                          #    
   - entity: input_boolean.dummy                                                #  
     condition:                                                                 #  
       state: 'off'                                                             #  
     tab:                                                                       #  
       6:                                                                       #  
         hide: true

the tab order is determined by the order in which your views are entered. So for example if first view in lovelace.yaml is Living this is tab 0 and so forth.

I got it working.

I didn’t realize that hitting the refresh button in the top right menu didn’t force a reload of the CCH config.

I had to hit the ctrl-F5 to do a hard refresh on the browser and it’s working now.

Thanks!

Is there any option now, without cch? ( Home Assistant 0.118.5)

Not as far as I know. It’s the only thing that has kept me from uninstalling CCH since it still works…for now.

This is what I was afraid of :frowning: