How to create one button to switch all lights off on bottom floor

I’ve been trying to make a group and other possible solutions which I’ve fou d on YouTube and here. Not succeeded.

What I want is to create one button to switch All lights of when I go to bed. Not toggle because some are possibly already off. Some with a solution or link to a solution?

Hi Mark, you’re links didn’t attach

What exactly have you tried? and what didn’t work about it?

I would think that a group would have been the correct answer.

Or just putting all the lights you want to switch off together in a Lovelace card and then you will end up with a switch at the top of the card that also allow you to switch all of the entities in the card on or off at the same time.

How about a scene
Create a sence in the configuration page with all the devices and entries you would like.
Set the values in the scene to off for all the devices in the scene.

Create an automation that actions the scene

Helpful link

if it helps here is the code in my scenes.yaml for my christmas lights

- id: '1576871841018'
  name: Turn off all Christmas lights
  entities:
    switch.christmas_path:
      friendly_name: Christmas Path
      state: 'off'
    switch.christmas_tree:
      friendly_name: Christmas Tree
      state: 'off'

Code in Automations.yaml

- id: '1577916806637'
  alias: turn_off_all_christmas_lights
  description: ''
  trigger:
  - device_id: b2af3e0edac34385b3cebaf8ed540024
    domain: deconz
    platform: device
    subtype: turn_on
    type: remote_button_triple_press
  condition: []
  action:
  - scene: scene.turn_off_all_christmas_lights

Yes, I did that. But what I don’t want for that card is too see all seperate switches. I only want one switch for the entire group.

Put the switches together in a group, then add an entities card with that group in your ui. This should result in a single switch that operates all grouped lights (explicit on/off, not toggle).

Have you tried a light group?

That’s why I asked what you have tried so we can stop guessing at what you have tried and why it “didn’t work”. It makes it easier to give suggestions.

1 Like

What I did now is:
In configuration.yaml:

light:
  - platform: group
    name: All lights bottom floor
    entities:
      - light.hd_right
      - light.hd_left
      - light.wall_right
      - light.wall_left
      - light.light_sonos
      - light.light_ceiling
      - light.tv_left
      - light.tv_right
      - light.switch_lights_table_living
  - platform: switch
    name: Switch lights table living
    entity_id: switch.lights_table

After this I have added a entity card in lovelace. Now I have one switch with on/off for all lights and switches (conneccted to lights) in the bottom floor.

Thank you. for this great support. I didn’t put in the youtube links because I have been watching Youtube for several days and did not know all the visited links.

2 Likes

Something that pulled me up a while was adding a group to the group.yaml file instead of in the configuration.yaml, just remove the “-platform: group” line eg

light:
    name: All lights bottom floor
    entities:
      - light.hd_right
      - light.hd_left
      - light.wall_right
      - light.wall_left
      - light.light_sonos
      - light.light_ceiling
      - light.tv_left
      - light.tv_right
      - light.switch_lights_table_living
2 Likes

Thank you. For best practice reasons I did add this to the group.yaml insteat of confiiguration.yaml.

usually it’s standard practice to credit the “solution” selection to the post that solved your problem. If you solved it yourself then you would give it to yourself. I don’t think that’s the case here since someone else pointed you to the solution.

:wink:

Might flick an email to the moderators, I hear what you are saying finity, if I’ guessing what has happen Mark has selected his post as the solution which it is yet in the first post it say solved by which to me is different.
For me solution is the end goal that anyone can look at to see the code, solved by are the key people that helped you get there.

Maybe have a solution and solved by links in the posts or at least have the wording of the tick and quote in the first post to match.

1 Like

It was not to give myself the credits. It was indeed to describe the solution and mark it as the solution for future readers not having to read the whole thread. Sorry if it doesn’t work this way. My bad then.

just for those coming across this in 2021, i solved this using groups and groups of groups. That seemed to give me the most flexibility and ease of maintenance

my groups.yaml

lounge:  
  name: Lounge
  entities:
    - light.example_1
    - light.example_2
kitchen:
  name: Kitchen
  entities:
    - light.example_3
    - light.example_4

downstairs:
  name: All Downstairs
  entities:
    - group.kitchen
    - group.lounge
7 Likes