-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutomationDemo1
1 lines (1 loc) · 14.4 KB
/
AutomationDemo1
1
[{"id":"bbc5b6fc.10feb8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"6b4176a4.64f0a8","type":"ui_button","z":"bbc5b6fc.10feb8","name":"","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"passthru":false,"label":"50","color":"","bgcolor":"","icon":"","payload":"50","payloadType":"num","topic":"","x":130,"y":100,"wires":[["c83e8ec7.becee","994cc71b.e71f58"]]},{"id":"c83e8ec7.becee","type":"ui_gauge","z":"bbc5b6fc.10feb8","name":"","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"gtype":"gage","title":"Test Gauge","label":"units","format":"{{value}}","min":0,"max":"100","colors":["#ff0000","#e6e600","#008000"],"seg1":"40","seg2":"50","x":380,"y":180,"wires":[]},{"id":"fb8a0a1.28cfdf8","type":"ui_button","z":"bbc5b6fc.10feb8","name":"","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"passthru":false,"label":"75","color":"","bgcolor":"","icon":"","payload":"75","payloadType":"num","topic":"","x":130,"y":180,"wires":[["c83e8ec7.becee","994cc71b.e71f58"]]},{"id":"994cc71b.e71f58","type":"ui_chart","z":"bbc5b6fc.10feb8","name":"","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"label":"Test Chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"60","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":380,"y":100,"wires":[[],[]]},{"id":"f1101ed4.55ff5","type":"http request","z":"bbc5b6fc.10feb8","name":"","method":"GET","ret":"txt","url":"http://192.168.1.101/on","tls":"","x":560,"y":280,"wires":[[]],"inputLabels":["on"]},{"id":"69701622.9a6708","type":"http request","z":"bbc5b6fc.10feb8","name":"","method":"GET","ret":"txt","url":"http://192.168.1.101/off","tls":"","x":560,"y":400,"wires":[[]],"inputLabels":["off"]},{"id":"8f4d8a33.361d68","type":"ui_button","z":"bbc5b6fc.10feb8","name":"","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"passthru":false,"label":"Sonoff ON","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":149,"y":280,"wires":[["f1101ed4.55ff5"]]},{"id":"56b03f6d.e9008","type":"ui_button","z":"bbc5b6fc.10feb8","name":"","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"passthru":false,"label":"Sonoff OFF","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":150,"y":400,"wires":[["69701622.9a6708"]],"outputLabels":["switch"]},{"id":"c43de1bd.edb3b","type":"ui_switch","z":"bbc5b6fc.10feb8","name":"","label":"Sonoff Switch","group":"c90a9b1d.f844d8","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":114.44445037841797,"y":518.8888816833496,"wires":[["4830ad0.0304154","aeea3d1d.53782"]]},{"id":"4830ad0.0304154","type":"switch","z":"bbc5b6fc.10feb8","name":"on","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":280,"y":480,"wires":[["f1101ed4.55ff5"]]},{"id":"aeea3d1d.53782","type":"switch","z":"bbc5b6fc.10feb8","name":"off","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":280,"y":560,"wires":[["69701622.9a6708"]]},{"id":"78c59bab.186414","type":"bigtimer","z":"bbc5b6fc.10feb8","outtopic":"","outpayload1":"","outpayload2":"","name":"timer","lat":"33.78978","lon":"-117.97762","starttime":"1140","endtime":"10060","startoff":0,"endoff":0,"offs":"-7","outtext1":"true","outtext2":"false","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":478,"y":723,"wires":[[],["8f542c7e.d16b1"],[]],"inputLabels":["timer"]},{"id":"8f542c7e.d16b1","type":"debug","z":"bbc5b6fc.10feb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":740,"y":720,"wires":[]},{"id":"f583c037.5d8d9","type":"inject","z":"bbc5b6fc.10feb8","name":"timer","topic":"timer","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":158,"y":703,"wires":[["78c59bab.186414"]]},{"id":"89002074.934bd","type":"inject","z":"bbc5b6fc.10feb8","name":"","topic":"timer","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":158,"y":763,"wires":[["78c59bab.186414"]]},{"id":"b9f34434.f4adb8","type":"inject","z":"bbc5b6fc.10feb8","name":"","topic":"","payload":"ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":112,"y":944,"wires":[["c4201f01.a102e"]]},{"id":"c4201f01.a102e","type":"mqtt out","z":"bbc5b6fc.10feb8","name":"","topic":"cmnd/sonoff/power","qos":"1","retain":"false","broker":"87c17f02.e0814","x":760,"y":993,"wires":[]},{"id":"896aff51.a1d2c","type":"mqtt in","z":"bbc5b6fc.10feb8","name":"","topic":"stat/sonoff/STATUS10","qos":"1","broker":"87c17f02.e0814","x":116,"y":1286,"wires":[["c05454be.3a3938"]]},{"id":"c05454be.3a3938","type":"debug","z":"bbc5b6fc.10feb8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":691,"y":1284,"wires":[]},{"id":"88fbd075.c9c6c","type":"inject","z":"bbc5b6fc.10feb8","name":"","topic":"","payload":"OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":115,"y":1002,"wires":[["c4201f01.a102e"]]},{"id":"89a9cda1.c1d96","type":"inject","z":"bbc5b6fc.10feb8","name":"","topic":"","payload":"TOGGLE","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":114,"y":1067,"wires":[["c4201f01.a102e"]]},{"id":"d4f24588.5992f8","type":"mqtt out","z":"bbc5b6fc.10feb8","name":"","topic":"cmnd/sonoff/status","qos":"1","retain":"false","broker":"87c17f02.e0814","x":758,"y":1180,"wires":[]},{"id":"7856e16b.cfd42","type":"inject","z":"bbc5b6fc.10feb8","name":"GetStatus","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":122,"y":1177,"wires":[["d4f24588.5992f8"]]},{"id":"b504dcd9.c17d5","type":"ui_template","z":"bbc5b6fc.10feb8","group":"4d5ef463.5d01fc","name":"Relay state","order":3,"width":"","height":"","format":"<div layout=\"row\" layout-align=\"space-between\">\n <p>Relay state</p>\n <p ng-style=\"{color: msg.payload === 'ON' ? 'blue' : 'grey'}\">\n <b>{{msg.payload === 'ON' ? 'ON' : 'OFF'}}</b>\n </p>\n</div>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":796,"y":1465,"wires":[[]]},{"id":"b1748eb9.e0158","type":"mqtt in","z":"bbc5b6fc.10feb8","name":"","topic":"stat/sonoff/POWER","qos":"0","broker":"87c17f02.e0814","x":127,"y":1472,"wires":[["b504dcd9.c17d5"]]},{"id":"7c8aa3d8.aa687c","type":"mqtt in","z":"bbc5b6fc.10feb8","name":"","topic":"tele/sonoff/STATE","qos":"0","broker":"87c17f02.e0814","x":124,"y":1595,"wires":[["66f9b5c4.ac87ec"]]},{"id":"d6ecabf3.722de8","type":"function","z":"bbc5b6fc.10feb8","name":"Store last update","func":"var devicename = \"Sonoff5\";\n\nvar temp = global.get(devicename+\"_wifi\");\nvar current = new Date();\nif (temp!== undefined && temp!==null) {\n msg.payload = current.getTime() - temp;\n global.set(devicename+\"_wifi\",current.getTime());\n} else {\n msg.payload = \"\";\n global.set(devicename+\"_wifi\",current.getTime());\n}\n\n// Update the status with current timestamp\nvar now = new Date();\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Last update: \"+dd + \".\" + mm + \".\" + yyyy + \" \" + hh + \":\" + mmm + \":\" + ss});\n\nmsg.formattedtime = dd + \".\" + mm + \".\" + yyyy + \" \" + hh + \":\" + mmm + \":\" + ss;\n\nreturn msg;","outputs":1,"noerr":0,"x":476,"y":1645,"wires":[[]]},{"id":"a25b8c8d.b7c04","type":"ui_text","z":"bbc5b6fc.10feb8","group":"4d5ef463.5d01fc","order":7,"width":0,"height":0,"name":"","label":"Uptime","format":"{{msg.payload.Uptime}}","layout":"row-spread","x":782,"y":1510,"wires":[]},{"id":"ee2eab3b.fa6f68","type":"ui_gauge","z":"bbc5b6fc.10feb8","name":"Wifi gauge","group":"4d5ef463.5d01fc","order":8,"width":0,"height":0,"gtype":"gage","title":"WiFi RSSI","label":"","format":"{{value}}","min":"0","max":"100","colors":["#ff0000","#e6e600","#008000"],"seg1":"40","seg2":"55","x":799,"y":1616,"wires":[]},{"id":"66f9b5c4.ac87ec","type":"json","z":"bbc5b6fc.10feb8","name":"","pretty":false,"x":312,"y":1595,"wires":[["a25b8c8d.b7c04","d6ecabf3.722de8","65107ddd.ee1f14"]]},{"id":"65107ddd.ee1f14","type":"change","z":"bbc5b6fc.10feb8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.Wifi.RSSI","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":568,"y":1591,"wires":[["ee2eab3b.fa6f68","fc9c57bc.46e6a8"]]},{"id":"fc9c57bc.46e6a8","type":"ui_chart","z":"bbc5b6fc.10feb8","name":"","group":"4d5ef463.5d01fc","order":0,"width":0,"height":0,"label":"WiFi RSSI","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":799,"y":1565,"wires":[[],[]]},{"id":"e54d0ce9.f0015","type":"inject","z":"bbc5b6fc.10feb8","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":114,"y":1797,"wires":[["32a55340.39872c"]]},{"id":"32a55340.39872c","type":"function","z":"bbc5b6fc.10feb8","name":"From last update","func":"var devicename = \"Sonoff5\";\n\nvar temp = global.get(devicename+\"_wifi\");\nvar current = new Date();\nmsg.payload = \"No data\";\nmsg.warning = false;\n\nif (temp!==undefined) {\n current = current - temp;\n current = Math.floor(current/1000);\n var minute = Math.floor(current/60);\n var hour = Math.floor(minute/60);\n var day = Math.floor(hour/24);\n if (current>24*60*60) {\n msg.payload = \"Last update \" + day + \" days, \" + hour%24 + \" hours, \" + minute%60 + \" minutes, \" + current%60 + \" seconds ago\";\n } else if (current>60*60) {\n msg.payload = \"Last update \" + hour%24 + \" hours, \" + minute%60 + \" minutes, \" + current%60 + \" seconds ago\";\n } else if (current>60) {\n msg.payload = \"Last update \" + minute%60 + \" minutes, \" + current%60 + \" seconds ago\";\n } else {\n msg.payload = \"Last update \" + current%60 + \" seconds ago\";\n }\n\n}\n\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.payload});\n\n\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":1798,"wires":[["1b59565f.88adca"]]},{"id":"1b59565f.88adca","type":"ui_text","z":"bbc5b6fc.10feb8","group":"4d5ef463.5d01fc","order":9,"width":0,"height":0,"name":"Last Update","label":"","format":"{{msg.payload}}","layout":"row-spread","x":803,"y":1798,"wires":[]},{"id":"fe285d85.342ce","type":"change","z":"bbc5b6fc.10feb8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.DHT11.Temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":494,"y":1714,"wires":[["1cd57e48.d79892"]]},{"id":"1cd57e48.d79892","type":"ui_chart","z":"bbc5b6fc.10feb8","name":"","group":"4d5ef463.5d01fc","order":0,"width":"0","height":"0","label":"DHT11 Temp (C)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"30","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":815,"y":1712,"wires":[[],[]]},{"id":"a65cdad.74e7d28","type":"mqtt in","z":"bbc5b6fc.10feb8","name":"","topic":"tele/sonoff/SENSOR","qos":"0","broker":"87c17f02.e0814","x":122,"y":1711,"wires":[["c1edd003.33653"]]},{"id":"c1edd003.33653","type":"json","z":"bbc5b6fc.10feb8","name":"","pretty":false,"x":309,"y":1712,"wires":[["fe285d85.342ce"]]},{"id":"7b2b6d28.63b9b4","type":"comment","z":"bbc5b6fc.10feb8","name":"UI Button to Chart/Gauge test","info":"","x":125,"y":45,"wires":[]},{"id":"26070e68.179272","type":"comment","z":"bbc5b6fc.10feb8","name":"UI Buttons and Switch for basic web request","info":"Web requests to the arduino ESP8266 SONOFF","x":175,"y":236,"wires":[]},{"id":"5a7f47ef.4de958","type":"comment","z":"bbc5b6fc.10feb8","name":"BigTimer node tests","info":"This special add-on node can be used to schedule events","x":95,"y":629,"wires":[]},{"id":"672a1c0b.ba0514","type":"comment","z":"bbc5b6fc.10feb8","name":"MQTT test to Tasmoto SONOFF","info":"","x":135,"y":845,"wires":[]},{"id":"fbf88301.63c0a","type":"comment","z":"bbc5b6fc.10feb8","name":"MQTT Get Status from SONOFF Tasmoto","info":"","x":174,"y":1126,"wires":[]},{"id":"6cf448db.f130e8","type":"comment","z":"bbc5b6fc.10feb8","name":"MQTT subscription and log to debug","info":"","x":145,"y":1239,"wires":[]},{"id":"fcf36d5e.0b2e1","type":"comment","z":"bbc5b6fc.10feb8","name":"UI with MQTT subscription and JSON decodes charting for DHT11 sensor","info":"From:\nhttps://flows.nodered.org/flow/a4ddead2a9f502db14d3f7783093ff90\nYoutube video:\nhttps://youtu.be/pVPPiYAo8NI","x":272,"y":1402,"wires":[]},{"id":"c90a9b1d.f844d8","type":"ui_group","name":"Group 1","tab":"5aa8903.6ae457","order":1,"disp":true,"width":6},{"id":"87c17f02.e0814","type":"mqtt-broker","z":"","name":"local","broker":"192.168.1.33","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"4d5ef463.5d01fc","type":"ui_group","name":"Group 2","tab":"5aa8903.6ae457","order":2,"disp":true,"width":6},{"id":"5aa8903.6ae457","type":"ui_tab","z":"","name":"Basic","icon":"dashboard","order":1}]