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