I was curious if anyone had a configuration example of an automation when the lights (in the kitchen) for example should turn on only when it is either a) dark in the room based on lumens or b) after 5pm but before 8am.
Thank you. I wonder if there would be a way to include the time – for example: 5PM and 8am only have them come on during that time based on motion activity.
Thank you all for posting these suggestions. They are very useful for an it illiterate individuaql like myself.
brilliant.
In my fist toe in the water.
I managed to turn on and off the lights correctly.
Once this is proved to work flawlesly. I will develop this into a template and use it for all my lights and add an additional condition that during certain hours the lights only come on at 60 %. (what can i say i’m lazy)
BTW
What does the sun.sun trigger elevation below -1.0 do?
This will trigger when the Sun angle with the horizon is below -1°. You could use “Sunset” instead, but as during the sunset usually still too bright, during twilight, and you dont need the lights yet and might wanna wait a little bit more until the Sun goes a bit more down the horizon, so you use a negative angle.
after: sunset only works from sunset to midnight. After midnight it won’t trigger
before: sunrise only works from midnight to dawn
below_horizon is any elevation value less than zero
below: -1.0 leaves a bit of time for twilight. You could make it -5.0 or -10.0 - whatever suits your locality. Twilight is longer the further from the equator you are.
blueprint:
name: Motion-activated Light
description: Turn on a light when motion is detected.
domain: automation
source_url: https://github.com/home-assistant/core/blob/a90ef3a5752d39b13ec57c7acee83cc36c0cd3bd/homeassistant/components/automation/blueprints/motion_light.yaml
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
device_class: motion
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
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"
condition:
- condition: not
conditions:
- condition: sun
after: sunrise
after_offset: '+01:00:00'
before: sunset
before_offset: '-01:00:00'
action:
- alias: "Turn on the light"
service: light.turn_on
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
- alias: "Turn off the light"
service: light.turn_off
target: !input light_target
Thanks, this is just perfect. I had to change this blueprint a couples of time before. But adding this condition works great for me. My whole house is full with motion sensors and its not necessary to light up the house when the sun is up
Update:
Was forgotten that the toilet was on the same blueprint as wel So i deleted it from the blueprint and added this condition in the yaml ( because its not an GUI option ) of the automation which is using the blueprint and that worked perfect.