Single user lights

When only one person is home, when they turn on a light, it will automatically turn off all other lights.

You can select the lights that will trigger this (e.g. bedrooms). I do not use that in the living room for example, where I want to be able to have multiple lights on. But when I come to the office, it will turn all other lights off.

It uses person entities to count how many people are home. And it only works if there is one person entity in state home. This is to prevent turning off the lights if other people might be in other rooms.

I mentioned this automation in my video: Automating lights in Home Assistant

blueprint:
  name: Single user lights
  description: >
    When only one person is home,
    when light goes on (for defined lighs, e.g. bedrooms),
    turn off all other lights!
  domain: automation
  source_url: https://github.com/bruxy70/blueprints/single_user_lights.yaml
  input:
    light_list:
      name: Light list
      description: List of lights that will trigger all other lights off
      selector:
        target:
          entity:
            domain: light
trigger:
  - platform: state
    entity_id: !input light_list
    from: "off"
    to: "on"
condition:
  condition: template
  value_template: "{{ states.person | map(attribute='state') | select('eq','home') | list | length == 1 }}"
action:
  - service: light.turn_off
    data_template:
      entity_id: "{{ states.light | map(attribute='entity_id') | select('ne', trigger.entity_id) | join(', ') }}"
mode: single
2 Likes

How are you using the Entity selector to get a list of lights? The selector only allows selecting a single item from its menu.

The only workaround I know of is to have the user manually type a comma-separated string of entity_ids.

light.kitchen, light.dining, light.zx_56TV42

However, it diminishes the convenience of using a blueprint because the user must type the entity_ids from memory and avoid making any spelling or syntax errors. In addition, if they make the mistake of choosing an item from the menu, it will overwrite anything they may have already typed.

I guess you did not try before asking. The target allows you to select multiple entities…

1 Like

You are 100% correct; I did not notice that the selector uses target. I apologize for the error. :man_facepalming: