Turn the light on to brightness when motion is detected, depending on the selected time period, different brightness and turn-on time.
This bluprint is designed to turn on the light by the motion sensor, and takes into account that at night you need a dimmer light than during the day, so I created the opportunity to choose the period in which you want to have a different brightness of light other than daytime, as well as the time after which the light should turn off also divided into two periods
This is my first bluprint, so do not judge strictly, and perhaps there is a better option to create this
Motion-activated Light-brightness:
Get started
Click the badge to import this Blueprint:
Or import this Blueprint by using the forum topic URL:
blueprint:
name: Motion-activated Light-brightness
description: Turn the light on to brightness when motion is detected, depending on the selected time period, different brightness and turn-on time.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
on_night_time:
name: (Required) On Time Night
description: The time when the night mode starts.
selector:
time: {}
off_night_time:
name: (Required) Off Time Night
description: The time when the night mode ends.
selector:
time: {}
day_brightness:
name: Day brightness
description: Brightness, in daytime mode
default: 1
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
night_brightness:
name: Night brightness
description: Brightness, in night mode mode
default: 1
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
no_motion_wait_day:
name: Wait time day
description: Time to leave the light on after detecting the last movement for daytime mode.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
no_motion_wait_night:
name: Wait time night
description: Time to leave the light on after detecting the last movement in night mode
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
- choose:
- conditions:
- condition: time
after: !input on_night_time
before: !input off_night_time
sequence:
- alias: "Turn on the light"
service: light.turn_on
data:
brightness_pct: !input night_brightness
target: !input light_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait_night
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
default:
- alias: "Turn on the light"
service: light.turn_on
data:
brightness_pct: !input day_brightness
target: !input light_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait_day
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
At the request of people who liked my blueprint, I created a version with the ability to also choose the color temperature, unfortunately I do not have enough knowledge to do all this in one blueprint.
Motion-activated Light-brightness and temp:
Get started
Click the badge to import this Blueprint:
Or import this Blueprint by using the forum topic URL:
blueprint:
name: Motion-activated Light-brightness and temp
description: Turn the light on to brightness and temperature when motion is detected, depending on the selected time period, different brightness and turn-on time.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
on_night_time:
name: (Required) On Time Night
description: The time when the night mode starts.
selector:
time: {}
off_night_time:
name: (Required) Off Time Night
description: The time when the night mode ends.
selector:
time: {}
day_brightness:
name: (Required) Day brightness
description: Brightness, in daytime mode
default: 100
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
night_brightness:
name: (Required) Night brightness
description: Brightness, in night mode
default: 20
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
day_temp:
name: (Required) Day temp
description: Temp, in daytime mode
default: 1
selector:
color_temp:
night_temp:
name: (Required) Night temp
description: Temp, in night mode
default: 1
selector:
color_temp:
no_motion_wait_day:
name: Wait time day
description: Time to leave the light on after detecting the last movement for daytime mode.
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
no_motion_wait_night:
name: Wait time night
description: Time to leave the light on after detecting the last movement in night mode
default: 120
selector:
number:
min: 0
max: 3600
unit_of_measurement: seconds
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
- choose:
- conditions:
- condition: time
after: !input on_night_time
before: !input off_night_time
sequence:
- alias: "Turn on the light"
service: light.turn_on
data:
brightness_pct: !input night_brightness
color_temp: !input night_temp
target: !input light_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait_night
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
default:
- alias: "Turn on the light"
service: light.turn_on
data:
brightness_pct: !input day_brightness
color_temp: !input day_temp
target: !input light_target
- alias: "Wait until there is no motion from device"
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait_day
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
Motion-activated Light-brightness and color:
Get started
Click the badge to import this Blueprint:
Or import this Blueprint by using the forum topic URL:
blueprint:
name: Motion-activated Light-brightness and color
description: Turn the light on to brightness and color when motion is detected,
depending on the selected time period, different brightness and turn-on time.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
multiple: false
light_target:
name: Light
selector:
target:
entity:
domain: light
on_night_time:
name: (Required) On Time Night
description: The time when the night mode starts.
default: "23:00:00"
selector:
time: {}
off_night_time:
name: (Required) Off Time Night
description: The time when the night mode ends.
default: "8:00:00"
selector:
time: {}
day_brightness:
name: (Required) Day brightness
description: Brightness, in daytime mode
default: 100
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
night_brightness:
name: (Required) Night brightness
description: Brightness, in night mode
default: 20
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
day_color:
name: (Required) Day color
description: Color, in daytime mode
default: [255, 255, 255]
selector:
color_rgb:
night_color:
name: (Required) Night color
description: Color, in night mode
default: [255, 255, 255]
selector:
color_rgb:
no_motion_wait_day:
name: Wait time day
description: Time to leave the light on after detecting the last movement for
daytime mode.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
no_motion_wait_night:
name: Wait time night
description: Time to leave the light on after detecting the last movement in
night mode
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
mode: restart
max_exceeded: silent
trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'off'
to: 'on'
action:
- choose:
- conditions:
- condition: time
after: !input 'on_night_time'
before: !input 'off_night_time'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
brightness_pct: !input 'night_brightness'
rgb_color: !input 'night_color'
target: !input 'light_target'
- alias: Wait until there is no motion from device
wait_for_trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'on'
to: 'off'
- alias: Wait the number of seconds that has been set
delay: !input 'no_motion_wait_night'
- alias: Turn off the light
service: light.turn_off
target: !input 'light_target'
default:
- alias: Turn on the light
service: light.turn_on
data:
brightness_pct: !input 'day_brightness'
rgb_color: !input 'day_color'
target: !input 'light_target'
- alias: Wait until there is no motion from device
wait_for_trigger:
platform: state
entity_id: !input 'motion_entity'
from: 'on'
to: 'off'
- alias: Wait the number of seconds that has been set
delay: !input 'no_motion_wait_day'
- alias: Turn off the light
service: light.turn_off
target: !input 'light_target'
Motion-activated Light-brightness and color or temp and dimmed:
In this blueprint, all the previous functions are combined and the ability to select the transition time is added, the code turned out to be quite voluminous, unfortunately, I could not shorten it, because the variables have a local area of action, if anyone knows how to do this, please prompt
Get started
Click the badge to import this Blueprint:
Or import this Blueprint by using the forum topic URL:
blueprint:
name: Motion-activated Light-brightness and color or temp and dimmed
description: Turn the light on to brightness and color or temp when motion is detected,
depending on the selected time period, different brightness and turn-on time.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain:
- binary_sensor
multiple: true
light_target:
name: Light
selector:
target:
entity:
- domain:
- light
on_night_time:
name: (Required) On Time Night
description: The time when the night mode starts.
default: '23:00:00'
selector:
time: {}
off_night_time:
name: (Required) Off Time Night
description: The time when the night mode ends.
default: '8:00:00'
selector:
time: {}
day_brightness:
name: (Required) Day brightness
description: Brightness, in daytime mode
default: 100
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
night_brightness:
name: (Required) Night brightness
description: Brightness, in night mode
default: 20
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
transition_on:
name: Transition on
description: Duration it takes to get to on state.
default: 1
selector:
number:
min: 0.0
max: 60.0
unit_of_measurement: seconds
mode: slider
step: 1.0
transition_off:
name: Transition off
description: Duration it takes to get to off state.
default: 1
selector:
number:
min: 0.0
max: 60.0
unit_of_measurement: seconds
mode: slider
step: 1.0
mode_light_control_day:
name: Light Control Day
description: Select the options you would like to use. It will only control
a "light" entity that has a brightness setting.
default: use_brightness
selector:
select:
options:
- label: Only brightness
value: use_brightness
- label: Use_temp
value: use_temp
- label: Use_color
value: use_color
multiple: false
custom_value: false
mode_light_control_night:
name: Light Control Night
description: Select the options you would like to use. It will only control
a "light" entity that has a brightness setting.
default: use_brightness
selector:
select:
options:
- label: Only brightness
value: use_brightness
- label: Use_temp
value: use_temp
- label: Use_color
value: use_color
multiple: false
custom_value: false
day_color:
name: (Required) Day color
description: Color, in daytime mode
default:
- 255
- 255
- 255
selector:
color_rgb: {}
night_color:
name: (Required) Night color
description: Color, in night mode
default:
- 255
- 255
- 255
selector:
color_rgb: {}
day_temp:
name: (Required) Day temp
description: Temp, in daytime mode
default: 1
selector:
color_temp: {}
night_temp:
name: (Required) Night temp
description: Temp, in night mode
default: 1
selector:
color_temp: {}
no_motion_wait_day:
name: Wait time day
description: Time to leave the light on after detecting the last movement for
daytime mode.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
no_motion_wait_night:
name: Wait time night
description: Time to leave the light on after detecting the last movement in
night mode
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
mode_dimmed_light_day:
name: Light Dimmed Day
description: Select the options you would like to use.
default: use_off
selector:
select:
options:
- label: Only Turn Off
value: use_off
- label: Dimmed then Turn Off
value: use_dimmed_off
- label: Dimmed
value: use_dimmed
multiple: false
custom_value: false
mode_dimmed_light_night:
name: Light Dimmed Night
description: Select the options you would like to use.
default: use_off
selector:
select:
options:
- label: Only Turn Off
value: use_off
- label: Dimmed then Turn Off
value: use_dimmed_off
- label: Dimmed
value: use_dimmed
multiple: false
custom_value: false
day_dimmed:
name: Day dimmed
description: Brightness, in daytime mode
default: 50
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
night_dimmed:
name: Night dimmed
description: Brightness, in night mode
default: 10
selector:
number:
min: 1.0
max: 100.0
step: 1.0
mode: slider
delay_off_day:
name: Delay before complete off day
description: The time that the light will be dimmed before a complete off
default: 30
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
delay_off_night:
name: Delay before complete off night
description: The time that the light will be dimmed before a complete off
default: 30
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
source_url: https://gist.github.com/Aleks130699/1c8b5e04628f106702b4db392711b7a9
mode: restart
max_exceeded: silent
variables:
mode_light_control_day: !input mode_light_control_day
mode_light_control_night: !input mode_light_control_night
mode_dimmed_light_day: !input mode_dimmed_light_day
mode_dimmed_light_night: !input mode_dimmed_light_night
trigger:
platform: state
entity_id: !input motion_entity
from: 'off'
to: 'on'
action:
- choose:
- conditions:
- condition: time
after: !input on_night_time
before: !input off_night_time
sequence:
- parallel:
- choose:
- conditions:
- condition: template
value_template: '{{ mode_light_control_night == ''use_brightness'' }}'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input night_brightness
target: !input light_target
- conditions:
- condition: template
value_template: '{{ mode_light_control_night == ''use_temp'' }}'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input night_brightness
color_temp: !input night_temp
target: !input light_target
- conditions:
- condition: template
value_template: '{{ mode_light_control_night == ''use_color'' }}'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input night_brightness
rgb_color: !input night_color
target: !input light_target
- sequence:
- alias: Wait until there is no motion from device
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: 'on'
to: 'off'
- alias: Wait the number of seconds that has been set
delay: !input no_motion_wait_night
- choose:
- conditions:
- condition: template
value_template: '{{ mode_dimmed_light_night == ''use_dimmed'' or mode_dimmed_light_night == ''use_dimmed_off'' }}'
sequence:
- parallel:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input night_dimmed
target: !input light_target
- if:
- condition: template
value_template: '{{ mode_dimmed_light_night == ''use_dimmed_off'' }}'
then:
- alias: Wait the number of seconds that has been set
delay: !input delay_off_night
- alias: Turn off the light
service: light.turn_off
data:
transition: !input transition_off
target: !input light_target
- conditions:
- condition: template
value_template: '{{ mode_dimmed_light_night == ''use_off'' }}'
sequence:
- alias: Turn off the light
service: light.turn_off
data:
transition: !input transition_off
target: !input light_target
default:
- parallel:
- choose:
- conditions:
- condition: template
value_template: '{{ mode_light_control_day == ''use_brightness'' }}'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input day_brightness
target: !input light_target
- conditions:
- condition: template
value_template: '{{ mode_light_control_day == ''use_temp'' }}'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input day_brightness
color_temp: !input day_temp
target: !input light_target
- conditions:
- condition: template
value_template: '{{ mode_light_control_day == ''use_color'' }}'
sequence:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input day_brightness
rgb_color: !input day_color
target: !input light_target
- sequence:
- alias: Wait until there is no motion from device
wait_for_trigger:
platform: state
entity_id: !input motion_entity
from: 'on'
to: 'off'
- alias: Wait the number of seconds that has been set
delay: !input no_motion_wait_day
- choose:
- conditions:
- condition: template
value_template: '{{ mode_dimmed_light_day == ''use_dimmed'' or mode_dimmed_light_day == ''use_dimmed_off'' }}'
sequence:
- parallel:
- alias: Turn on the light
service: light.turn_on
data:
transition: !input transition_on
brightness_pct: !input day_dimmed
target: !input light_target
- if:
- condition: template
value_template: '{{ mode_dimmed_light_day == ''use_dimmed_off'' }}'
then:
- alias: Wait the number of seconds that has been set
delay: !input delay_off_day
- alias: Turn off the light
service: light.turn_off
data:
transition: !input transition_off
target: !input light_target
- conditions:
- condition: template
value_template: '{{ mode_dimmed_light_day == ''use_off'' }}'
sequence:
- alias: Turn off the light
service: light.turn_off
data:
transition: !input transition_off
target: !input light_target