Mapping scenes to a switch

I am illuminating a LEGO set with an ESP32-C3 and several PCA9685. I have configured the individual ports and added the ESP32 to its own “area”. This area now has 19 different lamps with different effects.

Now I would like to assign a single switch (preferably light) to my “living room” area, where I can switch the set on and off once.

When the set is switched on, it means that most of the outputs go into a light effect.

In the best case scenario, I would also like to be able to not only switch on and off this switch in the living room, but also set something like effects directly so that I can play entire light scenes in the set.

Does anyone have any ideas on how I can best realize this?

The service light.turn_on (and turn_off and toggle) can take an area as the target.

Have you created a scene? If not take a look at this short youtube vid.

  1. Create a Toggle helper
  2. Create an Automation that will activate 1 of 2 scenes depending on state
  3. That’s it.

Create Automation.

  1. Go to Settings/Automations and Scenes
  2. Click ‘Create Automation’ at the bottom right
  3. Click on the 3 dots at the top right
  4. Click on Edit in Yaml
  5. Paste in the code below (change the entity_id:)
  6. Save
  7. Let us all know how it went.
alias: my lights
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.my_lights
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.my_lights
            state: "on"
        sequence:
          - service: scene.turn_on
            metadata: {}
            target:
              entity_id: scene.disco_2
      - conditions:
          - condition: state
            entity_id: input_boolean.my_lights
            state: "off"
        sequence:
          - service: scene.turn_on
            metadata: {}
            target:
              entity_id: scene.living_room
mode: single
1 Like