Welcome to Rob’s Node-Red Template and Example Flow Thread!
Here you will find a growing collection of templates/example flows you can import into your own instance and expand upon.
I will be assuming basic familiarity with Node-Red, as such I will not be explaining the basic nodes (switch, change, etc) or the basics of messages, triggering, etc unless there is a request for me to do so. These nodes will be labeled in the examples with what they do. Loading the flow to your own instance of Node-Red will allow you to see more details on the commands used for any given node.
I will also be attempting to keep the flows as simple and easy to follow visually as possible. I will post more advanced/complex flows after the basics are out of the way
If you have any requests, including for me to put detailed node by node breakdowns for any of these examples, Please feel free to PM me or leave a comment here and I’ll see what I can do!
Let’s jump right in and get started with some Motion Sensor Controlled Lighting Flows
Click for the flow code
[{"id":"8a5aa323bb7f8435","type":"tab","label":"Flow 5","disabled":false,"info":"","env":[]},{"id":"8277c82b05724992","type":"change","z":"8a5aa323bb7f8435","name":"Set Motion 1 ","rules":[{"t":"set","p":"#:(file)::motion1","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":980,"wires":[["c44332393533817c"]]},{"id":"f3c36a53aaa9ae70","type":"change","z":"8a5aa323bb7f8435","name":"Set Motion 3","rules":[{"t":"set","p":"#:(file)::motion3","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1060,"wires":[["c44332393533817c"]]},{"id":"9dabd5ded6f2d12d","type":"change","z":"8a5aa323bb7f8435","name":"Set Motion 4","rules":[{"t":"set","p":"#:(file)::motion4","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1100,"wires":[["c44332393533817c"]]},{"id":"c44332393533817c","type":"switch","z":"8a5aa323bb7f8435","name":"active?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":560,"y":1020,"wires":[["8da5b7b46b715ef5","82a72785489584a6"],["d0ad718abfa5fc0f"]]},{"id":"0372d6914eba0f8a","type":"stoptimer2","z":"8a5aa323bb7f8435","duration":"30","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"60 sec","x":1310,"y":1080,"wires":[["b5625b3a508972d6"],[]]},{"id":"3ddc24311e4917b1","type":"change","z":"8a5aa323bb7f8435","name":"Set Motion 2","rules":[{"t":"set","p":"#:(file)::motion2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1020,"wires":[["c44332393533817c"]]},{"id":"d0ad718abfa5fc0f","type":"switch","z":"8a5aa323bb7f8435","name":"Motion 1","property":"#:(file)::motion1","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":660,"y":1100,"wires":[["f1a59ba86f098f59"]]},{"id":"9ada2ae30437e64d","type":"switch","z":"8a5aa323bb7f8435","name":"Motion 4","property":"#:(file)::motion4","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":1100,"y":1100,"wires":[["0372d6914eba0f8a"]]},{"id":"21c436cf06ba4cad","type":"comment","z":"8a5aa323bb7f8435","name":"Simple Multi Motion Sensor Aggregated Light Control With Activity Buffer","info":"","x":310,"y":940,"wires":[]},{"id":"f1a59ba86f098f59","type":"switch","z":"8a5aa323bb7f8435","name":"Motion 2","property":"motion2","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":820,"y":1100,"wires":[["7eddcc012c09fa9b"]]},{"id":"7eddcc012c09fa9b","type":"switch","z":"8a5aa323bb7f8435","name":"Motion 3","property":"motion3","propertyType":"flow","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":960,"y":1100,"wires":[["9ada2ae30437e64d"]]},{"id":"ece9cf60dc70b8c4","type":"comment","z":"8a5aa323bb7f8435","name":"Simple Single Motion Sensor Lighting Control","info":"","x":230,"y":540,"wires":[]},{"id":"2b9628a3870cf2db","type":"switch","z":"8a5aa323bb7f8435","name":"active?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":580,"wires":[["f30b33b0385661a5"],["bb984bf4c27e1b65"]]},{"id":"bb984bf4c27e1b65","type":"change","z":"8a5aa323bb7f8435","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":620,"wires":[["a23fd90931fcc2d8"]]},{"id":"f30b33b0385661a5","type":"change","z":"8a5aa323bb7f8435","name":"Lights On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":560,"wires":[["a23fd90931fcc2d8"]]},{"id":"a23fd90931fcc2d8","type":"Tasmota Light","z":"8a5aa323bb7f8435","broker":"fb8e22de96fd2cb7","device":"Lights/Bedroom/FR","name":"Front Right","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"true","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":770,"y":580,"wires":[[]]},{"id":"c3431fae6277599a","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 1 (iL07_1)","device_id":"0xd0cf5efffe53f6f0","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":170,"y":580,"wires":[["2b9628a3870cf2db"]]},{"id":"f713e9ebde1b53e8","type":"comment","z":"8a5aa323bb7f8435","name":"Single Motion Sensor Lighting Control With Activity Buffer","info":"","x":270,"y":720,"wires":[]},{"id":"7c256b6458efb44c","type":"switch","z":"8a5aa323bb7f8435","name":"active?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":380,"y":800,"wires":[["53cd93ab7e3fa222"],["2affe31d01efb3d4"]]},{"id":"b383137e0c486adb","type":"change","z":"8a5aa323bb7f8435","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":800,"wires":[["0845b77e5ffe2ff5"]]},{"id":"53cd93ab7e3fa222","type":"change","z":"8a5aa323bb7f8435","name":"Lights On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":760,"wires":[["0845b77e5ffe2ff5","d86a6311030a17f6"]]},{"id":"0845b77e5ffe2ff5","type":"Tasmota Light","z":"8a5aa323bb7f8435","broker":"fb8e22de96fd2cb7","device":"Lights/Bedroom/FR","name":"Front Right","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"true","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1310,"y":760,"wires":[[]]},{"id":"d3acce239b4acd3a","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 1 (iL07_1)","device_id":"0xd0cf5efffe53f6f0","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":170,"y":800,"wires":[["7c256b6458efb44c"]]},{"id":"2affe31d01efb3d4","type":"stoptimer2","z":"8a5aa323bb7f8435","duration":"30","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"60 sec","x":910,"y":840,"wires":[["b383137e0c486adb"],[]]},{"id":"d86a6311030a17f6","type":"change","z":"8a5aa323bb7f8435","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":800,"wires":[["2affe31d01efb3d4"]]},{"id":"7e529f0433039895","type":"comment","z":"8a5aa323bb7f8435","name":"Stop timer waits until 60 seconds have passed without new motion detected before turning off lights","info":"","x":1340,"y":840,"wires":[]},{"id":"162f653178221e1f","type":"comment","z":"8a5aa323bb7f8435","name":"msg.payload of STOP stops the timer when activity is detected","info":"","x":840,"y":700,"wires":[]},{"id":"b5625b3a508972d6","type":"change","z":"8a5aa323bb7f8435","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":1080,"wires":[["0c1ebee9c1c55b66"]]},{"id":"8da5b7b46b715ef5","type":"change","z":"8a5aa323bb7f8435","name":"Lights On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":1020,"wires":[["0c1ebee9c1c55b66"]]},{"id":"0c1ebee9c1c55b66","type":"Tasmota Light","z":"8a5aa323bb7f8435","broker":"fb8e22de96fd2cb7","device":"Lights/Bedroom/FR","name":"Front Right","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"true","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1610,"y":1040,"wires":[[]]},{"id":"82a72785489584a6","type":"change","z":"8a5aa323bb7f8435","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":1040,"wires":[["0372d6914eba0f8a"]]},{"id":"701da3510edb971f","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 1 (iL07_1)","device_id":"0xd0cf5efffe53f6f0","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":170,"y":980,"wires":[["8277c82b05724992"]]},{"id":"5759f6a79c2ac7c7","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 2 (iL07_1)","device_id":"0xd0cf5efffe85dd67","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":170,"y":1020,"wires":[["3ddc24311e4917b1"]]},{"id":"dc191a080699ab79","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 1 (iL07_1)","device_id":"0xd0cf5efffe53f6f0","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":170,"y":1060,"wires":[["f3c36a53aaa9ae70"]]},{"id":"181f23c644aa041d","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 2 (iL07_1)","device_id":"0xd0cf5efffe85dd67","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":170,"y":1100,"wires":[["9dabd5ded6f2d12d"]]},{"id":"7ba8fc3157050101","type":"comment","z":"8a5aa323bb7f8435","name":"Using change nodes we store the current state of each motion sensor on change to a context file","info":"","x":870,"y":980,"wires":[]},{"id":"d96d94d986e70f04","type":"comment","z":"8a5aa323bb7f8435","name":"Using a switch node we check the current status of each motion sensor when any sensor triggers inactive","info":"","x":860,"y":1140,"wires":[]},{"id":"86bd4024f57b8829","type":"comment","z":"8a5aa323bb7f8435","name":"Single Motion Sensor Lighting Control With Activity Buffer And Manual Over-Ride","info":"","x":400,"y":1240,"wires":[]},{"id":"20cfceb21a0bdea5","type":"switch","z":"8a5aa323bb7f8435","name":"active?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":1340,"wires":[["132ec2a14b185e0b"],["1907b3129a23df8d"]]},{"id":"8e1972d360245ac8","type":"change","z":"8a5aa323bb7f8435","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1120,"y":1360,"wires":[["d8147647363bb53a"]]},{"id":"132ec2a14b185e0b","type":"change","z":"8a5aa323bb7f8435","name":"Lights On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":1300,"wires":[["2ca60ad773a20f85","d8147647363bb53a"]]},{"id":"fa9a450392c7e4f8","type":"Tasmota Light","z":"8a5aa323bb7f8435","broker":"fb8e22de96fd2cb7","device":"Lights/Bedroom/FR","name":"Front Right","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"true","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1610,"y":1300,"wires":[[]]},{"id":"5de12c34a6960114","type":"zigbee2mqtt-in","z":"8a5aa323bb7f8435","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Kitchen Motion 1 (iL07_1)","device_id":"0xd0cf5efffe53f6f0","state":"occupancy","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":190,"y":1340,"wires":[["20cfceb21a0bdea5"]]},{"id":"1907b3129a23df8d","type":"stoptimer2","z":"8a5aa323bb7f8435","duration":"30","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"60 sec","x":930,"y":1380,"wires":[["8e1972d360245ac8"],[]]},{"id":"2ca60ad773a20f85","type":"change","z":"8a5aa323bb7f8435","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":1340,"wires":[["1907b3129a23df8d"]]},{"id":"d8147647363bb53a","type":"switch","z":"8a5aa323bb7f8435","name":"Over-Ride","property":"override","propertyType":"flow","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":1390,"y":1300,"wires":[["fa9a450392c7e4f8"],[]]},{"id":"0aa15657565cc38d","type":"comment","z":"8a5aa323bb7f8435","name":"If over-ride context is false allows the command through, if true blocks them","info":"","x":1360,"y":1240,"wires":[]},{"id":"a978a668fd217ad3","type":"comment","z":"8a5aa323bb7f8435","name":"Over-Ride context can be set by any trigger you want","info":"","x":1450,"y":1380,"wires":[]},{"id":"fb8e22de96fd2cb7","type":"tasmota-mqtt-broker","name":"Pi","broker":"10.10.2.1","port":"1883","clientid":"","usetls":false,"keepalive":"60","cleansession":true},{"id":"6c5abdd60ef1d8af","type":"zigbee2mqtt-server","name":"zigbeemqtt","host":"10.10.2.1","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","mqtt_qos":"0","tls":"","usetls":false,"base_topic":"zigbee2mqtt"}]Now let’s take a look at some simple contact sensors, these examples also double as templates for controlling Magic-Home Led strips
Click for the flow code
[{"id":"58e7bdb7185fc146","type":"tab","label":"Magic Home Templates","disabled":false,"info":"","env":[]},{"id":"bf4ea44d12cdb861","type":"switch","z":"58e7bdb7185fc146","name":"Cosed/Open","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":200,"wires":[["e19b69c293125301"],["184cd0614edc18e1"]]},{"id":"2cf9c63517497cc9","type":"comment","z":"58e7bdb7185fc146","name":"Contact Sensor - Door Open = False, Door Closed = True","info":"","x":1270,"y":40,"wires":[]},{"id":"a436fe0b6634ef4a","type":"MagicHome UFO","z":"58e7bdb7185fc146","name":"CLoset Led","ip":"192.168.24.152","style":"RGBW","x":1130,"y":220,"wires":[[]]},{"id":"184cd0614edc18e1","type":"change","z":"58e7bdb7185fc146","name":"Magichome On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": true }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":240,"wires":[["fc51073b8a2ccc8c"]]},{"id":"e19b69c293125301","type":"change","z":"58e7bdb7185fc146","name":"Magichome Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": false }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":180,"wires":[["fc51073b8a2ccc8c"]]},{"id":"55da9925ffdd0959","type":"change","z":"58e7bdb7185fc146","name":"Magichome Color","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"color\": 99000000 }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1110,"y":500,"wires":[["f745f83c51d9bcc1"]]},{"id":"35d3df5fdcb128ea","type":"zigbee2mqtt-in","z":"58e7bdb7185fc146","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Closet Contact (3320-L)","device_id":"0x000d6f00057cc7d8","state":"contact","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":180,"y":200,"wires":[["e290bd32923df4b5"]]},{"id":"e290bd32923df4b5","type":"switch","z":"58e7bdb7185fc146","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":200,"wires":[["bf4ea44d12cdb861"]]},{"id":"fc51073b8a2ccc8c","type":"function","z":"58e7bdb7185fc146","name":"cleanup","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":940,"y":220,"wires":[["a436fe0b6634ef4a"]]},{"id":"410969c84e375bba","type":"comment","z":"58e7bdb7185fc146","name":"To change brightness or color the lights must be turned on first","info":"","x":300,"y":320,"wires":[]},{"id":"4bdb011f482d3619","type":"change","z":"58e7bdb7185fc146","name":"Magichome Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": false }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":420,"wires":[["f745f83c51d9bcc1"]]},{"id":"a721037cd1a36740","type":"delay","z":"58e7bdb7185fc146","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":910,"y":500,"wires":[["55da9925ffdd0959"]]},{"id":"f57a7c3a176de8ca","type":"switch","z":"58e7bdb7185fc146","name":"Cosed/Open","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":460,"wires":[["4bdb011f482d3619"],["f2fd0a41ca512c8a"]]},{"id":"ad0555c9c4b76b52","type":"zigbee2mqtt-in","z":"58e7bdb7185fc146","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Closet Contact (3320-L)","device_id":"0x000d6f00057cc7d8","state":"contact","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":160,"y":460,"wires":[["ac148ec39ee7e770"]]},{"id":"ac148ec39ee7e770","type":"switch","z":"58e7bdb7185fc146","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":460,"wires":[["f57a7c3a176de8ca"]]},{"id":"a6153340961a8a1c","type":"comment","z":"58e7bdb7185fc146","name":"You can chain as many commands in a row as you want. Especially useful on nodes like MagicHome that don't allow some commands like color and brightness to be used together","info":"","x":710,"y":620,"wires":[]},{"id":"799940c55d43a7e3","type":"change","z":"58e7bdb7185fc146","name":"Magichome Brightness","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"brightness\": 10 }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":780,"wires":[["95110bcaa2833f48"]]},{"id":"8aa60fe2591b3f70","type":"delay","z":"58e7bdb7185fc146","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":970,"y":780,"wires":[["799940c55d43a7e3"]]},{"id":"48c24b4ad2f61176","type":"MagicHome UFO","z":"58e7bdb7185fc146","name":"CLoset Led","ip":"192.168.24.152","style":"RGBW","x":1510,"y":440,"wires":[[]]},{"id":"f745f83c51d9bcc1","type":"function","z":"58e7bdb7185fc146","name":"cleanup","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1320,"y":440,"wires":[["48c24b4ad2f61176"]]},{"id":"f2fd0a41ca512c8a","type":"change","z":"58e7bdb7185fc146","name":"Magichome On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": true }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":480,"wires":[["f745f83c51d9bcc1","a721037cd1a36740"]]},{"id":"8fe096be450a6254","type":"MagicHome UFO","z":"58e7bdb7185fc146","name":"CLoset Led","ip":"192.168.24.152","style":"RGBW","x":1550,"y":720,"wires":[[]]},{"id":"95110bcaa2833f48","type":"function","z":"58e7bdb7185fc146","name":"cleanup","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1380,"y":720,"wires":[["8fe096be450a6254"]]},{"id":"453268bf83b79952","type":"switch","z":"58e7bdb7185fc146","name":"Cosed/Open","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":740,"wires":[["b156c8c0dd79551d"],["c622f16111b4f6af"]]},{"id":"f9238cfd78468ffb","type":"zigbee2mqtt-in","z":"58e7bdb7185fc146","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Closet Contact (3320-L)","device_id":"0x000d6f00057cc7d8","state":"contact","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":140,"y":740,"wires":[["662f4b28903db79e"]]},{"id":"662f4b28903db79e","type":"switch","z":"58e7bdb7185fc146","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":740,"wires":[["453268bf83b79952"]]},{"id":"ab9cc7dde2dada40","type":"comment","z":"58e7bdb7185fc146","name":"Use delay nodes and tree branches to execute multiple commands in sequence","info":"","x":860,"y":320,"wires":[]},{"id":"3b56b44c0dd5dfbe","type":"comment","z":"58e7bdb7185fc146","name":"Magic Home Command Templates and examples","info":"","x":840,"y":40,"wires":[]},{"id":"2f0abb0d63c6aa1b","type":"MagicHome UFO","z":"58e7bdb7185fc146","name":"CLoset Led","ip":"192.168.24.152","style":"RGBW","x":1590,"y":1080,"wires":[[]]},{"id":"d40a2fea3f04c4e3","type":"function","z":"58e7bdb7185fc146","name":"cleanup","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1420,"y":1080,"wires":[["2f0abb0d63c6aa1b"]]},{"id":"32a0dd68c57c742d","type":"change","z":"58e7bdb7185fc146","name":"Magichome Blink","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"blink\": true }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":1230,"y":1080,"wires":[["d40a2fea3f04c4e3","dc06778d740eb014"]]},{"id":"fcb91f365c122b93","type":"switch","z":"58e7bdb7185fc146","name":"Cosed/Open","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":1000,"wires":[["f859d9a99104bd5d"],["007e0961c2ad09c7"]]},{"id":"2670e92b9c75b0bd","type":"MagicHome UFO","z":"58e7bdb7185fc146","name":"CLoset Led","ip":"192.168.24.152","style":"RGBW","x":1470,"y":1000,"wires":[[]]},{"id":"007e0961c2ad09c7","type":"change","z":"58e7bdb7185fc146","name":"Magichome On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": true }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":1040,"wires":[["c51b47a7c58df619","e55c8beda0e4908b"]]},{"id":"f859d9a99104bd5d","type":"change","z":"58e7bdb7185fc146","name":"Magichome Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": false }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":940,"wires":[["c51b47a7c58df619","ec82c59aa2456526"]]},{"id":"2d1cb83b2114ef4c","type":"zigbee2mqtt-in","z":"58e7bdb7185fc146","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Closet Contact (3320-L)","device_id":"0x000d6f00057cc7d8","state":"contact","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":180,"y":1000,"wires":[["b58d9faa60a05174"]]},{"id":"b58d9faa60a05174","type":"switch","z":"58e7bdb7185fc146","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":1000,"wires":[["fcb91f365c122b93"]]},{"id":"c51b47a7c58df619","type":"function","z":"58e7bdb7185fc146","name":"cleanup","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":1000,"wires":[["2670e92b9c75b0bd"]]},{"id":"e55c8beda0e4908b","type":"stoptimer2","z":"58e7bdb7185fc146","duration":"3","durationType":"num","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":980,"y":1080,"wires":[["32a0dd68c57c742d"],[]]},{"id":"c622f16111b4f6af","type":"change","z":"58e7bdb7185fc146","name":"Magichome On + Color","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": true, \"color\": 994000 }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":760,"wires":[["95110bcaa2833f48","8aa60fe2591b3f70"]]},{"id":"b156c8c0dd79551d","type":"change","z":"58e7bdb7185fc146","name":"Magichome Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"on\": false }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":720,"wires":[["95110bcaa2833f48"]]},{"id":"c8e20c08b65eae10","type":"comment","z":"58e7bdb7185fc146","name":"Simple light on when door open, light off when it closes","info":"","x":480,"y":120,"wires":[]},{"id":"ec82c59aa2456526","type":"change","z":"58e7bdb7185fc146","name":"STOP","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":1000,"wires":[["e55c8beda0e4908b","dc06778d740eb014"]]},{"id":"2292af15dd47cbd2","type":"comment","z":"58e7bdb7185fc146","name":"Blink Command Flashes lights twice. ","info":"","x":240,"y":880,"wires":[]},{"id":"14d581abb1ce9a44","type":"comment","z":"58e7bdb7185fc146","name":"Timer starts when door opens, if the door hasn't closed after 3 minutes start blinking the lights every 15 seconds until the door is close","info":"","x":1160,"y":880,"wires":[]},{"id":"dc06778d740eb014","type":"stoptimer2","z":"58e7bdb7185fc146","duration":"15","durationType":"num","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1230,"y":1160,"wires":[["32a0dd68c57c742d"],[]]},{"id":"a80961acde424c95","type":"comment","z":"58e7bdb7185fc146","name":"Looping timer with blink command causes the blink command to execute every 15 seconds until door closes","info":"","x":1240,"y":1200,"wires":[]},{"id":"c9cc8bdff9361ac0","type":"comment","z":"58e7bdb7185fc146","name":"Sending STOP as msg.payload when the door closes stops the timers and stops lights flashing","info":"","x":1220,"y":920,"wires":[]},{"id":"998d7c15b13ca5c3","type":"switch","z":"58e7bdb7185fc146","name":"Cosed/Open","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":1360,"wires":[["5108c453a69e98f6"],["5108c453a69e98f6"]]},{"id":"f605827fa4704826","type":"zigbee2mqtt-in","z":"58e7bdb7185fc146","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Closet Contact (3320-L)","device_id":"0x000d6f00057cc7d8","state":"contact","outputAtStartup":false,"filterChanges":true,"enableMultiple":false,"x":160,"y":1360,"wires":[["4dbc2be5dea4bd2c"]]},{"id":"4dbc2be5dea4bd2c","type":"switch","z":"58e7bdb7185fc146","name":"","property":"payload","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":1360,"wires":[["998d7c15b13ca5c3"]]},{"id":"83dbc6c31992e930","type":"function","z":"58e7bdb7185fc146","name":"cleanup","func":"var newMsg = { payload: msg.payload };\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":1360,"wires":[["69bc227d2f46cba0"]]},{"id":"69bc227d2f46cba0","type":"MagicHome UFO","z":"58e7bdb7185fc146","name":"CLoset Led","ip":"192.168.24.152","style":"RGBW","x":1050,"y":1360,"wires":[[]]},{"id":"5108c453a69e98f6","type":"change","z":"58e7bdb7185fc146","name":"Magichome Toggle","rules":[{"t":"set","p":"payload","pt":"msg","to":"{ \"toggle\": true }","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":1360,"wires":[["83dbc6c31992e930"]]},{"id":"a9ef4e2796d0e14d","type":"comment","z":"58e7bdb7185fc146","name":"Cleanup nodes are used to remove all message data that isnt part of our command","info":"","x":1170,"y":120,"wires":[]},{"id":"0fb53110c0e2f798","type":"comment","z":"58e7bdb7185fc146","name":"This prevents the extra data from causing errors ","info":"","x":1160,"y":160,"wires":[]},{"id":"7ecfb2203085e621","type":"comment","z":"58e7bdb7185fc146","name":"Toggle Command toggles the state of the lights between on and off","info":"","x":400,"y":1280,"wires":[]},{"id":"6c5abdd60ef1d8af","type":"zigbee2mqtt-server","name":"zigbeemqtt","host":"10.10.2.1","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","mqtt_qos":"0","tls":"","usetls":false,"base_topic":"zigbee2mqtt"}]Here we have a flow/template for controlling lights (on, off, brightness up and down, and CT) with a Pico Remote.
This one includes a bonus customizeable Subflow for controling the stepping of the brightness.
Click for the flow code
[{"id":"8956dc3ee8fd243d","type":"subflow","name":"Brightness Control","info":"","category":"","in":[{"x":160,"y":300,"wires":[{"id":"51bbc4a533eb9ff4"}]}],"out":[{"x":1420,"y":300,"wires":[{"id":"8cbac896b3420b78","port":0},{"id":"a353695519864d83","port":0},{"id":"78b4dd59aa2ed05a","port":0},{"id":"03a3b553312220e1","port":0},{"id":"8614f51a51e143a2","port":0},{"id":"11333f292af40124","port":0},{"id":"55c3ddbaf6cd47de","port":0},{"id":"e0a129a5c7c13ce8","port":0},{"id":"87b5ae1277f0efac","port":0},{"id":"efa870d293a72444","port":0},{"id":"8b968c77b4d69309","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"d7459434ff4a2a3a","type":"switch","z":"8956dc3ee8fd243d","name":"increase","property":"payload.bright","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"10","vt":"str"},{"t":"eq","v":"20","vt":"str"},{"t":"eq","v":"30","vt":"str"},{"t":"eq","v":"40","vt":"str"},{"t":"eq","v":"50","vt":"str"},{"t":"eq","v":"60","vt":"str"},{"t":"eq","v":"70","vt":"str"},{"t":"eq","v":"80","vt":"str"},{"t":"eq","v":"90","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":680,"y":220,"wires":[["a353695519864d83"],["78b4dd59aa2ed05a"],["03a3b553312220e1"],["8614f51a51e143a2"],["11333f292af40124"],["55c3ddbaf6cd47de"],["e0a129a5c7c13ce8"],["87b5ae1277f0efac"],["efa870d293a72444"],["8b968c77b4d69309"]]},{"id":"09d96498cce79fbd","type":"switch","z":"8956dc3ee8fd243d","name":"decrease","property":"payload.bright","propertyType":"msg","rules":[{"t":"eq","v":"10","vt":"str"},{"t":"eq","v":"20","vt":"str"},{"t":"eq","v":"30","vt":"str"},{"t":"eq","v":"40","vt":"str"},{"t":"eq","v":"50","vt":"str"},{"t":"eq","v":"60","vt":"str"},{"t":"eq","v":"70","vt":"str"},{"t":"eq","v":"80","vt":"str"},{"t":"eq","v":"90","vt":"str"},{"t":"eq","v":"100","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":680,"y":420,"wires":[["8cbac896b3420b78"],["a353695519864d83"],["78b4dd59aa2ed05a"],["03a3b553312220e1"],["8614f51a51e143a2"],["11333f292af40124"],["55c3ddbaf6cd47de"],["e0a129a5c7c13ce8"],["87b5ae1277f0efac"],["efa870d293a72444"]]},{"id":"51bbc4a533eb9ff4","type":"switch","z":"8956dc3ee8fd243d","name":"","property":"payload.press","propertyType":"msg","rules":[{"t":"eq","v":"up","vt":"str"},{"t":"eq","v":"down","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":300,"wires":[["d7459434ff4a2a3a"],["09d96498cce79fbd"]]},{"id":"03a3b553312220e1","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 30%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"30","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":240,"wires":[[]]},{"id":"a353695519864d83","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 10%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":160,"wires":[[]]},{"id":"55c3ddbaf6cd47de","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 60%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"60","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":360,"wires":[[]]},{"id":"8b968c77b4d69309","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 100%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"100","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":520,"wires":[[]]},{"id":"78b4dd59aa2ed05a","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 20%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"20","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":200,"wires":[[]]},{"id":"8614f51a51e143a2","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 40%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"40","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":280,"wires":[[]]},{"id":"11333f292af40124","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 50%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"50","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":320,"wires":[[]]},{"id":"87b5ae1277f0efac","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 80%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"80","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":440,"wires":[[]]},{"id":"e0a129a5c7c13ce8","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 70%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"70","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":400,"wires":[[]]},{"id":"efa870d293a72444","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 90%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"90","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":480,"wires":[[]]},{"id":"8cbac896b3420b78","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"0","tot":"str"},{"t":"set","p":"payload.on","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":120,"wires":[[]]},{"id":"6ea7667bde439fa7","type":"tab","label":"Front Room","disabled":false,"info":""},{"id":"4f2402777abdf862","type":"group","z":"6ea7667bde439fa7","name":"Front Room Lights","style":{"stroke":"#ff0000","label":true,"label-position":"n","color":"#000000"},"nodes":["421cbdec3bee8e1c","6e750c2af8e9cff6","b87bf66c17215bb9","f15e1a9bdfabce60"],"x":1194,"y":99,"w":192,"h":202},{"id":"dd9098107d1f81e6","type":"delay","z":"6ea7667bde439fa7","name":"Relay","pauseType":"delay","timeout":"0","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1130,"y":200,"wires":[["f15e1a9bdfabce60","6e750c2af8e9cff6","421cbdec3bee8e1c","b87bf66c17215bb9"]]},{"id":"421cbdec3bee8e1c","type":"Tasmota Light","z":"6ea7667bde439fa7","g":"4f2402777abdf862","broker":"fb8e22de96fd2cb7","device":"Lights/FrontRoom/FL","name":"Front Left","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":false,"havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1300,"y":180,"wires":[[]]},{"id":"6e750c2af8e9cff6","type":"Tasmota Light","z":"6ea7667bde439fa7","g":"4f2402777abdf862","broker":"fb8e22de96fd2cb7","device":"Lights/FrontRoom/BR","name":"Back Right","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":false,"havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1290,"y":260,"wires":[[]]},{"id":"b87bf66c17215bb9","type":"Tasmota Light","z":"6ea7667bde439fa7","g":"4f2402777abdf862","broker":"fb8e22de96fd2cb7","device":"Lights/FrontRoom/BL","name":"Back Left","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":false,"havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1300,"y":220,"wires":[[]]},{"id":"f15e1a9bdfabce60","type":"Tasmota Light","z":"6ea7667bde439fa7","g":"4f2402777abdf862","broker":"fb8e22de96fd2cb7","device":"Lights/FrontRoom/FR","name":"Front Right","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"false","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1290,"y":140,"wires":[["17970d56035d2dcf"]]},{"id":"17970d56035d2dcf","type":"change","z":"6ea7667bde439fa7","name":"Set FR Status","rules":[{"t":"delete","p":"FRFRPower","pt":"global"},{"t":"set","p":"payload.col","pt":"msg","to":"(payload.colors[0])+(payload.colors[1])+(payload.colors[2])","tot":"jsonata"},{"t":"set","p":"FRFRPower","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1480,"y":140,"wires":[[]]},{"id":"7acb5ef86fe1bf79","type":"switch","z":"6ea7667bde439fa7","name":"Button Click","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"up","vt":"str"},{"t":"eq","v":"down","vt":"str"},{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":390,"y":180,"wires":[["498aa7d041242980"],["92d157618330f55f"],["50716adeadb6fccc"],["50716adeadb6fccc"],["e6d21bded99643f6"]]},{"id":"92d157618330f55f","type":"change","z":"6ea7667bde439fa7","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"[\"Power off\"]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"command","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":160,"wires":[["dd9098107d1f81e6"]]},{"id":"498aa7d041242980","type":"change","z":"6ea7667bde439fa7","name":"Lights On","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"[\"Power On\", \"Dimmer 10\"]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"command","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":120,"wires":[["dd9098107d1f81e6"]]},{"id":"dba21f8541a522f1","type":"lutron-status","z":"6ea7667bde439fa7","confignode":"736823588286fc43","name":"FR Pico","x":290,"y":100,"wires":[["7acb5ef86fe1bf79"]]},{"id":"0138d2849d3d9da2","type":"change","z":"6ea7667bde439fa7","name":"Bright 100%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.ct","pt":"msg","to":"6453","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":280,"wires":[["dd9098107d1f81e6"]]},{"id":"e6d21bded99643f6","type":"change","z":"6ea7667bde439fa7","name":"Get FR ","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"FRFRPower","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":240,"wires":[["db217c5095a04827"]]},{"id":"db217c5095a04827","type":"switch","z":"6ea7667bde439fa7","name":"","property":"payload.colors[0]","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"gte","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":240,"wires":[["a1582b13ffc2a71f"],["0138d2849d3d9da2"]]},{"id":"a1582b13ffc2a71f","type":"change","z":"6ea7667bde439fa7","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$round(payload.bright*2.55)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":240,"wires":[["4a6884b917178619"]]},{"id":"4a6884b917178619","type":"function","z":"6ea7667bde439fa7","name":"","func":"var x = msg.payload;\nvar y = `${x},${x},${x}`;\nmsg.payload = {'rgb': y};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1000,"y":240,"wires":[["dd9098107d1f81e6"]]},{"id":"8643b3dbff468bc2","type":"subflow:8956dc3ee8fd243d","z":"6ea7667bde439fa7","name":"","x":770,"y":200,"wires":[["dd9098107d1f81e6"]]},{"id":"50716adeadb6fccc","type":"change","z":"6ea7667bde439fa7","name":"Get FR Status","rules":[{"t":"move","p":"payload","pt":"msg","to":"press","tot":"flow"},{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"FRFRPower","tot":"global"},{"t":"set","p":"payload.press","pt":"msg","to":"press","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":200,"wires":[["8643b3dbff468bc2"]]},{"id":"fb8e22de96fd2cb7","type":"tasmota-mqtt-broker","name":"Pi","broker":"10.10.2.1","port":"1883","clientid":"","usetls":false,"keepalive":"60","cleansession":true},{"id":"736823588286fc43","type":"lutron-config","name":"main","ipaddress":"192.168.0.94","deviceMap":{"ALL":"0","Kitchen Pico":"2","Granny Pico":"3","FR Pico":"4","BedRoom":"5"},"timeout":"45000"}]Subflow
Click for the flow code
[{"id":"8956dc3ee8fd243d","type":"subflow","name":"Brightness Control","info":"","category":"","in":[{"x":160,"y":300,"wires":[{"id":"51bbc4a533eb9ff4"}]}],"out":[{"x":1420,"y":300,"wires":[{"id":"8cbac896b3420b78","port":0},{"id":"a353695519864d83","port":0},{"id":"78b4dd59aa2ed05a","port":0},{"id":"03a3b553312220e1","port":0},{"id":"8614f51a51e143a2","port":0},{"id":"11333f292af40124","port":0},{"id":"55c3ddbaf6cd47de","port":0},{"id":"e0a129a5c7c13ce8","port":0},{"id":"87b5ae1277f0efac","port":0},{"id":"efa870d293a72444","port":0},{"id":"8b968c77b4d69309","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"dda0a4b9ab361a79","type":"group","z":"8956dc3ee8fd243d","name":"Tasmota Light Brightness","style":{"stroke":"#92d04f","fill":"#addb7b","label":true,"color":"#000000","label-position":"n"},"nodes":["03a3b553312220e1","a353695519864d83","55c3ddbaf6cd47de","8b968c77b4d69309","78b4dd59aa2ed05a","8614f51a51e143a2","11333f292af40124","87b5ae1277f0efac","e0a129a5c7c13ce8","efa870d293a72444","8cbac896b3420b78"],"x":954,"y":79,"w":192,"h":482},{"id":"d7459434ff4a2a3a","type":"switch","z":"8956dc3ee8fd243d","name":"increase","property":"payload.bright","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"10","vt":"str"},{"t":"eq","v":"20","vt":"str"},{"t":"eq","v":"30","vt":"str"},{"t":"eq","v":"40","vt":"str"},{"t":"eq","v":"50","vt":"str"},{"t":"eq","v":"60","vt":"str"},{"t":"eq","v":"70","vt":"str"},{"t":"eq","v":"80","vt":"str"},{"t":"eq","v":"90","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":680,"y":220,"wires":[["a353695519864d83"],["78b4dd59aa2ed05a"],["03a3b553312220e1"],["8614f51a51e143a2"],["11333f292af40124"],["55c3ddbaf6cd47de"],["e0a129a5c7c13ce8"],["87b5ae1277f0efac"],["efa870d293a72444"],["8b968c77b4d69309"]]},{"id":"09d96498cce79fbd","type":"switch","z":"8956dc3ee8fd243d","name":"decrease","property":"payload.bright","propertyType":"msg","rules":[{"t":"eq","v":"10","vt":"str"},{"t":"eq","v":"20","vt":"str"},{"t":"eq","v":"30","vt":"str"},{"t":"eq","v":"40","vt":"str"},{"t":"eq","v":"50","vt":"str"},{"t":"eq","v":"60","vt":"str"},{"t":"eq","v":"70","vt":"str"},{"t":"eq","v":"80","vt":"str"},{"t":"eq","v":"90","vt":"str"},{"t":"eq","v":"100","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":680,"y":420,"wires":[["8cbac896b3420b78"],["a353695519864d83"],["78b4dd59aa2ed05a"],["03a3b553312220e1"],["8614f51a51e143a2"],["11333f292af40124"],["55c3ddbaf6cd47de"],["e0a129a5c7c13ce8"],["87b5ae1277f0efac"],["efa870d293a72444"]]},{"id":"51bbc4a533eb9ff4","type":"switch","z":"8956dc3ee8fd243d","name":"","property":"payload.press","propertyType":"msg","rules":[{"t":"eq","v":"up","vt":"str"},{"t":"eq","v":"down","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":300,"wires":[["d7459434ff4a2a3a"],["09d96498cce79fbd"]]},{"id":"03a3b553312220e1","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 30%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"30","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":240,"wires":[[]]},{"id":"a353695519864d83","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 10%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"10","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":160,"wires":[[]]},{"id":"55c3ddbaf6cd47de","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 60%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"60","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":360,"wires":[[]]},{"id":"8b968c77b4d69309","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 100%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"100","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":520,"wires":[[]]},{"id":"78b4dd59aa2ed05a","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 20%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"20","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":200,"wires":[[]]},{"id":"8614f51a51e143a2","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 40%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"40","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":280,"wires":[[]]},{"id":"11333f292af40124","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 50%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"50","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":320,"wires":[[]]},{"id":"87b5ae1277f0efac","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 80%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"80","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":440,"wires":[[]]},{"id":"e0a129a5c7c13ce8","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 70%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"70","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":400,"wires":[[]]},{"id":"efa870d293a72444","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Bright 90%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"90","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":480,"wires":[[]]},{"id":"8cbac896b3420b78","type":"change","z":"8956dc3ee8fd243d","g":"dda0a4b9ab361a79","name":"Lights Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.bright","pt":"msg","to":"0","tot":"str"},{"t":"set","p":"payload.on","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":120,"wires":[[]]}]I’ll clean these up more and add some details explaining the pico later.
Now a simple flow to control room lighting using a motion sensor as a toggle. Using a bathroom shower as an example, When you enter the shower you pass a motion sensor directed across the shower doors opening. this turns on the shower lights and bathroom fan. When you get out of the shower it cuts off the lights and the fan after a set time. (I actually use a custom built IR Led and detector array across the door of my shower for detection, but that requires an entirely different write up to discuss)
Click for the flow
[{"id":"fba09e41f46ea215","type":"tab","label":"Flow 7","disabled":false,"info":"","env":[]},{"id":"b4dbb28a53b36931","type":"switch","z":"fba09e41f46ea215","name":"Activated","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":120,"y":280,"wires":[["2e8f442bc54f07d4"]]},{"id":"cedb0e320f81e41c","type":"stoptimer2","z":"fba09e41f46ea215","duration":"5","durationType":"num","units":"Second","payloadtype":"str","payloadval":"0","name":"","x":840,"y":240,"wires":[["d0dd66e6040d553f"],[]]},{"id":"8d82e8f6030bd713","type":"Tasmota Light","z":"fba09e41f46ea215","broker":"fb8e22de96fd2cb7","device":"Lights/MasterBath/Fan","name":"Fan","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"true","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1730,"y":200,"wires":[[]]},{"id":"56a268b0b2078254","type":"change","z":"fba09e41f46ea215","name":"Lights On 30%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"[\"Dimmer 30\",\"Power On\",\"CT 154\"]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"command","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":260,"wires":[["8fad1daf8c22d5a7"]]},{"id":"2e8f442bc54f07d4","type":"change","z":"fba09e41f46ea215","name":"Occupied?","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"bathroom","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":280,"wires":[["cccec6e3141a07fe"]]},{"id":"cccec6e3141a07fe","type":"switch","z":"fba09e41f46ea215","name":"yes/no","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":" occupied","vt":"str"},{"t":"eq","v":" unoccupied","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":410,"y":280,"wires":[["7f02e972513f70fc"],["574dd5eb3e648b01"]]},{"id":"7f02e972513f70fc","type":"change","z":"fba09e41f46ea215","name":"Set unoccupied","rules":[{"t":"delete","p":"bathroom","pt":"flow"},{"t":"set","p":"payload","pt":"msg","to":" unoccupied","tot":"str"},{"t":"set","p":"bathroom","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":260,"wires":[["cedb0e320f81e41c"]]},{"id":"574dd5eb3e648b01","type":"change","z":"fba09e41f46ea215","name":"Set occupied","rules":[{"t":"delete","p":"bathroom","pt":"flow"},{"t":"set","p":"payload","pt":"msg","to":" occupied","tot":"str"},{"t":"set","p":"bathroom","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":300,"wires":[["810428eb67f8f862"]]},{"id":"d0dd66e6040d553f","type":"change","z":"fba09e41f46ea215","name":"Off","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"delete","p":"topic","pt":"msg"},{"t":"set","p":"payload.on","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1190,"y":220,"wires":[["7081abb418b0f23f","83a26d8f697aeda4"]]},{"id":"83a26d8f697aeda4","type":"Tasmota Light","z":"fba09e41f46ea215","broker":"fb8e22de96fd2cb7","device":"Lights/MasterBath/Shower","name":"Shower","outputs":1,"uidisabler":false,"fullTopic":"","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":"true","havedimmer":true,"havetemp":true,"havecolors":true,"tempformat":"K","colorsformat":"RGB","x":1740,"y":240,"wires":[[]]},{"id":"810428eb67f8f862","type":"time-range-switch","z":"fba09e41f46ea215","name":"Sleep?","lat":"38.443237","lon":"-75.478854","startTime":"00:00","endTime":"08:00","startOffset":0,"endOffset":0,"x":820,"y":280,"wires":[["56a268b0b2078254"],["c19450161171d416"]]},{"id":"c19450161171d416","type":"change","z":"fba09e41f46ea215","name":"Lights On 100%","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"[\"Dimmer 100\",\"Power On\",\"CT 154\"]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"command","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":300,"wires":[["8fad1daf8c22d5a7"]]},{"id":"d9c4058b23f8ce6b","type":"zigbee2mqtt-in","z":"fba09e41f46ea215","name":"","server":"6c5abdd60ef1d8af","friendly_name":"Bathroom Motion","device_id":"0x000d6f001099ed24","state":"occupancy","outputAtStartup":false,"x":100,"y":200,"wires":[["b4dbb28a53b36931"]]},{"id":"8fad1daf8c22d5a7","type":"function","z":"fba09e41f46ea215","name":"> msg.payload","func":"var newMsg = { payload: msg.payload, topic: msg.topic};\nreturn newMsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1420,"y":300,"wires":[["83a26d8f697aeda4","8d82e8f6030bd713"]]},{"id":"7081abb418b0f23f","type":"stoptimer2","z":"fba09e41f46ea215","duration":"10","durationType":"num","units":"Minute","payloadtype":"str","payloadval":"0","name":"","x":1440,"y":160,"wires":[["8d82e8f6030bd713"],[]]},{"id":"fb8e22de96fd2cb7","type":"tasmota-mqtt-broker","name":"Pi","broker":"10.10.2.1","port":"1883","clientid":"","usetls":false,"keepalive":"60","cleansession":true},{"id":"6c5abdd60ef1d8af","type":"zigbee2mqtt-server","name":"zigbeemqtt","host":"10.10.2.1","mqtt_port":"1883","mqtt_username":"","mqtt_password":"","mqtt_qos":"0","tls":"","usetls":false,"base_topic":"zigbee2mqtt"}]Mail delivery alerts, repeating audio until retrieved, and a single text/pushover notification on delivery