Created
December 15, 2020 01:40
-
-
Save niemyjski/10dc10bc34de55d8094c95c3dd65cd97 to your computer and use it in GitHub Desktop.
homeassistant blueprint - Turn on a light when motion is detected and Illuminance is low.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Turn the light on when motion is detected | |
description: Turn on a light when motion is detected and Illuminance is low. | |
domain: automation | |
source_url: https://github.com/niemyjski/home-assistant-config/tree/master/blueprints/automation/niemyjski/motion_light.yaml | |
input: | |
motion: | |
name: Motion Sensor | |
description: The motion sensor wich triggers the light to turn on | |
selector: | |
target: | |
entity: | |
domain: binary_sensor | |
device_class: motion | |
light: | |
name: Light | |
selector: | |
target: | |
entity: | |
domain: light | |
illuminance: | |
name: Illuminance | |
description: The illuminance sensor | |
selector: | |
entity: | |
domain: sensor | |
device_class: illuminance | |
illuminance_threshold_below: | |
name: Illuminance Threshold | |
description: Turn on the light after motion is detected and illuminance is below lx | |
default: 3000 | |
selector: | |
number: | |
min: 0 | |
max: 100000 | |
unit_of_measurement: lx | |
sleep_mode: | |
name: Sleep Mode (Optional) | |
default: false | |
selector: | |
entity: | |
domain: input_boolean | |
variables: | |
motion_entities: !input motion | |
sleep_mode_input: !input sleep_mode | |
trigger: | |
- platform: state | |
entity_id: !input motion | |
from: 'off' | |
to: 'on' | |
- platform: state | |
entity_id: !input illuminance | |
- platform: state | |
entity_id: !input sleep_mode | |
from: 'on' | |
to: 'off' | |
condition: | |
- condition: state | |
entity_id: !input motion | |
state: 'on' | |
- "{{ expand(motion_entities) | selectattr('state', 'eq', 'on') | list | count > 0 }}" | |
- condition: numeric_state | |
entity_id: !input illuminance | |
below: !input illuminance_threshold_below | |
- "{{ not sleep_mode_input or is_state(sleep_mode_input, 'off') }}" | |
action: | |
- service: light.turn_on | |
target: !input light |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a WIP. There are some issues when an area is selected.