Node-Red Flow Samples/Sharing

Title: Setting the mode when the maid arrives and leaves

Summary:
My maid doesn't like to work when I'm at home. But I want the house to be comfortable etc. when she comes here. So I set the mode to Home mode when she uses her key code (also get notified by SMS that she has arrived). I also set a global variable called "maid switch" to be on when she arrives. Similarly, when she leaves, I set the mode to be Away (if I am also away), and set "maid switch" to be off. The maid switch global variable is used to prevent motion lighting sequences from running while she's here.

Summary

[{"id":"3c08dd61.fb19fa","type":"comment","z":"bb5edffe.27e038","name":"Maid's lock code turns on Home mode (via MQTT) and Maid global variable (via MQTT). Also sends me an SMS.","info":"","x":430,"y":620,"wires":[]},{"id":"99473dd5.c0c138","type":"hubitat device","z":"bb5edffe.27e038","name":"Front Door Lock","server":"a22e0ea9.276dc8","deviceId":"1219","attribute":"lastCodeName","sendEvent":true,"x":140,"y":737,"wires":[["d792b281.1c7338"]]},{"id":"d792b281.1c7338","type":"switch","z":"bb5edffe.27e038","name":"Maid's code","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"Pattie Poehl","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":737,"wires":[["f06444a.681b6b8","363507d.56160f8","dde624a.c8cd958"]]},{"id":"a620554b.47e9f8","type":"switch","z":"bb5edffe.27e038","name":"off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":1140,"wires":[["cb00eedc.83c16"]]},{"id":"cb00eedc.83c16","type":"hubitat device","z":"bb5edffe.27e038","name":"Ashok's Combined Presence","server":"662851c4.3ccad","deviceId":"2475","attribute":"presence","sendEvent":false,"x":520,"y":1140,"wires":[["e5351536.64c718"]]},{"id":"e5351536.64c718","type":"switch","z":"bb5edffe.27e038","name":"not present","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"not present","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":1140,"wires":[["fbfb3ea5.4b1b1"]]},{"id":"7ee04fa.91fc2b","type":"switch","z":"bb5edffe.27e038","name":"button","property":"payload.descriptionText","propertyType":"msg","rules":[{"t":"cont","v":"button","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":940,"wires":[["ab84a1a0.3506f8","f6c63738.bfcb98"]]},{"id":"83125a3a.360738","type":"switch","z":"bb5edffe.27e038","name":"locked","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"locked","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":850,"y":940,"wires":[["7ee04fa.91fc2b"]]},{"id":"ab84a1a0.3506f8","type":"change","z":"bb5edffe.27e038","name":"topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"Pattie Poehl status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":1000,"wires":[["3f430222.6cf72e"]]},{"id":"3f430222.6cf72e","type":"simpletime","z":"bb5edffe.27e038","name":"","x":950,"y":1000,"wires":[["641deb38.d130f4"]]},{"id":"c72e4492.76603","type":"switch","z":"bb5edffe.27e038","name":"maid_status = on","property":"pp_status","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":940,"wires":[["83125a3a.360738"]]},{"id":"641deb38.d130f4","type":"template","z":"bb5edffe.27e038","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Pattie Poehl left at {{mytimes}} on {{mymonthn}}/{{mydom}}.","output":"str","x":1110,"y":1000,"wires":[["9701371.e9c0d48"]]},{"id":"9701371.e9c0d48","type":"link out","z":"bb5edffe.27e038","name":"SMS-out","links":["67fd4532.52d0e4"],"x":1215,"y":1000,"wires":[]},{"id":"6163fdea.92a344","type":"hubitat device","z":"bb5edffe.27e038","name":"Front Door Lock","server":"a22e0ea9.276dc8","deviceId":"1219","attribute":"","sendEvent":true,"x":140,"y":940,"wires":[["8e53d7d.2c9d6a8"]]},{"id":"8e53d7d.2c9d6a8","type":"time-range-switch","z":"bb5edffe.27e038","name":"11:00-15:00","lat":"29.977091","lon":"-90.143000","startTime":"11:00","endTime":"15:00","startOffset":0,"endOffset":0,"x":330,"y":940,"wires":[["932e2a41.490068"],[]]},{"id":"932e2a41.490068","type":"weekday","z":"bb5edffe.27e038","name":"M-F","sun":false,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":false,"x":490,"y":940,"wires":[["c72e4492.76603"],[]]},{"id":"9d464d55.a36148","type":"comment","z":"bb5edffe.27e038","name":"Front door locked using button on the outside on M-F (11am-3pm) if the Maid global variable was on, sets the variable to off (via MQTT) and sends me a text","info":"","x":570,"y":880,"wires":[]},{"id":"41a4c581.08a0f4","type":"comment","z":"bb5edffe.27e038","name":"Maid global variable being set to off when I am away will turn on Away mode","info":"","x":310,"y":1080,"wires":[]},{"id":"f06444a.681b6b8","type":"change","z":"bb5edffe.27e038","name":"topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"Pattie Poehl status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":737,"wires":[["9943c928.172678"]]},{"id":"9943c928.172678","type":"simpletime","z":"bb5edffe.27e038","name":"","x":650,"y":737,"wires":[["74c72516.e2fb2c"]]},{"id":"74c72516.e2fb2c","type":"template","z":"bb5edffe.27e038","name":"SMS","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Pattie Poehl arived at {{mytimes}} on {{mymonthn}}/{{mydom}}.","output":"str","x":810,"y":737,"wires":[["eaf3c2c4.54562"]]},{"id":"eaf3c2c4.54562","type":"link out","z":"bb5edffe.27e038","name":"SMS-out","links":["67fd4532.52d0e4"],"x":915,"y":737,"wires":[]},{"id":"b8bba3d5.32c01","type":"switch","z":"bb5edffe.27e038","name":"maid_status = off","property":"pp_status","propertyType":"global","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1090,"y":1140,"wires":[["301416e1.17ef2a"]]},{"id":"fbfb3ea5.4b1b1","type":"delay","z":"bb5edffe.27e038","name":"5m","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":910,"y":1140,"wires":[["b8bba3d5.32c01"]]},{"id":"363507d.56160f8","type":"change","z":"bb5edffe.27e038","name":"home","rules":[{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":685,"wires":[["5b10d719.8cc428"]]},{"id":"5b10d719.8cc428","type":"mqtt out","z":"bb5edffe.27e038","name":"mode","topic":"mode","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":630,"y":685,"wires":[]},{"id":"301416e1.17ef2a","type":"change","z":"bb5edffe.27e038","name":"away","rules":[{"t":"set","p":"payload","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":1140,"wires":[["539b816e.69def"]]},{"id":"539b816e.69def","type":"mqtt out","z":"bb5edffe.27e038","name":"mode","topic":"mode","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":1410,"y":1140,"wires":[]},{"id":"16193ab2.624a7d","type":"mqtt out","z":"bb5edffe.27e038","name":"maid","topic":"switch/maid","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":1270,"y":940,"wires":[]},{"id":"94f91fc7.32cef8","type":"mqtt out","z":"bb5edffe.27e038","name":"maid","topic":"switch/maid","qos":"2","retain":"false","broker":"40144fb8.a1c1e","x":630,"y":785,"wires":[]},{"id":"8f338150.94dbe8","type":"mqtt in","z":"bb5edffe.27e038","name":"maid","topic":"switch/maid","qos":"2","datatype":"auto","broker":"40144fb8.a1c1e","x":170,"y":1140,"wires":[["a620554b.47e9f8"]]},{"id":"f6c63738.bfcb98","type":"change","z":"bb5edffe.27e038","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":940,"wires":[["16193ab2.624a7d"]]},{"id":"dde624a.c8cd958","type":"change","z":"bb5edffe.27e038","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":785,"wires":[["94f91fc7.32cef8"]]},{"id":"a22e0ea9.276dc8","type":"hubitat config","z":"","name":"HubitatM","usetls":false,"host":"192.168.1.46","port":"80","appId":"1522","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false},{"id":"662851c4.3ccad","type":"hubitat config","z":"","name":"HubitatS","usetls":false,"host":"192.168.1.36","port":"80","appId":"4489","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook2","autoRefresh":true,"useWebsocket":false},{"id":"40144fb8.a1c1e","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

4 Likes