Show / Hide layers from the state of an input_bolean

Hi all

I’m trying to work out if I can trigger showing / hiding a layer in floorplan from the state of and input_bolean.

I have got the layer doing what i want with a button that I click in floorplan using this code

  - name: outside camera
    entities:
      - input_boolean.show_outside
    action:
    domain: class
    service: toggle
      data:
        elements:
          - layer3
        classes:
          - layer-visible
          - layer-hidden
        default_class: layer-hidden 

Thing is I want to trigger it via a voice command as this particular floorplan wont have a touch screen, so a button doesnt work.

Anyone have any ideas ?

If anyone is interested I didn’t really solve the layer show/ hide problem, I went about it another way.

I have a second floorplan which is going to be setup for magic mirror (lcd behind 2 way mirror)

What I wanted was to show a camera feed in the middle of the mirror when I would say “hey google show outside camera”

My solution was to put a black box over the camera feed so that it is hidden, attach a switch to that black box (could have used input_boolean as well) Using CSS class to hide the box so that it reveals the camera feed below it.

Here is my dummy switch, input_boolean would have worked as well.

 - platform: command_line
   switches:
     outside_camera:
       command_on: "pwd"
       command_off: "pwd"

floorplan.yaml

### Camera feed ###

  - name: show outside 
    entities:
    - switch.outside_auto
    states:
      - state: 'off'
        class: 'input_off'
      - state: 'on'
        class: 'input_on'

CSS

.input_off {
  display: initial !important;
}
.input_on {
  display: none !important;

}

Mirror is still work in progress and camera will be outside but you can see the video feed below (excuse mess)

I added a automation via node red that leaves switch on 30 seconds then turns off. also have another dummy switch that “hides outside” that turns off the camera display straight away if needed. that way via voice i can show and hide or just let it hide after 30 seconds.

All thats left now is to fix the camera feed not refreshing in floorplan.

1 Like

.input_off {
display: initial !important;
}
.input_on {
display: none !important;

}
What file is this set?
Can you share the full code of this project?

The camera feed part of floorplan stopped working with floorplan and i think 0.72 of home assistant, you could do this in lovelace though but I have changed my setup sorry. Best of luck