Reddit user /u/lordjustice17 sent me a message (see below) on Reddit with a different use of Dynamically hide/unhide an entire view in Home Assistant



His code:



- platform: template
 switches:
   console:
     friendly_name: Control Panel
     value_template: "{{ is_state_attr('group.console', 'view', true) }}"
     turn_on:
       service: group.set
       data:
         object_id: console
         view: true
     turn_off:
       service: group.set
       data:
         object_id: console
         view: false


This creates a switch that shows and hides a view called console. Clever!