Motion-Triggered Lights¶
Scheduling lights is really easy with the switch
actor type. Even
associating motion sensors isn’t too complicated with just a single
additional schedule rule. The procedure is identical to that used for
Open Door or Window Detection, except that the binary_sensor
entities
now report motion instead of open windows and the value needs to be set to
"on"
while motion is detected.
Let’s assume the following:
- You’ve got a room named
entrance
configured in Schedy with one or more lights as actors. - There’S a motion sensor
binary_sensor.entrance_motion
that switches toon
when motion is detected.
Ok, let’s get started.
Add a custom
motion_room: entrance
attribute to thebinary_sensor.entrance_motion
entity viacustomize.yaml
to tie the motion sensor to the Schedy room it belongs to.Now, a new rule which overlais the value with
"on"
while a motion sensor of the current room reports motion is added. We place it at the top of theschedule_prepend
configuration section to have it applied to all rooms as their first rule.- x: "Mark('on', Mark.OVERLAY) if not is_empty(filter_entities('binary_sensor', motion_room=room_name, state='on')) else Next()"
Add the motion sensor to the
watched_entities
of theentrance
room.
watched_entities:
- "binary_sensor.entrance_motion"
Try it out. As long as at least one of the motion sensors in a room reports motion, the lights in that room should stay on.
If you also had brightness sensors in each room, you could now insert
another rule before the one we just added to fix the value to "off"
when it’s not dark enough in the particular room.