[HELP] Automation with node red for Garage lights using door sensor and motion sensor

Its a very simple task. Turn on lights in the garage when the garage door is opened from the inside of the house (not the garage shutter door). The door has a Aqara door sensor.
Keep the lights on if motion is detected, if no motion is detected turn off the lights after 10 mins, the lights should turn on after sunset. The motion sensor is again an Aqara Zigbee motion sensor.
Someone has a script to share kindly please share.

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/cookbook/motion-triggered-light.html

Thanks for posting the link, the following link does not have integration of door sensor and motion sensor to turn on and off lights based on conditions i mentioned above.

The link Mike posted is a general example to give you ideas. Have you tried creating a flow? I find its best for both myself and people helping if I at least try to create it and then ask for help with where Im going wrong.

Burt heres something to get you started from mine…

image

[{"id":"2f0621bb088896ee","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"0bd82d1e352238cc","type":"server-state-changed","z":"2f0621bb088896ee","name":"Garage motion on","server":"ab3e2c53.e3491","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.motion_garage","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"stop","valueType":"str"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":165,"y":165,"wires":[["eeb333b4e2f3d00c","23c347745b31b202"],[]]},{"id":"a85ac156b354ad38","type":"server-state-changed","z":"2f0621bb088896ee","name":"Garage door open?","server":"ab3e2c53.e3491","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.open_close_garage_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"habool","haltifstate":"true","halt_if_type":"bool","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":165,"y":225,"wires":[["eeb333b4e2f3d00c","23c347745b31b202"],[]]},{"id":"eeb333b4e2f3d00c","type":"api-call-service","z":"2f0621bb088896ee","name":"Turn on light","server":"ab3e2c53.e3491","version":5,"debugenabled":true,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.outlet_garage_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":455,"y":165,"wires":[[]]},{"id":"f244f4db83c322a7","type":"api-call-service","z":"2f0621bb088896ee","name":"Turn off light","server":"ab3e2c53.e3491","version":5,"debugenabled":true,"domain":"switch","service":"turn_off","areaId":[],"deviceId":[],"entityId":["switch.outlet_garage_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":880,"y":225,"wires":[[]]},{"id":"edd22afaf09790a0","type":"api-current-state","z":"2f0621bb088896ee","name":"Garage motion on?","server":"ab3e2c53.e3491","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.motion_garage","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":660,"y":225,"wires":[[],["f244f4db83c322a7"]]},{"id":"23c347745b31b202","type":"trigger","z":"2f0621bb088896ee","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":455,"y":225,"wires":[["edd22afaf09790a0"]]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHome","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
1 Like