Skip to content

Grouping multiple events

dxdc edited this page Jan 17, 2020 · 1 revision

I have lights that are triggered by a motion sensor to turn On for 30 minutes.

The problem is that sometimes (5% of the time or so), when the lights turn OFF, it activates the motion sensor again thus restarting the cycle.

In other words:

  1. Lights go off
  2. Motion sensor triggered
  3. Lights go back on

Using the join-wait node, I can now look for this specific sequence to happen within a 12 second window - and if so - turn the lights back off. (Note: join-wait can be chained for more complicated event sequences/groups as well).

image

[{"id":"258e8d9c.cf4cc2","type":"switch","z":"ee7b2f38.64383","name":"Motion detected","property":"payload.MotionDetected","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":680,"y":620,"wires":[["850e6a8a.c27418"]]},{"id":"84838c8a.c48d","type":"hb-event","z":"ee7b2f38.64383","name":"Front Door","Homebridge":"Front Door","Manufacturer":"Ring","Service":"Motion Sensor","device":"Front Door9B:FC:9C:85:98:6FRingFront Door00000085","conf":"27ab7bfb.cc01b4","x":500,"y":620,"wires":[["258e8d9c.cf4cc2"]]},{"id":"874e684c.ff2588","type":"delay","z":"ee7b2f38.64383","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1020,"y":520,"wires":[["9701a6eb.4d90c8"]]},{"id":"e235d9c4.0e43a8","type":"hb-control","z":"ee7b2f38.64383","name":"Front Walkway","Homebridge":"Homebridge","Manufacturer":"Belkin WeMo","Service":"Switch","device":"HomebridgeCC:22:3D:E3:CE:30Belkin WeMoFront Walkway00000049","conf":"27ab7bfb.cc01b4","x":1340,"y":520,"wires":[]},{"id":"a7503f84.b028d","type":"function","z":"ee7b2f38.64383","name":"On/Off","func":"msg.name += ((msg.payload.On) ? ' On' : ' Off');\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":520,"wires":[["850e6a8a.c27418"]]},{"id":"677df444.c8e33c","type":"hb-event","z":"ee7b2f38.64383","name":"Front Walkway","Homebridge":"Homebridge","Manufacturer":"Belkin WeMo","Service":"Switch","device":"HomebridgeCC:22:3D:E3:CE:30Belkin WeMoFront Walkway00000049","conf":"27ab7bfb.cc01b4","x":520,"y":520,"wires":[["a7503f84.b028d"]]},{"id":"850e6a8a.c27418","type":"join-wait","z":"ee7b2f38.64383","name":"","paths":"[\"Front Walkway Off\", \"Front Door\", \"Front Walkway On\"]","pathsToExpire":"","ignoreUnmatched":false,"pathTopic":"name","pathTopicType":"msg","correlationTopic":"","correlationTopicType":"msg","timeout":"12","timeoutUnits":"1000","exactOrder":"true","firstMsg":"true","mapPayload":"false","disableComplete":false,"x":860,"y":540,"wires":[["874e684c.ff2588"],[]]},{"id":"9701a6eb.4d90c8","type":"change","z":"ee7b2f38.64383","name":"Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\": false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1170,"y":520,"wires":[["e235d9c4.0e43a8"]]},{"id":"27ab7bfb.cc01b4","type":"hb-conf","z":"","username":"031-45-154"}]