Motion

Examples of turning lights on and off based on motion sensor output.

Turn on

Turn a light on when motion is detected.

Turn on
[{"id":"74df53e6.3373b4","type":"server-state-changed","z":"6e138375.f8d5a4","name":"Motion Detected","server":"a77b5e9d.0c69","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.living_room_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":100,"y":80,"wires":[["10a5412.d78f23f"],[]]},{"id":"42332742.ccae","type":"comment","z":"6e138375.f8d5a4","name":"Turn light on when motion is detected","info":"","x":170,"y":40,"wires":[]},{"id":"10a5412.d78f23f","type":"api-call-service","z":"6e138375.f8d5a4","name":"Turn on light","server":"a77b5e9d.0c69","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.living_room_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":310,"y":80,"wires":[[]]},{"id":"a77b5e9d.0c69","type":"server","z":"","name":"Home Assistant","addon":true}]

Turn on and off

Turn a light on when motion is detected, leave on for 5 minutes, and then turn off light when motion stops.

Usage Ideas
  • Walkways & driveways
  • Bathrooms
  • Hallways
Turn on and off
[{"id":"1d5b2197.027f06","type":"server-state-changed","z":"6e138375.f8d5a4","name":"Motion Detected","server":"a77b5e9d.0c69","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.living_room_motion","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":200,"y":260,"wires":[["423c8223.45293c"],[]]},{"id":"423c8223.45293c","type":"api-call-service","z":"6e138375.f8d5a4","name":"Turn on light","server":"a77b5e9d.0c69","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.living_room_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":410,"y":260,"wires":[["6e2f5fda.e10df"]]},{"id":"6e2f5fda.e10df","type":"stoptimer","z":"6e138375.f8d5a4","duration":"5","units":"Minute","payloadtype":"num","payloadval":"0","name":"Wait 5 Minutes","x":600,"y":260,"wires":[["1c11980a.7fc8a8"],[]]},{"id":"1c11980a.7fc8a8","type":"api-current-state","z":"6e138375.f8d5a4","name":"Motion Detected?","server":"a77b5e9d.0c69","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.living_room_motion","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":270,"y":380,"wires":[["5ec1dd28.3ab46c"],["d122d739.feeab"]]},{"id":"d122d739.feeab","type":"api-call-service","z":"6e138375.f8d5a4","name":"Turn off light","server":"a77b5e9d.0c69","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.living_room_lamp","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":590,"y":380,"wires":[[]]},{"id":"5ec1dd28.3ab46c","type":"stoptimer","z":"6e138375.f8d5a4","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"Wait 30 Seconds","x":610,"y":320,"wires":[["1c11980a.7fc8a8"],[]]},{"id":"a77b5e9d.0c69","type":"server","z":"","name":"Home Assistant","addon":true}]