ESP Easy Monitoring

The below flow is what I use to monitor ESP8266 devices running the ESP Easy firmware. I am doing the following:

  • Checking and displaying the uptime and wifi signal strength via MQTT message, displaying them on the dashboard and calculating time between messages and also time since last message
  • Periodically calling the web page of the ESP and monitoring the HTTP response to see if the ESP is responding/timing out, etc.

So far I was not really able to draw too much conclusion from the data, but have a look and see what you can make out of it.

There is a video on Youtube where I explain all this: https://youtu.be/mK1vvyuf39c

[{"id":"4dd1748f.b9e43c","type":"tab","label":"ESP Signal"},{"id":"1880ff71.82cee1","type":"mqtt in","z":"4dd1748f.b9e43c","name":"","topic":"/Sonoff1/Uptime/","qos":"0","broker":"cea5258a.b34038","x":116.66665649414062,"y":111.66666412353516,"wires":[["cf644a73.dbb708"]]},{"id":"42f35fe7.86181","type":"ui_text","z":"4dd1748f.b9e43c","group":"dbcddf8f.6d3bb","order":1,"width":0,"height":0,"name":"Uptime","label":"Uptime","format":"{{msg.payload}}","layout":"row-spread","x":581.6666946411133,"y":112.66669464111328,"wires":[]},{"id":"7747d55d.da995c","type":"mqtt in","z":"4dd1748f.b9e43c","name":"","topic":"/Sonoff1/Wifi/","qos":"0","broker":"cea5258a.b34038","x":103.66665649414062,"y":252.66669464111328,"wires":[["c37d2f24.6405f","bcac352c.516978"]]},{"id":"c37d2f24.6405f","type":"ui_gauge","z":"4dd1748f.b9e43c","name":"Wifi gauge","group":"dbcddf8f.6d3bb","order":2,"width":0,"height":0,"gtype":"gage","title":"","label":"","format":"{{value}}","min":"-100","max":"-50","colors":["#ff0000","#e6e600","#00b500"],"x":404.6666564941406,"y":253.66669464111328,"wires":[]},{"id":"dec328eb.53d758","type":"comment","z":"4dd1748f.b9e43c","name":"ESP Signal monitor","info":"","x":127.66665649414062,"y":55.666664123535156,"wires":[]},{"id":"bcac352c.516978","type":"function","z":"4dd1748f.b9e43c","name":"From last update","func":"var temp = global.get(\"Sonoff1_wifi\");\nvar current = new Date();\nif (temp!== undefined && temp!==null) {\n    msg.payload = current.getTime() - temp;\n    global.set(\"Sonoff1_wifi\",current.getTime());\n} else {\n    msg.payload = \"\";\n    global.set(\"Sonoff1_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":423.66666412353516,"y":299.6666946411133,"wires":[["5d5c82f6.ea6abc"]]},{"id":"5d5c82f6.ea6abc","type":"ui_text","z":"4dd1748f.b9e43c","group":"dbcddf8f.6d3bb","order":3,"width":0,"height":0,"name":"","label":"Milis from last update","format":"{{msg.payload}}","layout":"row-spread","x":701.6666564941406,"y":306.6666946411133,"wires":[]},{"id":"71f90ed8.d789c","type":"comment","z":"4dd1748f.b9e43c","name":"Monitor sonoff restart","info":"","x":365.3333206176758,"y":56.33325958251953,"wires":[]},{"id":"cf644a73.dbb708","type":"function","z":"4dd1748f.b9e43c","name":"Save last uptime","func":"var devicename = \"Sonoff1\";\nvar varname = devicename + \"_uptime\";\n\nif (global.get(varname)!==undefined) {\n    if (parseInt(msg.payload)<global.get(varname)) {\n        msg.warning_text= devicename + \" restarted: \" + global.get(varname) + \" -> \" + msg.payload;\n        msg.device = devicename;\n        msg.warning=true;\n    } else {\n        msg.warning=false;\n    }\n}\n\nglobal.set(varname,parseInt(msg.payload));\n\nif (msg.warning) {\n    node.status({fill:\"red\",shape:\"dot\",text:msg.warning_text});\n} else {\n    node.status({fill:\"green\",shape:\"dot\",text:\"Current uptime: \"+global.get(varname)});\n}\nreturn msg;","outputs":1,"noerr":0,"x":357.3333206176758,"y":112.66663360595703,"wires":[["42f35fe7.86181","2b8e419c.163abe"]]},{"id":"2b8e419c.163abe","type":"switch","z":"4dd1748f.b9e43c","name":"Restart?","property":"warning","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":576.3333206176758,"y":169.66663360595703,"wires":[["3dea6348.80f07c"]]},{"id":"3dea6348.80f07c","type":"change","z":"4dd1748f.b9e43c","name":"Toast message","rules":[{"t":"set","p":"topic","pt":"msg","to":"device","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"warning_text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":769.3333206176758,"y":169.66663360595703,"wires":[["f78be230.51961"]]},{"id":"f78be230.51961","type":"link out","z":"4dd1748f.b9e43c","name":"","links":["3e084f74.ca14"],"x":921.1904487609863,"y":169.23805236816406,"wires":[]},{"id":"48b79eda.c871f","type":"ui_text","z":"4dd1748f.b9e43c","group":"dbcddf8f.6d3bb","order":3,"width":0,"height":0,"name":"Last Update","label":"","format":"{{msg.payload}}","layout":"row-spread","x":688.3333206176758,"y":355.66663360595703,"wires":[]},{"id":"705f0c3e.c6a4a4","type":"inject","z":"4dd1748f.b9e43c","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":216.33332061767578,"y":357.66663360595703,"wires":[["871dfd3c.478e2"]]},{"id":"871dfd3c.478e2","type":"function","z":"4dd1748f.b9e43c","name":"From last update","func":"var temp = global.get(\"Sonoff1_wifi\");\nvar current = new Date();\nmsg.payload = \"No data\";\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\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.payload});\n\n\nreturn msg;","outputs":1,"noerr":0,"x":428.3333206176758,"y":357.66663360595703,"wires":[["48b79eda.c871f"]]},{"id":"19d3fb46.0fc225","type":"mqtt in","z":"4dd1748f.b9e43c","name":"","topic":"/RGB/Uptime/","qos":"0","broker":"cea5258a.b34038","x":97.66665649414062,"y":479.6666564941406,"wires":[["fe16233c.0572d"]]},{"id":"3af18f0c.baf17","type":"ui_text","z":"4dd1748f.b9e43c","group":"93b2800.e16a08","order":1,"width":0,"height":0,"name":"Uptime","label":"Uptime","format":"{{msg.payload}}","layout":"row-spread","x":572.6666946411133,"y":480.66668701171875,"wires":[]},{"id":"fcfe6e41.95b46","type":"mqtt in","z":"4dd1748f.b9e43c","name":"","topic":"/RGB/Wifi/","qos":"0","broker":"cea5258a.b34038","x":84.66665649414062,"y":620.6666870117188,"wires":[["db84f9d6.6ca6c8","c40d0878.141e78"]]},{"id":"db84f9d6.6ca6c8","type":"ui_gauge","z":"4dd1748f.b9e43c","name":"Wifi gauge","group":"93b2800.e16a08","order":2,"width":0,"height":0,"gtype":"gage","title":"","label":"","format":"{{value}}","min":"-100","max":"-50","colors":["#ff0000","#e6e600","#00b500"],"x":395.6666564941406,"y":621.6666870117188,"wires":[]},{"id":"e7b84bfb.bfe008","type":"comment","z":"4dd1748f.b9e43c","name":"H801 Signal monitor","info":"","x":118.66665649414062,"y":423.6666564941406,"wires":[]},{"id":"c40d0878.141e78","type":"function","z":"4dd1748f.b9e43c","name":"From last update","func":"var temp = global.get(\"RGB_wifi\");\nvar current = new Date();\nif (temp!== undefined && temp!==null) {\n    msg.payload = current.getTime() - temp;\n    global.set(\"RGB_wifi\",current.getTime());\n} else {\n    msg.payload = \"\";\n    global.set(\"RGB_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":412.6666564941406,"y":674.6666870117188,"wires":[["c672a42c.e069f8"]]},{"id":"c672a42c.e069f8","type":"ui_text","z":"4dd1748f.b9e43c","group":"93b2800.e16a08","order":3,"width":0,"height":0,"name":"","label":"Milis from last update","format":"{{msg.payload}}","layout":"row-spread","x":692.6666564941406,"y":674.6666870117188,"wires":[]},{"id":"de6f2b46.a7a148","type":"comment","z":"4dd1748f.b9e43c","name":"Monitor sonoff restart","info":"","x":356.3333206176758,"y":424.333251953125,"wires":[]},{"id":"fe16233c.0572d","type":"function","z":"4dd1748f.b9e43c","name":"Save last uptime","func":"var devicename = \"RGB\";\nvar varname = devicename + \"_uptime\";\n\nif (global.get(varname)!==undefined) {\n    if (parseInt(msg.payload)<global.get(varname)) {\n        msg.warning_text= devicename + \" restarted: \" + global.get(varname) + \" -> \" + msg.payload;\n        msg.device = devicename;\n        msg.warning=true;\n    } else {\n        msg.warning=false;\n    }\n}\n\nglobal.set(varname,parseInt(msg.payload));\n\nif (msg.warning) {\n    node.status({fill:\"red\",shape:\"dot\",text:msg.warning_text});\n} else {\n    node.status({fill:\"green\",shape:\"dot\",text:\"Current uptime: \"+global.get(varname)});\n}\nreturn msg;","outputs":1,"noerr":0,"x":348.3333206176758,"y":480.6666259765625,"wires":[["3af18f0c.baf17","6bce0c8e.6cc1c4"]]},{"id":"6bce0c8e.6cc1c4","type":"switch","z":"4dd1748f.b9e43c","name":"Restart?","property":"warning","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":567.3333206176758,"y":537.6666259765625,"wires":[["899265ea.c3d198"]]},{"id":"899265ea.c3d198","type":"change","z":"4dd1748f.b9e43c","name":"Toast message","rules":[{"t":"set","p":"topic","pt":"msg","to":"device","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"warning_text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760.3333206176758,"y":537.6666259765625,"wires":[["cb2fa4cc.f290a8"]]},{"id":"cb2fa4cc.f290a8","type":"link out","z":"4dd1748f.b9e43c","name":"","links":["3e084f74.ca14"],"x":912.1904487609863,"y":537.2380447387695,"wires":[]},{"id":"5075e7d8.4264e8","type":"ui_text","z":"4dd1748f.b9e43c","group":"93b2800.e16a08","order":3,"width":0,"height":0,"name":"Last Update","label":"","format":"{{msg.payload}}","layout":"row-spread","x":673.6666641235352,"y":731.08349609375,"wires":[]},{"id":"da116288.7c158","type":"inject","z":"4dd1748f.b9e43c","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":201.66666412353516,"y":733.08349609375,"wires":[["647f3dd4.6bf514"]]},{"id":"647f3dd4.6bf514","type":"function","z":"4dd1748f.b9e43c","name":"From last update","func":"var temp = global.get(\"RGB_wifi\");\nvar current = new Date();\nmsg.payload = \"No data\";\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\nnode.status({fill:\"blue\",shape:\"ring\",text:msg.payload});\n\n\nreturn msg;","outputs":1,"noerr":0,"x":413.66666412353516,"y":733.08349609375,"wires":[["5075e7d8.4264e8"]]},{"id":"240d23de.206bbc","type":"inject","z":"4dd1748f.b9e43c","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":false,"x":120.66665649414062,"y":932.3333740234375,"wires":[["d38c6075.95ad4","46994416.57324c","f6acb7d0.526f08","fbcf726a.5ef33","63e5816a.90e5c","82549437.105788","5342ba94.8f21b4"]]},{"id":"d38c6075.95ad4","type":"http request","z":"4dd1748f.b9e43c","name":"Sonoff 1 poll","method":"GET","ret":"txt","url":"http://192.168.1.117/","tls":"","x":338.66666412353516,"y":931.3333339691162,"wires":[["89a9370b.af92c8"]]},{"id":"89a9370b.af92c8","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"Sonoff1_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"Sonoff1_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];\n\n","outputs":"5","noerr":0,"x":578.6665420532227,"y":940.3333339691162,"wires":[["ec32a79a.826428","64cc8283.cc90ec"],["ec32a79a.826428","64cc8283.cc90ec"],["ec32a79a.826428","64cc8283.cc90ec"],["ec32a79a.826428","64cc8283.cc90ec"],["ec32a79a.826428","64cc8283.cc90ec"]]},{"id":"ec32a79a.826428","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff 1 chart","group":"dbcddf8f.6d3bb","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":861.6666564941406,"y":929.3333740234375,"wires":[[],[]]},{"id":"6bea9217.a50a3c","type":"comment","z":"4dd1748f.b9e43c","name":"Web response statistics","info":"","x":134.16663360595703,"y":822.3333339691162,"wires":[]},{"id":"849a3208.c079f","type":"function","z":"4dd1748f.b9e43c","name":"Reset chart","func":"//stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\nglobal.set(\"Sonoff1_webstat\",undefined);\nglobal.set(\"H801_webstat\",undefined);\nglobal.set(\"Sonoff2_webstat\",undefined);\nglobal.set(\"Sonoff3_webstat\",undefined);\nglobal.set(\"Sonoff4_webstat\",undefined);\nglobal.set(\"Sonoff5_webstat\",undefined);\nglobal.set(\"Sonoff6_webstat\",undefined);\nmsg.payload = [];\nreturn msg;","outputs":1,"noerr":0,"x":596.166633605957,"y":879.3333339691162,"wires":[["ec32a79a.826428","64cc8283.cc90ec","e2c3401.256eac","d029ea08.b021d8","3fcddb0f.b21a64","7493a070.039eb","696273dd.fac1fc","14aaad40.90a253","a04db64c.942248","441a29cf.d56188","4b175949.f1c7b8","f7e4be2b.92ed2","3957a48d.202d9c","22a64818.5002f8"]]},{"id":"521e9f8a.0df","type":"inject","z":"4dd1748f.b9e43c","name":"Full reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":112.16663360595703,"y":880.3333339691162,"wires":[["849a3208.c079f"]]},{"id":"64cc8283.cc90ec","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff 1 chart","group":"dbcddf8f.6d3bb","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":861.166633605957,"y":970.3333339691162,"wires":[[],[]]},{"id":"46994416.57324c","type":"http request","z":"4dd1748f.b9e43c","name":"H801 poll","method":"GET","ret":"txt","url":"http://192.168.1.126/","tls":"","x":337.16666412353516,"y":1036.3333339691162,"wires":[["57952633.0d3678"]]},{"id":"57952633.0d3678","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"H801_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"H801_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];\n","outputs":"5","noerr":0,"x":583.1666412353516,"y":1033.333293914795,"wires":[["e2c3401.256eac","d029ea08.b021d8"],["e2c3401.256eac","d029ea08.b021d8"],["e2c3401.256eac","d029ea08.b021d8"],["e2c3401.256eac","d029ea08.b021d8"],["e2c3401.256eac","d029ea08.b021d8"]]},{"id":"e2c3401.256eac","type":"ui_chart","z":"4dd1748f.b9e43c","name":"H801 chart","group":"93b2800.e16a08","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":860.1666641235352,"y":1033.3333339691162,"wires":[[],[]]},{"id":"d029ea08.b021d8","type":"ui_chart","z":"4dd1748f.b9e43c","name":"H801 chart","group":"93b2800.e16a08","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":859.6666412353516,"y":1074.333293914795,"wires":[[],[]]},{"id":"f6acb7d0.526f08","type":"http request","z":"4dd1748f.b9e43c","name":"Sonoff2 poll","method":"GET","ret":"txt","url":"http://192.168.1.128/","tls":"","x":340.16666412353516,"y":1126.3333339691162,"wires":[["193963d0.d5522c"]]},{"id":"193963d0.d5522c","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"Sonoff2_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"Sonoff2_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];\n","outputs":"5","noerr":0,"x":576.166633605957,"y":1124.3333339691162,"wires":[["3fcddb0f.b21a64","7493a070.039eb"],["3fcddb0f.b21a64","7493a070.039eb"],["3fcddb0f.b21a64","7493a070.039eb"],["3fcddb0f.b21a64","7493a070.039eb"],["3fcddb0f.b21a64","7493a070.039eb"]]},{"id":"3fcddb0f.b21a64","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff2 chart","group":"4db6d9c8.0c4348","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":863.1666564941406,"y":1124.3333740234375,"wires":[[],[]]},{"id":"7493a070.039eb","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff2 chart","group":"4db6d9c8.0c4348","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":862.666633605957,"y":1165.3333339691162,"wires":[[],[]]},{"id":"fbcf726a.5ef33","type":"http request","z":"4dd1748f.b9e43c","name":"Sonoff3 poll","method":"GET","ret":"txt","url":"http://192.168.1.130","tls":"","x":342.16663360595703,"y":1219.3333339691162,"wires":[["71beb7cc.7c52f8"]]},{"id":"71beb7cc.7c52f8","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"Sonoff3_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"Sonoff3_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];\n","outputs":"5","noerr":0,"x":578.1666030883789,"y":1217.3333339691162,"wires":[["696273dd.fac1fc","14aaad40.90a253"],["696273dd.fac1fc","14aaad40.90a253"],["696273dd.fac1fc","14aaad40.90a253"],["696273dd.fac1fc","14aaad40.90a253"],["696273dd.fac1fc","14aaad40.90a253"]]},{"id":"696273dd.fac1fc","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff3 chart","group":"81bd4251.d9dd5","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":865.1666259765625,"y":1217.3333740234375,"wires":[[],[]]},{"id":"14aaad40.90a253","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff3 chart","group":"81bd4251.d9dd5","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":864.6666030883789,"y":1258.3333339691162,"wires":[[],[]]},{"id":"63e5816a.90e5c","type":"http request","z":"4dd1748f.b9e43c","name":"Sonoff4 poll","method":"GET","ret":"txt","url":"http://192.168.1.131","tls":"","x":330.16663360595703,"y":1308.3333339691162,"wires":[["30957235.a9f51e"]]},{"id":"30957235.a9f51e","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"Sonoff4_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"Sonoff4_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];\n","outputs":"5","noerr":0,"x":566.1666030883789,"y":1306.3333339691162,"wires":[["a04db64c.942248","441a29cf.d56188"],["a04db64c.942248","441a29cf.d56188"],["a04db64c.942248","441a29cf.d56188"],["a04db64c.942248","441a29cf.d56188"],["a04db64c.942248","441a29cf.d56188"]]},{"id":"a04db64c.942248","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff4 chart","group":"b7a752fd.d9df8","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":853.1666259765625,"y":1306.3333740234375,"wires":[[],[]]},{"id":"441a29cf.d56188","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff4 chart","group":"b7a752fd.d9df8","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":852.6666030883789,"y":1347.3333339691162,"wires":[[],[]]},{"id":"82549437.105788","type":"http request","z":"4dd1748f.b9e43c","name":"Sonoff5 poll","method":"GET","ret":"txt","url":"http://192.168.1.132","tls":"","x":322.16663360595703,"y":1395.3333339691162,"wires":[["26e93247.df5ace"]]},{"id":"26e93247.df5ace","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"Sonoff5_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"Sonoff5_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];","outputs":"5","noerr":0,"x":558.1666030883789,"y":1393.3333339691162,"wires":[["4b175949.f1c7b8","f7e4be2b.92ed2"],["4b175949.f1c7b8","f7e4be2b.92ed2"],["4b175949.f1c7b8","f7e4be2b.92ed2"],["4b175949.f1c7b8","f7e4be2b.92ed2"],["4b175949.f1c7b8","f7e4be2b.92ed2"]]},{"id":"4b175949.f1c7b8","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff5 chart","group":"8368d062.acf45","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":845.1666259765625,"y":1393.3333740234375,"wires":[[],[]]},{"id":"f7e4be2b.92ed2","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff5 chart","group":"8368d062.acf45","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":844.6666030883789,"y":1434.3333339691162,"wires":[[],[]]},{"id":"5342ba94.8f21b4","type":"http request","z":"4dd1748f.b9e43c","name":"Sonoff6 poll","method":"GET","ret":"txt","url":"http://192.168.1.133","tls":"","x":317.16663360595703,"y":1479.3333339691162,"wires":[["58c9716.04d6e9"]]},{"id":"58c9716.04d6e9","type":"function","z":"4dd1748f.b9e43c","name":"Result calculator","func":"var stat = global.get(\"Sonoff6_webstat\");\n\nif (stat===undefined) {\n    stat = {count:0, OK:0, ECONNRESET:0, ENOTFOUND:0, ETIMEDOUT:0, other:0};\n}\nswitch (msg.statusCode) {\n    case 200:\n        stat.count++;\n        stat.OK++;\n        break;\n    case \"ECONNRESET\":\n        stat.count++;\n        stat.ECONNRESET++;\n        break;\n    case \"ENOTFOUND\":\n        stat.count++;\n        stat.ENOTFOUND++;\n        break;\n    case \"ETIMEDOUT\":\n        stat.count++;\n        stat.ETIMEDOUT++;\n        break;\n    default:    \n        stat.count++;\n        stat.other++;\n}\n\nglobal.set(\"Sonoff6_webstat\",stat);\n\nreturn [\n    {topic:\"OK\", payload:stat.OK},\n    {topic:\"Connection reset\", payload:stat.ECONNRESET},\n    {topic:\"Timed out\", payload:stat.ETIMEDOUT},\n    {topic:\"Not found\", payload:stat.ENOTFOUND},\n    {topic:\"Other error\", payload:stat.other}\n    ];\n","outputs":"5","noerr":0,"x":553.1666030883789,"y":1477.3333339691162,"wires":[["3957a48d.202d9c","22a64818.5002f8"],["3957a48d.202d9c","22a64818.5002f8"],["3957a48d.202d9c","22a64818.5002f8"],["3957a48d.202d9c","22a64818.5002f8"],["22a64818.5002f8","3957a48d.202d9c"]]},{"id":"3957a48d.202d9c","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff6 chart","group":"e57131c8.225da","order":0,"width":0,"height":0,"label":"Web Config Response","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"x":840.1666259765625,"y":1477.3333740234375,"wires":[[],[]]},{"id":"22a64818.5002f8","type":"ui_chart","z":"4dd1748f.b9e43c","name":"Sonoff6 chart","group":"e57131c8.225da","order":0,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"x":839.6666030883789,"y":1518.3333339691162,"wires":[[],[]]},{"id":"cea5258a.b34038","type":"mqtt-broker","z":"","broker":"192.168.1.80","port":"1883","clientid":"node-red","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"dbcddf8f.6d3bb","type":"ui_group","z":"","name":"Sonoff 1","tab":"62b981d8.2c9ba","order":1,"disp":true,"width":"6"},{"id":"93b2800.e16a08","type":"ui_group","z":"","name":"RGB","tab":"62b981d8.2c9ba","disp":true,"width":"6"},{"id":"4db6d9c8.0c4348","type":"ui_group","z":"","name":"Sonoff 2","tab":"62b981d8.2c9ba","order":3,"disp":true,"width":"6"},{"id":"81bd4251.d9dd5","type":"ui_group","z":"","name":"Sonoff 3","tab":"62b981d8.2c9ba","order":4,"disp":true,"width":"6"},{"id":"b7a752fd.d9df8","type":"ui_group","z":"","name":"Sonoff 4","tab":"62b981d8.2c9ba","order":5,"disp":true,"width":"6"},{"id":"8368d062.acf45","type":"ui_group","z":"","name":"Sonoff 5","tab":"62b981d8.2c9ba","order":6,"disp":true,"width":"6"},{"id":"e57131c8.225da","type":"ui_group","z":"","name":"Sonoff 6","tab":"62b981d8.2c9ba","order":7,"disp":true,"width":"6"},{"id":"62b981d8.2c9ba","type":"ui_tab","z":"","name":"ESP Signal","icon":"network_check","order":4}]
nygma2004

Flow Info

created 2 months, 1 week ago

Node Types

Core
  • change (x2)
  • comment (x5)
  • function (x14)
  • http request (x7)
  • inject (x4)
  • mqtt in (x4)
  • mqtt-broker (x1)
  • switch (x2)
Other
  • link out (x2)
  • tab (x1)
  • ui_chart (x14)
  • ui_gauge (x2)
  • ui_group (x7)
  • ui_tab (x1)
  • ui_text (x6)

Tags

  • esp
  • monitoring
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option