ESP32 MQTT Light Control Methods

Control lights through Telegram, Webhooks, or your dashboard!

Contact

Alex Trostle - GitHub - Email - LinkedIn - Instagram - My Website

Buy Me A Coffee
Check out my NodeRED template for creating your own flows: https://gist.github.com/Alextros00/57903819eef31f4beaa4cd24c9d57865

What Needs Modified for you to run

  1. Telegram Bot needs configured
  2. Mosquito Broker needs configured

What it does

This flow can send messages to your ESP32's over MQTT controlled by multiple different methods.

NodeRED_Flow_LightsControl

[{"id":"3e5ef85c.b80ca8","type":"group","z":"47cca1f5.5a7a5","name":"LIGHT CONTROL","style":{"stroke":"#000000","fill":"#ffbfbf","label":true,"label-position":"n","color":"#000000"},"nodes":["60442d13.79e504","8d0a89a6.93dd68","dd68f35.40c861","9febea04.708f18","a1a3bd71.1c2a7"],"x":48,"y":1673,"w":1854,"h":1154},{"id":"60442d13.79e504","type":"function","z":"47cca1f5.5a7a5","g":"3e5ef85c.b80ca8","name":"","func":"if(msg.payload === false){\n    return [null, msg];\n}\nelse if(msg.payload === true){\n    return [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","x":860,"y":1900,"wires":[["2a3577d5.e71408"],["2daa5473.efa75c"]]},{"id":"8d0a89a6.93dd68","type":"group","z":"47cca1f5.5a7a5","g":"3e5ef85c.b80ca8","name":"Telegram Light Control","style":{"stroke":"#ff0000","fill":"#000000","label":true,"label-position":"n","color":"#ffffff"},"nodes":["c4f36853.b68158","8cd36f8a.c881f","6c5c6449.8c32dc","23f37d87.d418b2","6e1dd443.f7b6cc","93ad93bc.f28b9","469dbd77.146b24","38bc3bdb.e042f4","9acbe9ca.39d508","bfc3123b.a95f5","2a469c1f.72a3e4","abd5887c.f4c398","81c33c01.1f0dc","adfbb710.2c30f8","a52d1b12.85df38","5287ccb5.504204","8009aeef.c5fb6","fd697bb.a162688","98271c30.589e"],"x":1034,"y":1699,"w":842,"h":402},{"id":"c4f36853.b68158","type":"debug","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1350,"y":1740,"wires":[]},{"id":"8cd36f8a.c881f","type":"catch","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"","scope":null,"x":1180,"y":1740,"wires":[["c4f36853.b68158"]]},{"id":"6c5c6449.8c32dc","type":"comment","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"Inline Keyboard to contol lights","info":"","x":1630,"y":1740,"wires":[]},{"id":"23f37d87.d418b2","type":"telegram sender","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"show inline keyboard","bot":"","haserroroutput":false,"outputs":1,"x":1560,"y":1780,"wires":[["469dbd77.146b24"]]},{"id":"6e1dd443.f7b6cc","type":"function","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"initial inline keyboard message","func":"context.global.keyboard = { messageId : msg.payload.messageId };\n\nvar opts = {\n  reply_to_message_id: msg.payload.messageId,\n  reply_markup: JSON.stringify({\n    \"inline_keyboard\": [[\n                {\n                    \"text\": \"Bedside Lamp\",\n                    \"callback_data\": \"Bedside Lamp\"            \n                }, \n                {\n                    \"text\": \"Door Lamp\",\n                    \"callback_data\": \"Door Lamp\"            \n                },\n                {\n                    \"text\": \"All\",\n                    \"callback_data\": \"All Lights\"            \n                }]\n            ]\n  })\n};\n\nmsg.payload.content = 'Divide the light from the darkness!';\nmsg.payload.options = opts;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"initialize":"","finalize":"","x":1310,"y":1780,"wires":[["23f37d87.d418b2"]]},{"id":"93ad93bc.f28b9","type":"telegram command","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"/lights","command":"/lights","bot":"","strict":false,"hasresponse":false,"useregex":false,"removeregexcommand":false,"outputs":1,"x":1110,"y":1780,"wires":[["6e1dd443.f7b6cc"]]},{"id":"469dbd77.146b24","type":"function","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"save messageId","func":"// We store the messageId to be able to edit this reply in the callback query. \ncontext.global.keyboard.messageId = msg.payload.sentMessageId;\ncontext.global.callbackNumber = 1;\nreturn [ msg ];\n","outputs":"1","noerr":0,"initialize":"","finalize":"","x":1760,"y":1780,"wires":[[]]},{"id":"38bc3bdb.e042f4","type":"telegram event","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"callback_query","bot":"","event":"callback_query","autoanswer":true,"x":1140,"y":1880,"wires":[["2a469c1f.72a3e4","9acbe9ca.39d508"]],"info":"ALL CALL BACK QUERIES ARE READ BY\nALL CALL BACK QUERRY NODES. This means\nwhether you only need one callback_query\nfor all of NodeRED. You just have to sort them."},{"id":"9acbe9ca.39d508","type":"function","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"evaluate callback query","func":"//[]\n// This is a sample switch to demonstrate the handling of the user input.\nif(context.global.callbackNumber != 1){\n    return;\n}\nif(msg.payload.content === \"Turn on\")\n{\n    // Hide the keyboard and forget the messageId\n    msg.payload.type = 'deleteMessage';\n    msg.payload.content = context.global.keyboard.messageId\n    context.global.keyboard.messageId = null;\n    context.global.callbackNumber = null;\n    msg.topic = 'turn on';\n    // You could also send a editMessageReplyMarkup with an empty reply_markup here\n    return [ null, null, null, null, null, msg ];\n}\nelse if(msg.payload.content === \"Turn off\")\n{\n    // Hide the keyboard and forget the messageId\n    msg.payload.type = 'deleteMessage';\n    msg.payload.content = context.global.keyboard.messageId\n    context.global.keyboard.messageId = null;\n    context.global.callbackNumber = null;\n    msg.topic = 'turn off';\n    // You could also send a editMessageReplyMarkup with an empty reply_markup here\n    return [ null, msg, null, null, null, null ];\n}\nelse if(msg.payload.content === \"Bedside Lamp\")\n{\n    // we don't want to clear the message yet, we need another answer\n    msg.topic = 'bedside lamp';\n    return [ null, null, null, null, msg, null ];\n}\nelse if(msg.payload.content === \"Door Lamp\")\n{\n    // we don't want to clear the message yet, we need another answer\n    msg.topic = 'door lamp';\n    return [ null, null, null, msg, null, null ];\n}\nelse if(msg.payload.content === \"All Lights\")\n{\n    // we don't want to clear the message yet, we need another answer\n    msg.topic = 'all lights';\n    return [ null, null, null, msg, null, null ];\n}\nelse\n{\n    var show_alert = false; // you can set this to true to open a dialog with the answer in the client.\n    \n    // msg.payload.content contains the callback data from the keyboard.\n    // You may change this value here.\n    msg.payload.options = show_alert;\n    \n    return [ msg, null, null, null, null, null ];\n}","outputs":6,"noerr":0,"initialize":"","finalize":"","x":1370,"y":1920,"wires":[["bfc3123b.a95f5","abd5887c.f4c398"],["bfc3123b.a95f5","abd5887c.f4c398"],["bfc3123b.a95f5","abd5887c.f4c398"],["abd5887c.f4c398","bfc3123b.a95f5"],["abd5887c.f4c398","bfc3123b.a95f5"],["abd5887c.f4c398","bfc3123b.a95f5"]]},{"id":"bfc3123b.a95f5","type":"telegram sender","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"answer callback query","bot":"","haserroroutput":false,"outputs":1,"x":1700,"y":1840,"wires":[[]]},{"id":"2a469c1f.72a3e4","type":"function","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"edit inline keyboard message","func":"if(context.global.callbackNumber != 1){\n    return;\n}\n// This is the message id of the initial keyboard that is simply exchanged by a new one.\nvar messageId = context.global.keyboard.messageId;\n\n// This is a sample of how to send a second inline keyboard with modified buttons\nvar reply_markup = JSON.stringify({\n    \"inline_keyboard\": [[\n                {\n                    \"text\": \"On\",\n                    \"callback_data\": \"Turn on\"            \n                }, \n                {\n                    \"text\": \"Off\",\n                    \"callback_data\": \"Turn off\"            \n                }]\n            ]\n  });\n\n\nvar options = {\n    chat_id : msg.payload.chatId,\n    reply_markup : reply_markup,\n    message_id : messageId\n};\n\nmsg.payload.type = 'editMessageReplyMarkup';\nmsg.payload.content = reply_markup;\nmsg.payload.options = options;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"initialize":"","finalize":"","x":1380,"y":1840,"wires":[["bfc3123b.a95f5"]]},{"id":"abd5887c.f4c398","type":"function","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"Data -> information","func":"//[bed, door, on, off]\nif (msg.topic === 'bedside lamp'){\n    msg = {payload: 'bed'};\n    return msg;\n}\nelse if (msg.topic === 'door lamp'){\n    msg = {payload: 'door'};\n    return msg;\n}\nelse if (msg.topic === 'turn on'){\n    msg = {payload: 'on'};\n    return msg;\n}\nelse if (msg.topic === 'turn off'){\n    msg = {payload: 'off'};\n    return msg;\n}\nelse if (msg.topic === 'all lights'){\n    msg = {payload: 'all'};\n    return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1690,"y":1900,"wires":[["81c33c01.1f0dc"]]},{"id":"81c33c01.1f0dc","type":"join","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"Join both selections","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"20","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1690,"y":1940,"wires":[["adfbb710.2c30f8"]]},{"id":"adfbb710.2c30f8","type":"function","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"determine action","func":"if(msg.payload[0] === 'bed' && msg.payload[1] === 'off'){\n    msg.topic = 'esp/to/esp13';\n    msg.payload = '1';//a 1 turns off ESP32 #13 relay\n    return [msg, null];\n}\nelse if(msg.payload[0] === 'bed' && msg.payload[1] === 'on'){\n    msg.topic = 'esp/to/esp13';\n    msg.payload = '0';//a 0 turns on ESP32 #13 relay\n    return [msg, null];\n}\nelse if(msg.payload[0] === 'door' && msg.payload[1] === 'off'){\n    msg.topic = 'esp/to/esp10';\n    msg.payload = '1';\n    return [null, msg];\n}\nelse if(msg.payload[0] === 'door' && msg.payload[1] === 'on'){\n    msg.topic = 'esp/to/esp10';\n    msg.payload = '0';\n    return [null, msg];\n}\nelse if(msg.payload[0] === 'all' && msg.payload[1] === 'on'){\n    msg = {payload: '0', topic: 'esp/to/esp10'};\n    msg1 = {payload:'0', topic: 'esp/to/esp13'};\n    return [msg1, msg];\n}\nelse if(msg.payload[0] === 'all' && msg.payload[1] === 'off'){\n    msg = {payload: '1', topic: 'esp/to/esp10'};\n    msg1 = {payload:'1', topic: 'esp/to/esp13'};\n    return [msg1, msg];\n}\nreturn;","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1680,"y":1980,"wires":[["a52d1b12.85df38"],["5287ccb5.504204"]]},{"id":"a52d1b12.85df38","type":"link out","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"Telegram control Bedside Light","links":["559eddfa.d750d4","dacc78c3.5b43f8","644c58a0.7db118","ca93fb19.085bf8"],"x":1835,"y":1960,"wires":[]},{"id":"5287ccb5.504204","type":"link out","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"Telegram Control->Doorlight","links":["851d7181.9f15a","ae7b7c39.810f5","92adaa6b.d910c8","ab551848.5b6d88"],"x":1835,"y":2000,"wires":[]},{"id":"8009aeef.c5fb6","type":"comment","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"To MQTT to control lights","info":"","x":1690,"y":2020,"wires":[]},{"id":"fd697bb.a162688","type":"ui_switch","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"","label":"All Lights On","tooltip":"","group":"62c17ab5.5a7d74","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"esp/esp2/led","style":"","onvalue":"DLOn","onvalueType":"str","onicon":"wb_sunny","oncolor":"Yellow","offvalue":"DLOff","offvalueType":"str","officon":"fa-cloud","offcolor":"Grey","x":1730,"y":2060,"wires":[["98271c30.589e"]]},{"id":"98271c30.589e","type":"link out","z":"47cca1f5.5a7a5","g":"8d0a89a6.93dd68","name":"All lights control","links":["ceada7ee.6325f8","db35dccd.5be47","c5f5fc58.edc6","5731d8b3.8a5468","ca7ed4f3.d85f98","a070dc32.5e5d6","ffd1e029.5680b","84ee4a39.572c18","ce44f47f.785a68","b0c8b02d.cff72","bb348bcc.6ba4e8","7edc618.f2c9ba","89ff084b.9effd8","cafe9e60.39c66","f3daa7d1.0599d8","559eddfa.d750d4","851d7181.9f15a","ae7b7c39.810f5","dacc78c3.5b43f8","644c58a0.7db118","ca93fb19.085bf8","92adaa6b.d910c8","ab551848.5b6d88"],"x":1835,"y":2060,"wires":[]},{"id":"62c17ab5.5a7d74","type":"ui_group","z":"","name":"General","tab":"377d7947.f2eda6","order":1,"disp":true,"width":6,"collapse":false},{"id":"377d7947.f2eda6","type":"ui_tab","z":"","name":"Alex's Home Automation GUI","icon":"dashboard","disabled":false,"hidden":false},{"id":"dd68f35.40c861","type":"group","z":"47cca1f5.5a7a5","g":"3e5ef85c.b80ca8","name":"BEDSIDE LIGHT ESP32 - 13","style":{"label":true,"stroke":"#ff0000","fill":"#000000","label-position":"n","color":"#ffffff"},"nodes":["66925de7.6075a4","96d23dfb.96e2e","302c7b04.28c4f4","45eece97.bed36","711ad60a.3f97f8","cbc5e71.83fcb18","165552d8.d1739d","6b97a6e3.91b6b8","2f70eff.689151","de29f56e.b4a988","9010349a.0d3268","d6ea9b31.d01158","ca93fb19.085bf8","519d529c.76dc1c","1911c105.25385f","9e4121ad.fcebc","710d7ded.4ab014","feac3223.c1878","3e118164.2300fe","2a3577d5.e71408","2daa5473.efa75c","23a3fe49.561852","e1fae9e0.048ee8","144a11ad.12843e","89a988f8.a86b18"],"x":74,"y":1699,"w":932,"h":562},{"id":"66925de7.6075a4","type":"function","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"set true","func":"msg.payload = \"true\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":1840,"wires":[["1911c105.25385f"]]},{"id":"96d23dfb.96e2e","type":"comment","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"Delays auto lights on","info":"","x":190,"y":1860,"wires":[]},{"id":"302c7b04.28c4f4","type":"telegram command","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"","command":"/sleepin","bot":"","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":170,"y":1900,"wires":[["66925de7.6075a4"],["9e4121ad.fcebc"]]},{"id":"45eece97.bed36","type":"mqtt out","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"To MQTT mosquitto_pub port 1883","topic":"esp/to/esp13","qos":"","retain":"","broker":"fdcabd9b.3ddc7","x":840,"y":2100,"wires":[]},{"id":"711ad60a.3f97f8","type":"inject","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"Lamp On","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"esp/to/esp13","payload":"0","payloadType":"str","x":500,"y":2180,"wires":[["519d529c.76dc1c"]]},{"id":"cbc5e71.83fcb18","type":"inject","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"Lamp Off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"esp/to/esp13","payload":"1","payloadType":"str","x":500,"y":2220,"wires":[["519d529c.76dc1c"]]},{"id":"165552d8.d1739d","type":"comment","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"Bedside Lamp Control","info":"","x":840,"y":1740,"wires":[]},{"id":"6b97a6e3.91b6b8","type":"ui_switch","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"","label":"Bedside Lamp","tooltip":"","group":"1662468c.e6b969","order":1,"width":12,"height":1,"passthru":true,"decouple":"false","topic":"esp/to/esp13","style":"","onvalue":"0","onvalueType":"str","onicon":"wb_sunny","oncolor":"Yellow","offvalue":"1","offvalueType":"str","officon":"fa-cloud","offcolor":"Grey","x":540,"y":2060,"wires":[["519d529c.76dc1c"]]},{"id":"2f70eff.689151","type":"telegram command","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"","command":"/bedsidelampon","bot":"","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":360,"y":2100,"wires":[["de29f56e.b4a988"],[]]},{"id":"de29f56e.b4a988","type":"function","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"esp/to/esp13 : 0","func":"\nmsg.payload = 0;\nmsg.topic = 'esp/to/esp13';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":540,"y":2100,"wires":[["519d529c.76dc1c"]]},{"id":"9010349a.0d3268","type":"telegram command","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"","command":"/bedsidelampoff","bot":"","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":360,"y":2140,"wires":[["d6ea9b31.d01158"],[]]},{"id":"d6ea9b31.d01158","type":"function","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"esp/to/esp13 : 1","func":"\nmsg.payload = 1;\nmsg.topic = 'esp/to/esp13';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":540,"y":2140,"wires":[["519d529c.76dc1c"]]},{"id":"ca93fb19.085bf8","type":"link in","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"Bedside Lamp ESP32 - 2","links":["ef655bae.b749d8","12daf026.07ec1","fe4d79c3.d17008","99d26492.800d88","9634a3be.b4b4c","da032430.ab2248","dd554301.558a","4f6783d5.2f7c4c","ea6bf091.b84d7","a52d1b12.85df38","98271c30.589e","a2782a89.be2db8","b3eed3e3.91c16","c551d2ce.92216","1e44d422.6f755c","d53e931.008637","4b692770.4b50f8"],"x":415,"y":2060,"wires":[["6b97a6e3.91b6b8"]]},{"id":"519d529c.76dc1c","type":"rbe","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":910,"y":2020,"wires":[["45eece97.bed36"]]},{"id":"1911c105.25385f","type":"BooleanLogicUltimate","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"AND","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result1","x":660,"y":1820,"wires":[["23a3fe49.561852"],[],[]]},{"id":"9e4121ad.fcebc","type":"function","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"set false","func":"\nmsg.payload = \"false\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":1960,"wires":[["710d7ded.4ab014"]]},{"id":"710d7ded.4ab014","type":"BooleanLogicUltimate","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"AND","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result2","x":660,"y":1980,"wires":[["23a3fe49.561852"],[],[]]},{"id":"feac3223.c1878","type":"light-scheduler","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","settings":"63f6b01e.0ff0e","events":"[{\"start\":{\"dow\":2,\"mod\":480},\"end\":{\"dow\":2,\"mod\":1350}},{\"start\":{\"dow\":3,\"mod\":480},\"end\":{\"dow\":3,\"mod\":1350}},{\"start\":{\"dow\":4,\"mod\":480},\"end\":{\"dow\":4,\"mod\":1350}},{\"start\":{\"dow\":5,\"mod\":480},\"end\":{\"dow\":5,\"mod\":1350}},{\"start\":{\"dow\":1,\"mod\":480},\"end\":{\"dow\":1,\"mod\":1350}},{\"start\":{\"dow\":6,\"mod\":480},\"end\":{\"dow\":6,\"mod\":1350}},{\"start\":{\"dow\":0,\"mod\":480},\"end\":{\"dow\":0,\"mod\":1350}}]","topic":"esp/to/esp13","name":"On from 8am to 10:30pm","onPayload":"true","onPayloadType":"str","offPayload":"false","offPayloadType":"str","onlyWhenDark":false,"scheduleRndMax":0,"sunElevationThreshold":"0","sunShowElevationInStatus":false,"outputfreq":"output.statechange","x":410,"y":2000,"wires":[["710d7ded.4ab014"]]},{"id":"3e118164.2300fe","type":"light-scheduler","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","settings":"63f6b01e.0ff0e","events":"[{\"start\":{\"dow\":2,\"mod\":495},\"end\":{\"dow\":2,\"mod\":1380}},{\"start\":{\"dow\":3,\"mod\":495},\"end\":{\"dow\":3,\"mod\":1380}},{\"start\":{\"dow\":4,\"mod\":495},\"end\":{\"dow\":4,\"mod\":1380}},{\"start\":{\"dow\":5,\"mod\":495},\"end\":{\"dow\":5,\"mod\":1380}},{\"start\":{\"dow\":1,\"mod\":495},\"end\":{\"dow\":1,\"mod\":1380}},{\"start\":{\"dow\":6,\"mod\":495},\"end\":{\"dow\":6,\"mod\":1380}},{\"start\":{\"dow\":0,\"mod\":495},\"end\":{\"dow\":0,\"mod\":1380}}]","topic":"esp/to/esp13","name":"On from 8:30am to 11pm","onPayload":"true","onPayloadType":"str","offPayload":"false","offPayloadType":"str","onlyWhenDark":false,"scheduleRndMax":0,"sunElevationThreshold":"0","sunShowElevationInStatus":false,"outputfreq":"output.statechange","x":410,"y":1800,"wires":[["1911c105.25385f"]]},{"id":"2a3577d5.e71408","type":"change","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"true - on","rules":[{"t":"delete","p":"originalMessage","pt":"msg"},{"t":"delete","p":"operation","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"esp/to/esp13","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":1860,"wires":[["519d529c.76dc1c"]]},{"id":"2daa5473.efa75c","type":"change","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"false - off","rules":[{"t":"delete","p":"originalMessage","pt":"msg"},{"t":"delete","p":"operation","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"esp/to/esp13","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":1940,"wires":[["519d529c.76dc1c"]]},{"id":"23a3fe49.561852","type":"BooleanLogicUltimate","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"OR","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","x":680,"y":1900,"wires":[[],["60442d13.79e504"],[]]},{"id":"e1fae9e0.048ee8","type":"inject","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"At 9am","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":330,"y":1900,"wires":[["144a11ad.12843e","89a988f8.a86b18"]]},{"id":"144a11ad.12843e","type":"function","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"set false","func":"\nmsg.payload = \"false\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":1880,"wires":[["1911c105.25385f"]]},{"id":"89a988f8.a86b18","type":"function","z":"47cca1f5.5a7a5","g":"dd68f35.40c861","name":"set true","func":"msg.payload = \"true\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":1920,"wires":[["710d7ded.4ab014"]]},{"id":"fdcabd9b.3ddc7","type":"mqtt-broker","z":"","name":"mosquitto_pub","broker":"192.168.1.142","port":"1883","tls":"","clientid":"mosquitto_pub","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"true","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"1662468c.e6b969","type":"ui_group","z":"","name":"ESP32 - 2","tab":"377d7947.f2eda6","order":4,"disp":true,"width":12,"collapse":true},{"id":"63f6b01e.0ff0e","type":"light-scheduler-settings","z":"","name":"Syracuse Apartment Settings","latitude":"43.0707088","longitude":"-76.1522857"},{"id":"9febea04.708f18","type":"group","z":"47cca1f5.5a7a5","g":"3e5ef85c.b80ca8","name":"Webhooks Phone Light Control","style":{"stroke":"#ff0000","fill":"#000000","label":true,"label-position":"n","color":"#ffffff"},"nodes":["fc6a1dd4.547e3","88a4c7d6.c15f28","29d35cbb.11a694","ba69ea36.81d9e8","f825c0d7.46599","b3eed3e3.91c16","7159b475.b3ab5c","92b31ea0.757dc","6ad3a313.081c7c","235db3b7.57869c","2387d2d4.f0459e","11cdce23.1d9072","1f4fc05a.ec3b5","1e44d422.6f755c","456e2889.850ab8","5c937e10.16cac"],"x":1043,"y":2119,"w":543,"h":342},{"id":"fc6a1dd4.547e3","type":"http response","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"","statusCode":"","headers":{},"x":1510,"y":2200,"wires":[]},{"id":"88a4c7d6.c15f28","type":"http in","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"","url":"/lightson","method":"get","upload":false,"swaggerDoc":"","x":1141,"y":2200,"wires":[["29d35cbb.11a694"]]},{"id":"29d35cbb.11a694","type":"template","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"Simple Web Page","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<!DOCTYPE HTML>\n<html>\n    <head>\n    <title>Simple Live Display</title>\n    <script type=\"text/javascript\">\n        var ws;\n        var wsUri = \"ws:\";\n        var loc = window.location;\n        console.log(loc);\n        if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n        // This needs to point to the web socket in the Node-RED flow\n        // ... in this case it's ws/simple\n        wsUri += \"//\" + loc.host + loc.pathname.replace(\"lightson\",\"ws/lightson\");\n\n        function wsConnect() {\n            console.log(\"connect\",wsUri);\n            ws = new WebSocket(wsUri);\n            //var line = \"\";    // either uncomment this for a building list of messages\n            ws.onopen = function() {\n                // update the status div with the connection status\n                document.getElementById('status').innerHTML = \"connected\";\n                ws.send(\"0\");\n                console.log(\"connected\");\n                window.close();\n            }\n            ws.onclose = function() {\n                // update the status div with the connection status\n                document.getElementById('status').innerHTML = \"not connected\";\n                // in case of lost connection tries to reconnect every 3 secs\n                setTimeout(wsConnect,3000);\n            }\n        }\n    </script>\n    </head>\n    <body onload=\"wsConnect();\" onunload=\"ws.disconnect();\">\n        <font face=\"Arial\">\n        <h1>Alex's Lights Control</h1>\n        <div id=\"messages\"></div>\n        <hr/>\n        <div id=\"status\">unknown</div>\n        </font>\n    </body>\n</html>\n","x":1339,"y":2200,"wires":[["fc6a1dd4.547e3"]]},{"id":"ba69ea36.81d9e8","type":"websocket in","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"","server":"78e85eb8.6d6b8","client":"","x":1149,"y":2260,"wires":[["7159b475.b3ab5c"]]},{"id":"f825c0d7.46599","type":"link out","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"Telegram Control->Doorlight","links":["851d7181.9f15a","ae7b7c39.810f5","92adaa6b.d910c8","ab551848.5b6d88"],"x":1544,"y":2280,"wires":[]},{"id":"b3eed3e3.91c16","type":"link out","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"Telegram control Bedside Light","links":["dacc78c3.5b43f8","644c58a0.7db118","ca93fb19.085bf8"],"x":1544,"y":2240,"wires":[]},{"id":"7159b475.b3ab5c","type":"function","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"determine action","func":"//if(msg.payload[0] === 'all' && msg.payload[1] === 'on'){\n    msg = {payload: '0', topic: 'esp/to/esp10'};\n    msg1 = {payload:'0', topic: 'esp/to/esp13'};\n    return [msg1, msg];\n//}\n/*else if(msg.payload[0] === 'all' && msg.payload[1] === 'off'){\n    msg = {payload: '1', topic: 'esp/to/esp10'};\n    msg1 = {payload:'1', topic: 'esp/to/esp13'};\n    return [msg1, msg];\n}*/\n//return;","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1329,"y":2260,"wires":[["b3eed3e3.91c16"],["f825c0d7.46599"]]},{"id":"92b31ea0.757dc","type":"comment","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"TURN ALL LIGHTS ON","info":"","x":1309,"y":2160,"wires":[]},{"id":"6ad3a313.081c7c","type":"http response","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"","statusCode":"","headers":{},"x":1510,"y":2340,"wires":[]},{"id":"235db3b7.57869c","type":"http in","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"","url":"/lightsoff","method":"get","upload":false,"swaggerDoc":"","x":1141,"y":2340,"wires":[["2387d2d4.f0459e"]]},{"id":"2387d2d4.f0459e","type":"template","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"Simple Web Page","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<!DOCTYPE HTML>\n<html>\n    <head>\n    <title>Simple Live Display</title>\n    <script type=\"text/javascript\">\n        var ws;\n        var wsUri = \"ws:\";\n        var loc = window.location;\n        console.log(loc);\n        if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n        // This needs to point to the web socket in the Node-RED flow\n        // ... in this case it's ws/simple\n        wsUri += \"//\" + loc.host + loc.pathname.replace(\"lightsoff\",\"ws/lightsoff\");\n\n        function wsConnect() {\n            console.log(\"connect\",wsUri);\n            ws = new WebSocket(wsUri);\n            //var line = \"\";    // either uncomment this for a building list of messages\n            ws.onopen = function() {\n                // update the status div with the connection status\n                document.getElementById('status').innerHTML = \"connected\";\n                ws.send(\"0\");\n                console.log(\"connected\");\n                window.close();\n            }\n            ws.onclose = function() {\n                // update the status div with the connection status\n                document.getElementById('status').innerHTML = \"not connected\";\n                // in case of lost connection tries to reconnect every 3 secs\n                setTimeout(wsConnect,3000);\n            }\n        }\n    </script>\n    </head>\n    <body onload=\"wsConnect();\" onunload=\"ws.disconnect();\">\n        <font face=\"Arial\">\n        <h1>Simple Live Display</h1>\n        <div id=\"messages\"></div>\n        <hr/>\n        <div id=\"status\">unknown</div>\n        </font>\n    </body>\n</html>\n","x":1339,"y":2340,"wires":[["6ad3a313.081c7c"]]},{"id":"11cdce23.1d9072","type":"websocket in","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"","server":"d27ca68e.383ee8","client":"","x":1149,"y":2400,"wires":[["456e2889.850ab8"]]},{"id":"1f4fc05a.ec3b5","type":"link out","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"Telegram Control->Doorlight","links":["851d7181.9f15a","ae7b7c39.810f5","92adaa6b.d910c8","ab551848.5b6d88"],"x":1544,"y":2420,"wires":[]},{"id":"1e44d422.6f755c","type":"link out","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"Telegram control Bedside Light","links":["dacc78c3.5b43f8","644c58a0.7db118","ca93fb19.085bf8"],"x":1544,"y":2380,"wires":[]},{"id":"456e2889.850ab8","type":"function","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"determine action","func":"/*if(msg.payload[0] === 'all' && msg.payload[1] === 'on'){\n    msg = {payload: '0', topic: 'esp/to/esp10'};\n    msg1 = {payload:'0', topic: 'esp/to/esp13'};\n    return [msg1, msg];\n//}\nelse if(msg.payload[0] === 'all' && msg.payload[1] === 'off'){\n*/    msg = {payload: '1', topic: 'esp/to/esp10'};\n      msg1 = {payload:'1', topic: 'esp/to/esp13'};\n      return [msg1, msg];\n//}\n//return;","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1329,"y":2400,"wires":[["1e44d422.6f755c"],["1f4fc05a.ec3b5"]]},{"id":"5c937e10.16cac","type":"comment","z":"47cca1f5.5a7a5","g":"9febea04.708f18","name":"TURN ALL LIGHTS OFF","info":"","x":1319,"y":2300,"wires":[]},{"id":"78e85eb8.6d6b8","type":"websocket-listener","z":"","path":"ws/lightson","wholemsg":"false"},{"id":"d27ca68e.383ee8","type":"websocket-listener","z":"","path":"/ws/lightsoff","wholemsg":"false"},{"id":"a1a3bd71.1c2a7","type":"group","z":"47cca1f5.5a7a5","g":"3e5ef85c.b80ca8","name":"Door Light Control - ESP32 - 10","style":{"stroke":"#ff0000","fill":"#000000","label":true,"label-position":"n","color":"#ffffff"},"nodes":["2c9171a4.17075e","3d375f60.ce72e","ac67537b.d6837","de6a689e.95ed98","bd1de39e.64a4b","2f026e99.bca5a2","848f7c2d.9ce0d","98d91067.0fd55","65397ef3.78ffe","4a122b70.9a63f4","461e657.90e6a9c","b77349f2.49d498","f5db588d.9d81b8","a18953c6.a13e5","378594c8.77e57c","b8d3aa5e.0578f8","ab551848.5b6d88","6f6da0fa.66c86","7532f962.9f14a8","94b5591e.3f6608","2c31f39c.40140c","447195fa.a654cc","7258f434.bef3cc","a0ac02e8.7d213","ed873eae.83df","1d9b52a2.42f53d"],"x":74,"y":2279,"w":932,"h":522},{"id":"2c9171a4.17075e","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"set true","func":"msg.payload = \"true\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":2400,"wires":[["de6a689e.95ed98"]]},{"id":"3d375f60.ce72e","type":"comment","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"Delays auto lights on if /sleepin is recieved","info":"","x":580,"y":2320,"wires":[]},{"id":"ac67537b.d6837","type":"telegram command","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"","command":"/sleepin","bot":"","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":150,"y":2460,"wires":[["2c9171a4.17075e"],["bd1de39e.64a4b"]]},{"id":"de6a689e.95ed98","type":"BooleanLogicUltimate","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"AND","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result1","x":640,"y":2380,"wires":[["65397ef3.78ffe"],[],[]]},{"id":"bd1de39e.64a4b","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"set false","func":"\nmsg.payload = \"false\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":2520,"wires":[["2f026e99.bca5a2"]]},{"id":"2f026e99.bca5a2","type":"BooleanLogicUltimate","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"AND","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result2","x":640,"y":2540,"wires":[["65397ef3.78ffe"],[],[]]},{"id":"848f7c2d.9ce0d","type":"change","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"true - on","rules":[{"t":"delete","p":"originalMessage","pt":"msg"},{"t":"delete","p":"operation","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"esp/to/esp10","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":2420,"wires":[["7258f434.bef3cc"]]},{"id":"98d91067.0fd55","type":"change","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"false - off","rules":[{"t":"delete","p":"originalMessage","pt":"msg"},{"t":"delete","p":"operation","pt":"msg"},{"t":"set","p":"topic","pt":"msg","to":"esp/to/esp10","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":2500,"wires":[["7258f434.bef3cc"]]},{"id":"65397ef3.78ffe","type":"BooleanLogicUltimate","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"OR","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","x":660,"y":2460,"wires":[[],["1d9b52a2.42f53d"],[]]},{"id":"4a122b70.9a63f4","type":"inject","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"At 9am","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":2460,"wires":[["461e657.90e6a9c","b77349f2.49d498"]]},{"id":"461e657.90e6a9c","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"set false","func":"\nmsg.payload = \"false\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":2440,"wires":[["de6a689e.95ed98"]]},{"id":"b77349f2.49d498","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"set true","func":"msg.payload = \"true\";\nmsg.topic = \"control\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":2480,"wires":[["2f026e99.bca5a2"]]},{"id":"f5db588d.9d81b8","type":"mqtt out","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"To MQTT mosquitto_pub port 1883","topic":"esp/to/esp10","qos":"","retain":"","broker":"","x":840,"y":2620,"wires":[]},{"id":"a18953c6.a13e5","type":"inject","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"Door Light Off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"esp/to/esp10","payload":"1","payloadType":"str","x":570,"y":2760,"wires":[["7258f434.bef3cc"]]},{"id":"378594c8.77e57c","type":"inject","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"Door Light On","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"esp/to/esp10","payload":"0","payloadType":"str","x":570,"y":2720,"wires":[["7258f434.bef3cc"]]},{"id":"b8d3aa5e.0578f8","type":"ui_switch","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"","label":"Light By Door","tooltip":"","group":"52170dc0.60aad4","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"esp/to/esp10","style":"","onvalue":"0","onvalueType":"str","onicon":"wb_sunny","oncolor":"Yellow","offvalue":"1","offvalueType":"str","officon":"fa-cloud","offcolor":"Grey","x":540,"y":2600,"wires":[["7258f434.bef3cc"]]},{"id":"ab551848.5b6d88","type":"link in","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"Doorlight ESP32-10","links":["ef655bae.b749d8","12daf026.07ec1","889fa56d.f39398","dc6c32bf.0d08b","c3f8908f.414d5","5f75021d.4e2efc","dd554301.558a","72d393f7.9eccec","ea6bf091.b84d7","5287ccb5.504204","98271c30.589e","492e5506.3b239c","f825c0d7.46599","d30eede3.2f5aa","1f4fc05a.ec3b5","bac939b.c4df4c8","5cdbf2a5.e6724c"],"x":375,"y":2600,"wires":[["b8d3aa5e.0578f8"]]},{"id":"6f6da0fa.66c86","type":"comment","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"Door Light Control","info":"","x":890,"y":2320,"wires":[]},{"id":"7532f962.9f14a8","type":"telegram command","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"","command":"/doorlighton","bot":"","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":410,"y":2640,"wires":[["2c31f39c.40140c"],[]]},{"id":"94b5591e.3f6608","type":"telegram command","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"","command":"/doorlightoff","bot":"","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":410,"y":2680,"wires":[["447195fa.a654cc"],[]]},{"id":"2c31f39c.40140c","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"esp/to/esp10 : 0 ON","func":"//msg = null;\nmsg.payload = 0;\nmsg.topic = 'esp/to/esp10';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":600,"y":2640,"wires":[["7258f434.bef3cc"]]},{"id":"447195fa.a654cc","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"esp/to/esp10 : 1","func":"\nmsg.payload = 1;\nmsg.topic = 'esp/to/esp10';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":2680,"wires":[["7258f434.bef3cc"]]},{"id":"7258f434.bef3cc","type":"rbe","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":910,"y":2560,"wires":[["f5db588d.9d81b8"]]},{"id":"a0ac02e8.7d213","type":"light-scheduler","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","settings":"63f6b01e.0ff0e","events":"[{\"start\":{\"dow\":2,\"mod\":465},\"end\":{\"dow\":2,\"mod\":1365}},{\"start\":{\"dow\":3,\"mod\":465},\"end\":{\"dow\":3,\"mod\":1365}},{\"start\":{\"dow\":4,\"mod\":465},\"end\":{\"dow\":4,\"mod\":1365}},{\"start\":{\"dow\":5,\"mod\":465},\"end\":{\"dow\":5,\"mod\":1365}},{\"start\":{\"dow\":1,\"mod\":465},\"end\":{\"dow\":1,\"mod\":1365}},{\"start\":{\"dow\":6,\"mod\":480},\"end\":{\"dow\":6,\"mod\":1380}},{\"start\":{\"dow\":0,\"mod\":465},\"end\":{\"dow\":0,\"mod\":1365}}]","topic":"esp/to/esp10","name":"On from 7:45am to 10:45pm","onPayload":"true","onPayloadType":"str","offPayload":"false","offPayloadType":"str","onlyWhenDark":false,"scheduleRndMax":0,"sunElevationThreshold":"0","sunShowElevationInStatus":false,"outputfreq":"output.statechange.startup","x":380,"y":2560,"wires":[["2f026e99.bca5a2"]]},{"id":"ed873eae.83df","type":"light-scheduler","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","settings":"63f6b01e.0ff0e","events":"[{\"start\":{\"dow\":2,\"mod\":465},\"end\":{\"dow\":2,\"mod\":1365}},{\"start\":{\"dow\":3,\"mod\":465},\"end\":{\"dow\":3,\"mod\":1365}},{\"start\":{\"dow\":4,\"mod\":465},\"end\":{\"dow\":4,\"mod\":1365}},{\"start\":{\"dow\":5,\"mod\":465},\"end\":{\"dow\":5,\"mod\":1365}},{\"start\":{\"dow\":1,\"mod\":465},\"end\":{\"dow\":1,\"mod\":1365}},{\"start\":{\"dow\":6,\"mod\":480},\"end\":{\"dow\":6,\"mod\":1380}},{\"start\":{\"dow\":0,\"mod\":465},\"end\":{\"dow\":0,\"mod\":1365}}]","topic":"esp/to/esp10","name":"On from 8:15am to 10:45pm","onPayload":"0","onPayloadType":"str","offPayload":"1","offPayloadType":"str","onlyWhenDark":false,"scheduleRndMax":0,"sunElevationThreshold":"0","sunShowElevationInStatus":false,"outputfreq":"output.statechange.startup","x":380,"y":2360,"wires":[["de6a689e.95ed98"]]},{"id":"1d9b52a2.42f53d","type":"function","z":"47cca1f5.5a7a5","g":"a1a3bd71.1c2a7","name":"","func":"if(msg.payload === false){\n    return [null, msg];\n}\nelse if(msg.payload === true){\n    return [msg, null];\n}","outputs":2,"noerr":0,"initialize":"","finalize":"","x":840,"y":2460,"wires":[["848f7c2d.9ce0d"],["98d91067.0fd55"]]},{"id":"52170dc0.60aad4","type":"ui_group","z":"","name":"ESP32 - 1","tab":"377d7947.f2eda6","order":3,"disp":true,"width":4,"collapse":true}]

Flow Info

Created 4 years, 3 months ago
Updated 4 years, 2 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • catch (x1)
  • change (x4)
  • comment (x8)
  • debug (x1)
  • function (x22)
  • http in (x2)
  • http response (x2)
  • inject (x6)
  • join (x1)
  • link in (x2)
  • link out (x7)
  • mqtt out (x2)
  • mqtt-broker (x1)
  • rbe (x2)
  • template (x2)
  • websocket in (x2)
  • websocket-listener (x2)
Other

Tags

  • ESP32
  • MQTT
  • Webhooks
  • Dashboard
  • UI
  • Telegram
  • Lights
  • Relay_Control
  • Relay
  • Automation
  • Home_Automation
  • Mosquitto
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option