First flow on all my RPIs

I found this flow helpfull and it is growing over time. It has a function library, global variables, some usefull cron nodes, a central http request, a telegram output etc....

[{"id":"b263e6b23d8eb759","type":"tab","label":"Sytem Services","disabled":false,"info":"","env":[]},{"id":"822527725c7dc5b4","type":"group","z":"b263e6b23d8eb759","name":"System Services","style":{"stroke":"#a4a4a4","label":true,"fill":"#ffefbf","fill-opacity":"0.18"},"nodes":["cefbc81259d60831","a80f530462abfacc","58724090944c5d8b","22f1b275fb4fa70a","d93a61053c3c1138","513342ae16ee393e","26c9933b5069f369","0ee6bc8cb3276b06","fa5af2fb16e3ed48"],"x":74,"y":871.5,"w":632,"h":349.5},{"id":"7d08e4b88b4a3571","type":"group","z":"b263e6b23d8eb759","name":"common routines","style":{"fill":"#ffdf7f","fill-opacity":"0.18","label":true,"stroke":"#ff0000"},"nodes":["3be6b85ac0c23e23"],"x":74,"y":59,"w":212,"h":82},{"id":"d164d05ea4dd9645","type":"group","z":"b263e6b23d8eb759","name":"Cron","style":{"label":true,"fill":"#d1d1d1","fill-opacity":"0.18"},"nodes":["f302da7022f63a58","b94d609007366f0c","d72b564df93d24b5","127c97edc66fd64f","528348829347db0e","9299e0dd8f240a0f"],"x":68,"y":193,"w":394,"h":634},{"id":"ea1db47bb61d9273","type":"group","z":"b263e6b23d8eb759","name":"central http-request","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["d59a2325dd14c795","e68047ac842dec83","94280fbadd4967bf","5ab34b4781bc1caf","3e71970ac957f920","f329bb9bfb89d858","2f9ad77be5d3ada8","14d66265c705c0b9","4d93b4cd3269cad2","85abc99c6ccb2211"],"x":74,"y":1419,"w":1202,"h":322},{"id":"0c7c436f8a5cc097","type":"group","z":"b263e6b23d8eb759","name":"error handling","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["734b1bf305b93e8c","fe2a97bef7fedda4","c138f086f072f326","1bcbad7b51596b08"],"x":84,"y":1799,"w":812,"h":142},{"id":"9c8b492f1fc2d348","type":"group","z":"b263e6b23d8eb759","name":"mqtt-gate","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["faad0d73ecc766ce","5d5e9bb1f0c15b1d","b1bbe9e9cb74e870","410808df5aa5ea71"],"x":74,"y":1279,"w":612,"h":82},{"id":"3dcd10e3f8ad3578","type":"group","z":"b263e6b23d8eb759","name":"Mesage to Telegram","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["d3422b90f8530fb4","331e55c6bd666f1f"],"x":84,"y":1979,"w":392,"h":82},{"id":"72aef3ef94af81bb","type":"group","z":"b263e6b23d8eb759","name":"gobal variables","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"stroke":"#ff0000"},"nodes":["f806f2a06355e854"],"x":414,"y":59,"w":212,"h":82},{"id":"f302da7022f63a58","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"Initialisation Impuls","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"color":"#777777","stroke":"#92d04f"},"nodes":["02bd72daa36044e5","925444abfd4bac79"],"x":94,"y":219,"w":342,"h":82},{"id":"b94d609007366f0c","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"wifi impuls","style":{"stroke":"#92d04f","label":true,"fill":"#ffefbf","fill-opacity":"0.18"},"nodes":["d3640db36fb6a565","bb594a95da5aee74"],"x":94,"y":319,"w":342,"h":82},{"id":"d72b564df93d24b5","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"firmware-impuls","style":{"stroke":"#92d04f","fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["5e6f80a5c869fa91","84f41c6a279dda87"],"x":94,"y":419,"w":342,"h":82},{"id":"127c97edc66fd64f","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"midnight-impuls","style":{"stroke":"#92d04f","fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["77e2c0bf1fad2b85","1ad7abcae08cbbbb"],"x":94,"y":519,"w":342,"h":82},{"id":"528348829347db0e","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"tick every minute","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"stroke":"#92d04f"},"nodes":["25770a19ef9e1974","fd43e771c5235497"],"x":94,"y":719,"w":342,"h":82},{"id":"9299e0dd8f240a0f","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"tick every second","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"stroke":"#92d04f"},"nodes":["ba92c0aa27ceef02","a67c763711582657"],"x":94,"y":619,"w":342,"h":82},{"id":"cefbc81259d60831","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"5Ghz-reset","payload":"","payloadType":"date","x":220,"y":1160,"wires":[["a80f530462abfacc","58724090944c5d8b"]]},{"id":"a80f530462abfacc","type":"mqtt out","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","topic":"","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"dedee2f82d127c47","x":450,"y":1180,"wires":[]},{"id":"58724090944c5d8b","type":"function","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"reconnect WiFi","func":"msg.payload = \"sudo ip link set wlan0 down && sleep 1 && sudo ip link set wlan0 up\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":1140,"wires":[["22f1b275fb4fa70a"]]},{"id":"22f1b275fb4fa70a","type":"exec","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","command":"sudo","addpay":"payload","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":630,"y":1140,"wires":[[],[],[]]},{"id":"d93a61053c3c1138","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":1120,"wires":[["58724090944c5d8b"]]},{"id":"513342ae16ee393e","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":260,"y":1020,"wires":[["26c9933b5069f369"]]},{"id":"26c9933b5069f369","type":"exec","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","command":"node-red-restart","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":480,"y":1020,"wires":[[],[],[]]},{"id":"0ee6bc8cb3276b06","type":"exec","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","command":"sudo reboot","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":470,"y":920,"wires":[[],[],[]]},{"id":"fa5af2fb16e3ed48","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":920,"wires":[["0ee6bc8cb3276b06"]]},{"id":"3be6b85ac0c23e23","type":"function","z":"b263e6b23d8eb759","g":"7d08e4b88b4a3571","name":"function library","func":"","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.timestring = function (timestamp,format) {\n    const date = new Date(timestamp);\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    switch(format){\n        case \"HH:MM:SS @ DD-MM-YYYY\":\n            return (hours + ':' + minutes + ':' + seconds + \" @ \" + day + \"-\" + month + \"-\" + year);\n        case \"HH:MM:SS DD-MM-YYYY\":\n            return (hours + ':' + minutes + ':' + seconds + \" \" + day + \"-\" + month + \"-\" + year);  \n        case \"DD-MM-YYYY\":\n            return (day + \"-\" + month + \"-\" + year);\n        case \"HH:MM:SS\":\n            return (hours + ':' + minutes + ':' + seconds); \n        case \"HH:MM\":\n            return (hours + ':' + minutes);                                 \n    }\nreturn null;\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.runtime_ms= function runtime_str(ms,format) {\n    const t = ms/1000;\n    const h = (Math.floor(t / 3600)).toString();\n    const m = (Math.floor(t % 3600 / 60)).toString();\n    const s = (Math.floor(t % 3600 % 60)).toString();\n    switch (format) {\n        case \"HH:MM:SS\":\n            return ((\"00\" + h).slice(-3) + \":\" + (\"0\" + m).slice(-2) + \":\" + (\"0\" + s).slice(-2));\n        case \"HH:MM\":\n            return ((\"00\" + h).slice(-3) + \":\" + (\"0\" + m).slice(-2));\n        case \"HH\":\n            return ((\"00\" + h).slice(-3));\n    }    \nreturn null;\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.runtime_sec = function runtime_str(sec, format) {\n    const t = sec;\n    const h = (Math.floor(t / 3600)).toString();\n    const m = (Math.floor(t % 3600 / 60)).toString();\n    const s = (Math.floor(t % 3600 % 60)).toString();\n    switch (format) {\n        case \"HH:MM:SS\":\n            return ((\"00\" + h).slice(-3) + \":\" + (\"0\" + m).slice(-2) + \":\" + (\"0\" + s).slice(-2));\n        case \"HH:MM\":\n            return ((\"00\" + h).slice(-3) + \":\" + (\"0\" + m).slice(-2));\n        case \"HH\":\n            return ((\"00\" + h).slice(-3));\n    }\n    return null;\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.rel_pressure = function runtime_str(pressure, hight) {\n    const x = 1 - (hight / 44330);    // hight[m] above sealevel\n    const y = 5.255;\n    return (parseFloat(pressure / Math.pow(x, y)).toFixed(1));\n}\n\n//----------------------------------------------------------------------------------------------\n","finalize":"","libs":[],"x":180,"y":100,"wires":[[]]},{"id":"02bd72daa36044e5","type":"inject","z":"b263e6b23d8eb759","g":"f302da7022f63a58","name":"central-init-impuls","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"{\"type\":\"init\"}","payloadType":"json","x":230,"y":260,"wires":[["925444abfd4bac79"]]},{"id":"925444abfd4bac79","type":"link out","z":"b263e6b23d8eb759","g":"f302da7022f63a58","name":"initialisation impuls","mode":"link","links":["88890ba844ff004e","29c9a044e58ccc08","49a4562c7ef0b43f","0fd8ccca192b7577","59a3529d627adf43","a096dcfe86f0d4c9","20f70f1f718d9da8","fc4c83408d322b06","c9ebcb1ea7fa5ec3","97caa6e3496ddbf2","6e58c6b0731ee429","c22cb9c519534951","5895a5aee192bb9b","7e7fc84225593a48","410808df5aa5ea71","f65536f11f669874","659e11fa6e765b8d","614f2cde083ad1ee","a30f3ba19a8c8cf6"],"x":395,"y":260,"wires":[]},{"id":"d59a2325dd14c795","type":"link in","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"http-request-in","links":["7425a2432b92bb18"],"x":115,"y":1580,"wires":[["5ab34b4781bc1caf","14d66265c705c0b9"]]},{"id":"e68047ac842dec83","type":"http request","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"central HTTP request","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":640,"y":1580,"wires":[["f329bb9bfb89d858"]]},{"id":"94280fbadd4967bf","type":"link out","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"http-request-out","mode":"return","links":[],"x":985,"y":1580,"wires":[]},{"id":"5ab34b4781bc1caf","type":"function","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"requestTimeout","func":"const to = 20000;               // request timeout in ms\nconst z = date_time_string();\n\nlet counter = context.get('counter') + 1;\nlet s = counter + \" | \" + z + \" | \" + msg.url + \" | \" + to + \"ms\";\nnode.status({ text: s });\ncontext.set('counter', counter);\nmsg.requestTimeout = to;\nreturn msg;\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"timeout":"","noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set(\"counter\", 0)\n","finalize":"","libs":[],"x":280,"y":1580,"wires":[["e68047ac842dec83"]]},{"id":"3e71970ac957f920","type":"debug","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"debug central http request ok","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1090,"y":1460,"wires":[]},{"id":"f329bb9bfb89d858","type":"switch","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":830,"y":1580,"wires":[["94280fbadd4967bf","3e71970ac957f920","4d93b4cd3269cad2"],["2f9ad77be5d3ada8","85abc99c6ccb2211"]]},{"id":"2f9ad77be5d3ada8","type":"debug","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"debug central http request error","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1100,"y":1700,"wires":[]},{"id":"14d66265c705c0b9","type":"debug","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"debug central http request input","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":330,"y":1520,"wires":[]},{"id":"4d93b4cd3269cad2","type":"function","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"request ok","func":"const z = date_time_string();\nlet counter = context.get('counter') + 1;\n\nlet url = msg.responseUrl;\nlet status = msg.statusCode;\nlet s = counter + \" | \" + z + \" | \" + msg.url + \" | \" + \"StatusCode \" + msg.statusCode;\nnode.status({ text: s });\n\ncontext.set('counter', counter);\nreturn msg;\n\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set(\"counter\", 0)","finalize":"","libs":[],"x":1040,"y":1520,"wires":[[]]},{"id":"85abc99c6ccb2211","type":"function","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"request error","func":"const z = date_time_string();\nlet counter = context.get('counter') + 1;\n\nlet url = msg.responseUrl;\nlet status = msg.statusCode;\nlet s = counter + \" | \" + z + \" | \" + msg.url + \" | \" + \"StatusCode \" + msg.statusCode;\nnode.status({ text: s });\n\ncontext.set('counter', counter);\nreturn msg;\n\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set(\"counter\", 0)","finalize":"","libs":[],"x":1040,"y":1640,"wires":[[]]},{"id":"734b1bf305b93e8c","type":"catch","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"All errors","scope":null,"uncaught":false,"x":170,"y":1860,"wires":[["c138f086f072f326"]]},{"id":"fe2a97bef7fedda4","type":"debug","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"debug central http request all errors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":1840,"wires":[]},{"id":"c138f086f072f326","type":"function","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"Time + Fehlermeldung","func":"let counter = context.get(\"counter\");\ncounter = counter + 1;\ncontext.set(\"counter\", counter);\n\nlet time = moment().tz(\"Europe/Berlin\").format(\"DD-MM-YYYY HH:mm:ss\");\n\nlet text = \"Fehlerzeitpunkt: \" + time + \" / \" +\n    \"RPI 67\" + \" / \" +\n    \"Flow: System Services\" + \" / \" +\n    \"Fehlermeldung: \" + msg.error.message + \" / \" +\n    \"Fehler ID: \" + msg.error.source.id + \" / \" +\n    \"Fehlertyp: \" + msg.error.source.type + \" / \" +\n    \"Fehlernode: \" + msg.error.source.name + \" / \" +\n    \"Fehlerzähler: \" + msg.error.source.count;\nnode.status({ fill: \"red\", shape: \"dot\", text: text + \" / \" + counter });\n\nreturn{payload:text};","outputs":1,"timeout":"","noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nif (context.get(\"counter\") === undefined) {\n    context.set(\"counter\", 0);\n}","finalize":"","libs":[{"var":"moment","module":"moment"},{"var":"momentTimezone","module":"moment-timezone"}],"x":390,"y":1860,"wires":[["fe2a97bef7fedda4","1bcbad7b51596b08"]]},{"id":"d3640db36fb6a565","type":"inject","z":"b263e6b23d8eb759","g":"b94d609007366f0c","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"2","topic":"wifi","x":190,"y":360,"wires":[["bb594a95da5aee74"]]},{"id":"77e2c0bf1fad2b85","type":"inject","z":"b263e6b23d8eb759","g":"127c97edc66fd64f","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"midnight","x":210,"y":560,"wires":[["1ad7abcae08cbbbb"]]},{"id":"bb594a95da5aee74","type":"link out","z":"b263e6b23d8eb759","g":"b94d609007366f0c","name":"wifi-impuls","mode":"link","links":["9f71a7826bbd845c","7c796989b9e18e78","f37de5b9c6bf69de","1ea996a67bc57b41","37787759de432f82","5c763820bc9c01d7","05c18ead7cc8481b","d03a4af840cf5f38","ed6a02b634854f2c","4a6c80e2afc31fe7","c9619587b1e13e9d","e0b908e42ce04b9a"],"x":395,"y":360,"wires":[]},{"id":"1ad7abcae08cbbbb","type":"link out","z":"b263e6b23d8eb759","g":"127c97edc66fd64f","name":"midnight-impuls","mode":"link","links":["a72d32ca640adc6c","07bc7189dd03565b","903f35796f9b2ecf","3716492a68f7186c","d5b3e711b99718d2","a0e74f943102cf22","4cdd71927c9d79cc","872011fb2da2debe","0d8877a2b8916868","13366ca20fe03f35","2f7bc468b1a41444","670a24ff06f5502a"],"x":395,"y":560,"wires":[]},{"id":"5e6f80a5c869fa91","type":"inject","z":"b263e6b23d8eb759","g":"d72b564df93d24b5","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 01 * * *","once":true,"onceDelay":"2","topic":"firmware","x":210,"y":460,"wires":[["84f41c6a279dda87"]]},{"id":"84f41c6a279dda87","type":"link out","z":"b263e6b23d8eb759","g":"d72b564df93d24b5","name":"firmware-impuls","mode":"link","links":["933b9e49402dec56","12bedb220dff96c4","4a331f80bc47629e","fa7ee377f2e8b724","6b22138869d8db31","e9c1d851a04073ab","865db4ef606d032d","695975c19d605913","3dcce1907ee69853","dca3ecab3336d99d","41d45b645e09ca3c","ef24a0a2f50b63f4"],"x":395,"y":460,"wires":[]},{"id":"25770a19ef9e1974","type":"inject","z":"b263e6b23d8eb759","g":"528348829347db0e","name":"","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":true,"onceDelay":"70","topic":"","payload":"{\"type\":\"minuten-tick\"}","payloadType":"json","x":240,"y":760,"wires":[["fd43e771c5235497"]]},{"id":"fd43e771c5235497","type":"link out","z":"b263e6b23d8eb759","g":"528348829347db0e","name":"central-minuten-tick","mode":"link","links":["08a4a59cb50e33fe","3f01b6e07be4b515","59a3529d627adf43","0b49cb69239fdc6c"],"x":395,"y":760,"wires":[]},{"id":"ba92c0aa27ceef02","type":"inject","z":"b263e6b23d8eb759","g":"9299e0dd8f240a0f","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"{\"type\":\"sec-tick\"}","payloadType":"json","x":230,"y":660,"wires":[["a67c763711582657"]]},{"id":"a67c763711582657","type":"link out","z":"b263e6b23d8eb759","g":"9299e0dd8f240a0f","name":"central- sec-tick","mode":"link","links":["20f70f1f718d9da8","224234e628a6377e","35c42107fc2bed96","3ce22b69c24f73cd","5895a5aee192bb9b","6e58c6b0731ee429","714eccfcd7c886d5","97caa6e3496ddbf2","a096dcfe86f0d4c9","b553ea67c5080d15","c0773a796d6b53b6","c22cb9c519534951","c8dc097532e0e48e","c9ebcb1ea7fa5ec3","fc4c83408d322b06","fcb1a36e8862b717","b870f093b3bf1b3a"],"x":395,"y":660,"wires":[]},{"id":"faad0d73ecc766ce","type":"delay","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"","pauseType":"delay","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":430,"y":1320,"wires":[["5d5e9bb1f0c15b1d"]]},{"id":"5d5e9bb1f0c15b1d","type":"function","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"function 6","func":"let t = date_time_string() + \" | \" + \"mqtt-gate open\";\nglobal.set('mqtt-gate', \"open\");\nnode.status({ text : t });\nreturn msg;\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":1320,"wires":[[]]},{"id":"b1bbe9e9cb74e870","type":"function","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"function 7","func":"let t = date_time_string() + \" | \" + \"mqtt-gate closed\";\n// global.set('mqtt-gate', \"closed\");\nnode.status({ text : t });\nreturn msg;\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n\nglobal.set('mqtt-gate', \"closed\");","finalize":"","libs":[],"x":260,"y":1320,"wires":[["faad0d73ecc766ce"]]},{"id":"410808df5aa5ea71","type":"link in","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"link in 124","links":["925444abfd4bac79"],"x":115,"y":1320,"wires":[["b1bbe9e9cb74e870"]]},{"id":"d3422b90f8530fb4","type":"link in","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","name":"Telegram out","links":["c8d18d8c6b7db18b","e7ab0af7ca3e0907","6df3362876e00423","94cb739fe13fa005","1bcbad7b51596b08","de41e1a985c80387","63b6c264a5b52d13","cba985fa7f1e9b6c","25a71c6cb1d9d113","fcb4471ae45a688e"],"x":125,"y":2020,"wires":[["331e55c6bd666f1f"]]},{"id":"331e55c6bd666f1f","type":"mqtt out","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","name":"","topic":"send-to-Telegram","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"dedee2f82d127c47","x":360,"y":2020,"wires":[]},{"id":"f806f2a06355e854","type":"function","z":"b263e6b23d8eb759","g":"72aef3ef94af81bb","name":"global variables","func":"","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\n\nglobal.set('kWh_cost', 0.3488);","finalize":"","libs":[],"x":520,"y":100,"wires":[[]]},{"id":"1bcbad7b51596b08","type":"link out","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"link out 164","mode":"link","links":["d3422b90f8530fb4"],"x":585,"y":1900,"wires":[]},{"id":"dedee2f82d127c47","type":"mqtt-broker","name":"Home MQTT Server","broker":"10.0.0.43","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]
1 Like

information regarding the library:
the library function seems to be a nice feature to reduce total programm size. Unforunately the functions within the library can not handle many calls that occur nearly at the same time. Therefore
I had to put time critical functions back to the flows.

Looking at an example in your function library:

context.global.rel_pressure = function runtime_str(pressure, hight) {
    const x = 1 - (hight / 44330);    // hight[m] above sealevel
    const y = 5.255;
    return (parseFloat(pressure / Math.pow(x, y)).toFixed(1));
}

How do you call this from another flow?

let p_rel = context.global.rel_pressure(980, 482);
482 = hight in meter

OK, that works thanks :grinning:

But what is this context.global.rel_pressure? It does not show up in the list of global context variables.

I think this is a context of node-red where they store the library and not a context of a function node

1 Like

Is it possible to call context.global.rel_pressure() from a change node?

You can store functions in a global/flow context variable;

function helloWorld(){
    return 'Hello World'
}

global.set("myCustomFunction",helloWorld)

which you can call from any function node like;

const h = global.get("myCustomFunction")

node.warn(h()) // "Hello World"
1 Like

Yes @juntiedt has explained, slightly differently, how to call such a function from a function node.

What I asked though was if there is a way to call it from a change node.
(eg using the "global...." output type)

Perhaps I should explain why I ask.

There has been some discussion around formatting numbers for Dashboard 2, equivalent to the mustache feature of Dashboard 1 {{ payload | number:2 }} °C

The "approved" way to format like that is to use a (not ui_) template node, but it cannot achieve the rounding to 2 places. The work-around is Jsonata in a change node.

You can define a function

context.global.formatnumber = function runtime_str(number, dp, prefix, suffix)
{
    return (prefix + number.toFixed(dp) + suffix);
}

and call it from a function node as

msg.payload = context.global.formatnumber(input, 2, "£ ", " million");

If this global function could be accessed from a change node, or even a template, it would permit the value formatting without Jsonata.

You can if you use a JSONata expression (I used flow context rather than global)

$flowContext('formatLabel')(payload,  2, "£ ", ' million')
 [{"id":"a7916d0894793fe5","type":"function","z":"fe7296cf2a5f7fba","name":"Set Flow Variable","func":"const input = msg.payload\n\nflow.set('formatLabel', runtime_str)\n\nmsg.payload = flow.get('formatLabel')(input, 2, \"£ \", \" million\")\n\nreturn msg\n\nfunction runtime_str(number, dp, prefix, suffix) {\n\n    return (prefix + number.toFixed(dp) + suffix)\n\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1510,"y":180,"wires":[["0bdc43bf5be7e327"]]},{"id":"3ed0382899737c33","type":"inject","z":"fe7296cf2a5f7fba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":1270,"y":180,"wires":[["a7916d0894793fe5","e2644336265bfd9e"]]},{"id":"0bdc43bf5be7e327","type":"debug","z":"fe7296cf2a5f7fba","name":"Format Label","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1750,"y":240,"wires":[]},{"id":"e2644336265bfd9e","type":"change","z":"fe7296cf2a5f7fba","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$flowContext('formatLabel')(payload,  2, \"£ \", ' million')","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1500,"y":240,"wires":[["0bdc43bf5be7e327"]]}]

Edit: - Sorry just realised that this was all covered in another thread ( Suffix for text output)

That looks promising thanks @Buckskin. Only now there are three different syntaxes to define the function; I need to try and work out if they are actually different or just rewording.

.
Well I was reading that thread and I recalled @juntiedt's functions in global context, which is why I came here and asked. (Actually, there I felt like a kid sticking my hand up and being ignored by all the grownups, I'm thoroughly out of my depth)

I think Steve is suggesting this syntax could be made to work within the dashboard widget itself.

Your suggestion of
$globalContext('formatLabel')(payload, 2, "£ ", ' million')
is slightly less cryptic (no squiggly brackets) and it already works in a change node so no need to modify the dashboard code.
It has the advantage over doing the formatting entirely in Jsonata $formatNumber() that the function is declared once and can be used in many places.
The downside is you need the extra change node.

Don’t forget, if you do that then global context HAS to be in memory, as functions are non-serialisable, which is why we do not encourage that pattern.

1 Like

Out of curiosity, what would you suggest?

I think I'm not the only one, dealing with functions/classes reusability issue.

I've tried passing functions via global.context, but only recently started storing them into a single function.

I've tried creating a subflow with all functions, call it before the function node I need and pass function via message.

There is module export possibility, but haven't tested it.

@KarolisL since this is a low code platform I would suggest the low code approach with a smidge of functional programming purity...

Put each reusable function into single function node with a link-in to the left and a link-out-return on the right and use link-call to call than graphically. You can store these on their own tab (e.g. "My Subroutines")

The general approach should be to create pure like functions.
You can look up the meaning of "pure" but it is essentially that it should always produce the same output for the same input and have no side effects (doesn't modify external state).
This will help you create super portable and reusable code functions. Even if you don't quite understand what it means, you will at some point realise the benefits of this approach.

Some of the benefits are: portability, can be combined easily to create complex logic, suitable for concurrent execution.

2 Likes

I agree completely. I am using this method since long for my central HTTP-request.
The reason doing it was that I had to many http-request on one RPI causing network traffic jam. The link call solved the problem.

1 Like

Don't want to hijack this topic, but did you mean something like this?

[{"id":"b769cfec2072262d","type":"function","z":"0e97ec53d28db263","name":"function select","func":"if(msg.topic === \"sum\") {\n    msg.target = \"sum_in\"\n    msg.initVal = msg.payload\n    return msg \n}\nif(msg.topic === \"sub\") {\n    msg.target = \"sub_in\"\n    msg.initVal = msg.payload\n    return msg\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":120,"wires":[["54b3d8717820e613"]]},{"id":"8dba519f3151e26f","type":"inject","z":"0e97ec53d28db263","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sum","payload":"{\"a\":1,\"b\":2}","payloadType":"json","x":200,"y":120,"wires":[["b769cfec2072262d"]]},{"id":"54b3d8717820e613","type":"link call","z":"0e97ec53d28db263","name":"","links":[],"linkType":"dynamic","timeout":"0","x":620,"y":120,"wires":[[]]},{"id":"f53ee7e0e9b05a08","type":"link in","z":"0e97ec53d28db263","name":"link in 17","links":["b086889fdf96c9d9","b10f92ac62580d2a"],"x":525,"y":260,"wires":[["48a59c35271e6919"]]},{"id":"48a59c35271e6919","type":"debug","z":"0e97ec53d28db263","name":"Result","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":260,"wires":[]},{"id":"60928207ceeed57b","type":"inject","z":"0e97ec53d28db263","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sub","payload":"{\"a\":4,\"b\":2}","payloadType":"json","x":200,"y":180,"wires":[["b769cfec2072262d"]]},{"id":"879ff65f5cfcce79","type":"inject","z":"0e97ec53d28db263","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"mul","payload":"{\"a\":4,\"b\":2}","payloadType":"json","x":200,"y":220,"wires":[["b769cfec2072262d"]]},{"id":"a63b81e39db847f2","type":"group","z":"0e97ec53d28db263","name":"Global Functions","style":{"label":true},"nodes":["6fb185906f4d02bf","80d0db05830da08f","49bf5c8e16c3ad0e","2bc59a725baf99ad","b086889fdf96c9d9","b10f92ac62580d2a"],"x":1204,"y":99,"w":342,"h":122},{"id":"6fb185906f4d02bf","type":"function","z":"0e97ec53d28db263","g":"a63b81e39db847f2","name":"sum","func":"const a = msg.payload.a\nconst b = msg.payload.b\n\nfunction sum(a,b){\n    return a+b\n}\n\nmsg.payload = sum(a,b)\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1390,"y":140,"wires":[["b10f92ac62580d2a"]]},{"id":"80d0db05830da08f","type":"function","z":"0e97ec53d28db263","g":"a63b81e39db847f2","name":"sub","func":"const a = msg.payload.a\nconst b = msg.payload.b\n\nfunction sub(a,b){\n    return a-b\n}\n\nmsg.payload = sub(a,b)\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1390,"y":180,"wires":[["b086889fdf96c9d9"]]},{"id":"49bf5c8e16c3ad0e","type":"link in","z":"0e97ec53d28db263","g":"a63b81e39db847f2","name":"sum_in","links":[],"x":1245,"y":140,"wires":[["6fb185906f4d02bf"]]},{"id":"2bc59a725baf99ad","type":"link in","z":"0e97ec53d28db263","g":"a63b81e39db847f2","name":"sub_in","links":[],"x":1245,"y":180,"wires":[["80d0db05830da08f"]]},{"id":"b086889fdf96c9d9","type":"link out","z":"0e97ec53d28db263","g":"a63b81e39db847f2","name":"sub_out","mode":"link","links":["f53ee7e0e9b05a08"],"x":1505,"y":180,"wires":[]},{"id":"b10f92ac62580d2a","type":"link out","z":"0e97ec53d28db263","g":"a63b81e39db847f2","name":"sum_out","mode":"link","links":["f53ee7e0e9b05a08"],"x":1505,"y":140,"wires":[]}]

What is the purpose of timeout? Is it possible to get rid of error in debug window?
image

Close.

Also, you don't need the function. Just set target in the inject node.

1 Like

little update to my first flow:

  • I am still keeping my global library but only for conversions like feet to meter etc. but for bigger functions it does not make sense as it can not handle concurrent calls

i have added a function to handle shelly actions in Node-Red.

[{"id":"b263e6b23d8eb759","type":"tab","label":"Sytem Services","disabled":false,"info":"","env":[]},{"id":"822527725c7dc5b4","type":"group","z":"b263e6b23d8eb759","name":"System Services","style":{"stroke":"#a4a4a4","label":true,"fill":"#ffefbf","fill-opacity":"0.18"},"nodes":["22f1b275fb4fa70a","d93a61053c3c1138","513342ae16ee393e","26c9933b5069f369","0ee6bc8cb3276b06","fa5af2fb16e3ed48"],"x":74,"y":1551.5,"w":392,"h":297},{"id":"7d08e4b88b4a3571","type":"group","z":"b263e6b23d8eb759","name":"common conversions","style":{"fill":"#ffdf7f","fill-opacity":"0.18","label":true,"stroke":"#001f60"},"nodes":["3be6b85ac0c23e23"],"x":314,"y":39,"w":212,"h":82},{"id":"d164d05ea4dd9645","type":"group","z":"b263e6b23d8eb759","name":"Cron","style":{"label":true,"fill":"#d1d1d1","fill-opacity":"0.18"},"nodes":["f302da7022f63a58","b94d609007366f0c","127c97edc66fd64f","528348829347db0e","9299e0dd8f240a0f"],"x":68,"y":153,"w":394,"h":534},{"id":"ea1db47bb61d9273","type":"group","z":"b263e6b23d8eb759","name":"central http-request","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["d59a2325dd14c795","e68047ac842dec83","94280fbadd4967bf","5ab34b4781bc1caf","f329bb9bfb89d858","4d93b4cd3269cad2","85abc99c6ccb2211"],"x":74,"y":719,"w":1062,"h":202},{"id":"0c7c436f8a5cc097","type":"group","z":"b263e6b23d8eb759","name":"error handling","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["734b1bf305b93e8c","fe2a97bef7fedda4","c138f086f072f326","1bcbad7b51596b08","40642fa670030eb6"],"x":74,"y":1879,"w":932,"h":142},{"id":"9c8b492f1fc2d348","type":"group","z":"b263e6b23d8eb759","name":"mqtt-gate","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["faad0d73ecc766ce","5d5e9bb1f0c15b1d","b1bbe9e9cb74e870","410808df5aa5ea71"],"x":74,"y":1119,"w":632,"h":82},{"id":"3dcd10e3f8ad3578","type":"group","z":"b263e6b23d8eb759","name":"Mesage to Telegram","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["d3422b90f8530fb4","331e55c6bd666f1f","79cdbdde62581996","d2d3b354f8038248","1069b10617e096a2"],"x":74,"y":1239,"w":632,"h":122},{"id":"72aef3ef94af81bb","type":"group","z":"b263e6b23d8eb759","name":"gobal variables","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"stroke":"#ff0000"},"nodes":["f806f2a06355e854"],"x":74,"y":39,"w":212,"h":82},{"id":"8e54367eeaadb373","type":"group","z":"b263e6b23d8eb759","name":"e-mail out to mobile phone","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["ad4d925afcfcf69f","ed3ca0bda2e6ceaa","bec28a92.4b07f8","8f34cc33912c64f1","7c91d7349c82db25"],"x":74,"y":1399,"w":612,"h":122},{"id":"02fe5f91cc8b1c27","type":"group","z":"b263e6b23d8eb759","name":"http input  (e.g. shelly actions)","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["f53e21995a2c8d7d","92a9806a1d733d62","0c8ff62e202e7bcf","b8a0822ddfac9a0b","147d36e0d3e01835","28de2706d6486276","a985091ef02516db"],"x":74,"y":959,"w":802,"h":122},{"id":"f302da7022f63a58","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"Initialisation Impuls","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"color":"#777777","stroke":"#92d04f"},"nodes":["02bd72daa36044e5","925444abfd4bac79"],"x":94,"y":179,"w":342,"h":82},{"id":"b94d609007366f0c","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"wifi impuls","style":{"stroke":"#92d04f","label":true,"fill":"#ffefbf","fill-opacity":"0.18"},"nodes":["d3640db36fb6a565","bb594a95da5aee74"],"x":94,"y":579,"w":342,"h":82},{"id":"127c97edc66fd64f","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"midnight-impuls","style":{"stroke":"#92d04f","fill":"#ffefbf","fill-opacity":"0.18","label":true},"nodes":["77e2c0bf1fad2b85","1ad7abcae08cbbbb"],"x":94,"y":479,"w":342,"h":82},{"id":"528348829347db0e","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"tick every minute","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"stroke":"#92d04f"},"nodes":["25770a19ef9e1974","fd43e771c5235497"],"x":104,"y":379,"w":332,"h":82},{"id":"9299e0dd8f240a0f","type":"group","z":"b263e6b23d8eb759","g":"d164d05ea4dd9645","name":"tick every second","style":{"fill":"#ffefbf","fill-opacity":"0.18","label":true,"stroke":"#92d04f"},"nodes":["ba92c0aa27ceef02","a67c763711582657"],"x":94,"y":279,"w":342,"h":82},{"id":"1069b10617e096a2","type":"junction","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","x":260,"y":1320,"wires":[["d2d3b354f8038248"]]},{"id":"8f34cc33912c64f1","type":"junction","z":"b263e6b23d8eb759","g":"8e54367eeaadb373","x":240,"y":1480,"wires":[["7c91d7349c82db25"]]},{"id":"22f1b275fb4fa70a","type":"exec","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","command":"sudo ip link set wlan0 down && sleep 1 && sudo ip link set wlan0 up","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"wifi reconnect","x":360,"y":1800,"wires":[[],[],[]]},{"id":"d93a61053c3c1138","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1800,"wires":[["22f1b275fb4fa70a"]]},{"id":"513342ae16ee393e","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1700,"wires":[["26c9933b5069f369"]]},{"id":"26c9933b5069f369","type":"exec","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","command":"node-red-restart","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":360,"y":1700,"wires":[[],[],[]]},{"id":"0ee6bc8cb3276b06","type":"exec","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","command":"sudo reboot","addpay":"","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":350,"y":1600,"wires":[[],[],[]]},{"id":"fa5af2fb16e3ed48","type":"inject","z":"b263e6b23d8eb759","g":"822527725c7dc5b4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":1600,"wires":[["0ee6bc8cb3276b06"]]},{"id":"3be6b85ac0c23e23","type":"function","z":"b263e6b23d8eb759","g":"7d08e4b88b4a3571","name":"function library","func":"","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.rel_pressure = function runtime_str(pressure, hight) {\n    const x = 1 - (hight / 44330);    // hight[m] above sealevel\n    const y = 5.255;\n    return (parseFloat(pressure / Math.pow(x, y)).toFixed(1));\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.F_to_C = function (fahrenheit) {\n    return (fahrenheit - 32) / 1.8;\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.C_to_F = function (celsius) {\n    return (celsius * 1.8) + 32;\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.meter_to_foot = function (meter) {\n    return (meter / 0.3048);\n}\n\n//----------------------------------------------------------------------------------------------\n\ncontext.global.foot_to_meter = function (foot) {\n    return (foot * 0.3048);\n}\n\n//----------------------------------------------------------------------------------------------","finalize":"","libs":[],"x":420,"y":80,"wires":[[]]},{"id":"02bd72daa36044e5","type":"inject","z":"b263e6b23d8eb759","g":"f302da7022f63a58","name":"init-impuls","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"init","payload":"{\"type\":\"init\"}","payloadType":"json","x":210,"y":220,"wires":[["925444abfd4bac79"]]},{"id":"925444abfd4bac79","type":"link out","z":"b263e6b23d8eb759","g":"f302da7022f63a58","name":"initialisation impuls","mode":"link","links":["410808df5aa5ea71","4535321d5ac7afad","4d280360e96d1b6f","601c85cc20901aa3","7da701bd32447e29","893f40ab45e25511","8a7a5622ca9c940a","eb8c408dca42ad27","818b63d2510315f2","ea46a534711a552a","12f1db13aeea38c9","4329b7020cf72ae1","5182b50debf46c74","25d7f4ee368252e8","155fab0ec5af156d","68bda73c96744e98","a68077d259965bb6","5a0c289234776f11","078082063d671ecf","73b18f3bca1efa48","9226aa18eb5e3535","ae2d7af0ef99485d","4b5107db1e351155","07d809b239c61e58","e9ab4d54ae75a653","3fae8fc630e95ee9","8cf7b41b89c48c7c","b86684148ada6852","41a98f43fc6c6f4f","bb2faf142befc2ed","54ebd125102778b4","05f9ae38c167beb0","600448e3b153f7f7","c7e0ca04523b56a6","16bb32c6760494da","07cedb0f5b8acdc6","f698d9b4806737d1","27046c1a496b7e81","9ce9e1f1f17d52e3","961fa2f2c59b078d","897e4dacaeda613d","71a0116da0db801b","23181225b4218829","45c7953b0bd921c9","7915bab4a60d9085","7062a02f98525d7a","8a885434833df553","5906aee814e30cf1","0cbeedb434b16b5a","82c532ebb9bcd99d","46cc34a88df7f330","eb8d49ba577c5177","271676afd3d04508","99459b56c69e5c30","5bc0afaa1f2ade46","2c5c2d47c289873f","01b47617538b16a0","5bc4dd36f563faeb","49d8330268fd8a0b","13a8cae1e75dea45","5991ee36cf0fb78a","1c25d6b0ccbba31f","4999a307d56a1770","65764a1c76f9684e","0b0b997145c5e763","4e8b0edc5d5f9767","92e346d35f52ef89","1d956146892c0156","09f94bc2641d7ca9","9b4fe309cb784b56","6c8e0a063554dc0c","6aff86f2d507448b","2434f5312d62c125","1b34345069ee2fd2","3a06382c275ce8bf","b5c040acbb13bb9c","6a3663833e84db83","30a28bc917f57a36","e1e2794099f18d2c","003f75ee9d3497c4","1ea5a03d5c92646b","6831ca54e2bda016","bb1e37122c56bb01","ec3553fdd9bf0730","639a698daa5835aa","bbb2b403980bbad0","3bb94cb95dc376cb","2692fffd40e8d70b","25ba37a1cc2ed17c","2e98c154e89671ac","45a2b799c7dbefd5","1aeedb24557b748f","49c7e37610a50cad","cfc18f576b42aa0d","222b5d6a9abc9e99","063510d8dd1d2ae3","05af5326ed570995","34ea4dc0053e3f3f","b78077e1c4480a45","94f65e7412e4557e","3aab174c78bfe726","ee247deff33a80ea","ad1d55621829d2ce","f1700deedfb630ec","d50eab88628bc86d","6cafa8c1bec4d7d4","fe9deb780904815e","094c1d5b98035a36","23079af2dcd879fe","3934ccb8e21bbb97","a36e520317cd943f","698d56fe0ee01d2c","4d26936cc3216adf","ef8952893a593cca","5f2a46191578a68e","9a62a23f29df70c1","71d891868d913ab4","ab7c32bbd2298c5d","3c38a8247364d5e0","3cf7faa9c9e51e90","f60de1861c7a3c47"],"x":395,"y":220,"wires":[]},{"id":"d59a2325dd14c795","type":"link in","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"http-request-in","links":["7425a2432b92bb18"],"x":115,"y":820,"wires":[["5ab34b4781bc1caf"]]},{"id":"e68047ac842dec83","type":"http request","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"central HTTP request","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":640,"y":820,"wires":[["f329bb9bfb89d858"]]},{"id":"94280fbadd4967bf","type":"link out","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"http-request-out","mode":"return","links":[],"x":985,"y":820,"wires":[]},{"id":"5ab34b4781bc1caf","type":"function","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"requestTimeout","func":"const to = 20000;               // request timeout in ms\nconst z = date_time_string();\n\nlet counter = context.get('counter') + 1;\nlet s = counter + \" | \" + z + \" | \" + msg.url + \" | \" + to + \"ms\";\nnode.status({ text: s });\ncontext.set('counter', counter);\nmsg.requestTimeout = to;\nreturn msg;\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    return (hours + ':' + minutes + ':' + seconds);\n}","outputs":1,"timeout":"","noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set(\"counter\", 0)\n","finalize":"","libs":[],"x":280,"y":820,"wires":[["e68047ac842dec83"]]},{"id":"f329bb9bfb89d858","type":"switch","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":830,"y":820,"wires":[["94280fbadd4967bf","4d93b4cd3269cad2"],["85abc99c6ccb2211"]]},{"id":"4d93b4cd3269cad2","type":"function","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"request ok","func":"const z = date_time_string();\nlet counter = context.get('counter') + 1;\n\nlet url = msg.responseUrl;\nlet status = msg.statusCode;\nlet s = counter + \" | \" + z + \" | \" + msg.url + \" | \" + \"StatusCode \" + msg.statusCode;\nnode.status({ text: s });\n\ncontext.set('counter', counter);\nreturn msg;\n\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    return (hours + ':' + minutes + ':' + seconds);\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set(\"counter\", 0)","finalize":"","libs":[],"x":1040,"y":760,"wires":[[]]},{"id":"85abc99c6ccb2211","type":"function","z":"b263e6b23d8eb759","g":"ea1db47bb61d9273","name":"request error","func":"const z = date_time_string();\nlet counter = context.get('counter') + 1;\n\nlet url = msg.responseUrl;\nlet status = msg.statusCode;\nlet s = counter + \" | \" + z + \" | \" + msg.url + \" | \" + \"StatusCode \" + msg.statusCode;\nnode.status({ text: s });\n\ncontext.set('counter', counter);\nreturn msg;\n\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    return (hours + ':' + minutes + ':' + seconds);\n}","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set(\"counter\", 0)","finalize":"","libs":[],"x":1040,"y":880,"wires":[[]]},{"id":"734b1bf305b93e8c","type":"catch","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"All errors","scope":null,"uncaught":false,"x":300,"y":1940,"wires":[["c138f086f072f326"]]},{"id":"fe2a97bef7fedda4","type":"debug","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"debug central http request all errors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":1960,"wires":[]},{"id":"c138f086f072f326","type":"function","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"Time + Fehlermeldung","func":"if (msg.payload.type === \"reset\"){\n    node.status({ fill: \"green\", shape: \"dot\", text: \" \" });\n    return null;\n}\n\nlet counter = context.get(\"counter\");\ncounter = counter + 1;\ncontext.set(\"counter\", counter);\n\nlet time = moment().tz(\"Europe/Berlin\").format(\"DD-MM-YYYY HH:mm:ss\");\n\nlet text = \"Fehlerzeitpunkt: \" + time + \" / \" +\n    \"RPI 67\" + \" / \" +\n    \"Flow: System Services\" + \" / \" +\n    \"Fehlermeldung: \" + msg.error.message + \" / \" +\n    \"Fehler ID: \" + msg.error.source.id + \" / \" +\n    \"Fehlertyp: \" + msg.error.source.type + \" / \" +\n    \"Fehlernode: \" + msg.error.source.name + \" / \" +\n    \"Fehlerzähler: \" + msg.error.source.count;\nnode.status({ fill: \"red\", shape: \"dot\", text: text + \" / \" + counter });\n\nreturn{payload:text};","outputs":1,"timeout":"","noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nif (context.get(\"counter\") === undefined) {\n    context.set(\"counter\", 0);\n}","finalize":"","libs":[{"var":"moment","module":"moment"},{"var":"momentTimezone","module":"moment-timezone"}],"x":520,"y":1960,"wires":[["fe2a97bef7fedda4","1bcbad7b51596b08"]]},{"id":"d3640db36fb6a565","type":"inject","z":"b263e6b23d8eb759","g":"b94d609007366f0c","name":"wifi- & firmwarecheck","props":[{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"5","topic":"wifi","x":240,"y":620,"wires":[["bb594a95da5aee74"]]},{"id":"77e2c0bf1fad2b85","type":"inject","z":"b263e6b23d8eb759","g":"127c97edc66fd64f","name":"midnight-tick","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"midnight","payload":"{\"type\":\"midnight\"}","payloadType":"str","x":220,"y":520,"wires":[["1ad7abcae08cbbbb"]]},{"id":"bb594a95da5aee74","type":"link out","z":"b263e6b23d8eb759","g":"b94d609007366f0c","name":"wifi-impuls","mode":"link","links":["94bf2e117566c05f","a92204ec6c587498","c0741c47ad14edad","89fc74c3cec221a5","3925709a42c26442","ce8c2dd7f12dbcd5","f04823fac028f551","f6ce71d15db7a3c6","4c76222295d122e9","52c9d9f555e2ef1f","80c107e0585c39ff","a8c47175102ed27d","3551220c21f6ef23","ec3cc9263e7785b6","909b225fa46e9277","109aaffffa1d1900","59d66713869418eb"],"x":395,"y":620,"wires":[]},{"id":"1ad7abcae08cbbbb","type":"link out","z":"b263e6b23d8eb759","g":"127c97edc66fd64f","name":"midnight-impuls","mode":"link","links":["4535321d5ac7afad","601c85cc20901aa3","893f40ab45e25511","818b63d2510315f2","12f1db13aeea38c9","9b4fe309cb784b56","6aff86f2d507448b","1b34345069ee2fd2","b5c040acbb13bb9c","bbb2b403980bbad0","49c7e37610a50cad","063510d8dd1d2ae3","b78077e1c4480a45","ee247deff33a80ea","698d56fe0ee01d2c"],"x":395,"y":520,"wires":[]},{"id":"faad0d73ecc766ce","type":"delay","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":430,"y":1160,"wires":[["5d5e9bb1f0c15b1d"]]},{"id":"5d5e9bb1f0c15b1d","type":"function","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"function 6","func":"let t = date_time_string() + \" | \" + \"mqtt-gate open\";\nglobal.set('mqtt-gate', \"open\");\nnode.status({ text : t });\nreturn msg;\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":1160,"wires":[[]]},{"id":"b1bbe9e9cb74e870","type":"function","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"function 7","func":"let t = date_time_string() + \" | \" + \"mqtt-gate closed\";\n// global.set('mqtt-gate', \"closed\");\nnode.status({ text : t });\nreturn msg;\n\n//--------------------------------------------------------------------\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    const year = date.getFullYear();\n    const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n    let datetimestring = hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n\nglobal.set('mqtt-gate', \"closed\");","finalize":"","libs":[],"x":240,"y":1160,"wires":[["faad0d73ecc766ce"]]},{"id":"410808df5aa5ea71","type":"link in","z":"b263e6b23d8eb759","g":"9c8b492f1fc2d348","name":"link in 124","links":["925444abfd4bac79"],"x":115,"y":1160,"wires":[["b1bbe9e9cb74e870"]]},{"id":"d3422b90f8530fb4","type":"link in","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","name":"Telegram out","links":["08376bf0db754c41","0851f8f868c26fbf","1bcbad7b51596b08","318b5c9cbdc75dbf","6c7d09e66750349e","7051d17d70ee0ea9","80da20e6bb04f0b4","b15cc112494231c0","f7086a7a31b257f4","52b46a9915b09f8e","bfc1bb3d7f6c3b3e","4c1efe24c7804fc6","9f4c8be524be7b0c","a9679676c5a6f06f","0a60ef89a8d8167a","48f0187bbee26b83","17c9c4f526e1839a","ba4f030819b25f21","dce1ece09bc54c61","002499d1b45f2d28","7ea17b748d1eb570","d11fe13ab3e65d5e","973c5c699fc727b6","01218c27732c3386","73ae97931144c728","66f55b5f1bdbe581","693048924cd2a4bb","7823adab41c99492","d4f24f402cf5311a","8e2d189064e9f266","f768312d3ddc277b","f6ef2e54d8de2e9b","8cc8e51d6d87d555","5371b963954ab1ec","563b54aaa21cff64","fe660c1893a8dbd5","290dfc34ed974a55","2089a38a54cc0001","7e8cace0ce18b53a","f861be59f62122ab","ab5075e61e517cc7","1f5a392b2e215cda","d9c46de7bd977ba5","b4ca400ad4939f99","c1517344ff8f55ce","279d7f1d250569e2","dd961c534debb65f","7bdf13972ab555a1","a31d0036051de729","60da257e5568be94","e9030cbc1a047fbe","037656c491854ab2","14f8cb334dd669d9","f102f2db95e0ffe5","bf034f18a23829cb","1bac03886c9d9cd1","fd9019bcb5efeebd","7dc1b494b483a662","b4acd86c23812bee","0c16e8193973e681","85bb6d2f9794a0aa","326bc6409d9cce55","bf427b8c6da3b48c","40601679ac1e9855","d2cb53ebda70260d","49428fc4f50739c8","83652a700647fa12","104c7d1af3d79c79","9ac4a7de4c6301df"],"x":115,"y":1320,"wires":[["1069b10617e096a2"]]},{"id":"331e55c6bd666f1f","type":"mqtt out","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","name":"","topic":"send-to-Telegram-Server","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"99603ece.52e2a","x":570,"y":1300,"wires":[]},{"id":"f806f2a06355e854","type":"function","z":"b263e6b23d8eb759","g":"72aef3ef94af81bb","name":"global variables","func":"","outputs":1,"timeout":0,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\n\nglobal.set('runtime_start', Date.now());\nglobal.set('kWh_cost', 0.3488);\n","finalize":"","libs":[],"x":180,"y":80,"wires":[[]]},{"id":"1bcbad7b51596b08","type":"link out","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"link out 164","mode":"link","links":["d3422b90f8530fb4"],"x":695,"y":1920,"wires":[]},{"id":"25770a19ef9e1974","type":"inject","z":"b263e6b23d8eb759","g":"528348829347db0e","name":"minuten-tick","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":true,"onceDelay":"20","topic":"","payload":"{\"type\":\"minuten-tick\"}","payloadType":"json","x":220,"y":420,"wires":[["fd43e771c5235497"]]},{"id":"fd43e771c5235497","type":"link out","z":"b263e6b23d8eb759","g":"528348829347db0e","name":"central-minuten-tick","mode":"link","links":["2bcebb46112cb60c","60382665d63a0740","99b33d083807a7d2","9d2bec3492bc094a","61fe135bd9228b32","bf1f490a13d24539","13a8cae1e75dea45","4999a307d56a1770","4e8b0edc5d5f9767","5e9f91abdd36c4ab","763cbc89b333b6e3","248c940f3566bc9f","5b587dd20344997d","6a3663833e84db83","0594e5b4e7d6a5b3","003f75ee9d3497c4","a3f4cbe745afce88","ed7165717dbcb2c7","ef886d473692a216","9af4978c69bfdec0","fa1ffaa482676040","3934ccb8e21bbb97","2c924ebc69355e17"],"x":395,"y":420,"wires":[]},{"id":"ba92c0aa27ceef02","type":"inject","z":"b263e6b23d8eb759","g":"9299e0dd8f240a0f","name":"sec-tick","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"{\"type\":\"sec-tick\"}","payloadType":"json","x":200,"y":320,"wires":[["a67c763711582657"]]},{"id":"a67c763711582657","type":"link out","z":"b263e6b23d8eb759","g":"9299e0dd8f240a0f","name":"central- sec-tick","mode":"link","links":["4535321d5ac7afad","601c85cc20901aa3","893f40ab45e25511","818b63d2510315f2","12f1db13aeea38c9","1c25d6b0ccbba31f","0b0b997145c5e763","1d956146892c0156","9b4fe309cb784b56","6aff86f2d507448b","1b34345069ee2fd2","b5c040acbb13bb9c","e1e2794099f18d2c","bbb2b403980bbad0","49c7e37610a50cad","063510d8dd1d2ae3","b78077e1c4480a45","ee247deff33a80ea","698d56fe0ee01d2c"],"x":395,"y":320,"wires":[]},{"id":"ed3ca0bda2e6ceaa","type":"link in","z":"b263e6b23d8eb759","g":"8e54367eeaadb373","name":"e-mail out","links":[],"x":115,"y":1480,"wires":[["8f34cc33912c64f1"]]},{"id":"bec28a92.4b07f8","type":"inject","z":"b263e6b23d8eb759","g":"8e54367eeaadb373","name":"Test-e-mail","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Test-email von RPI 206","payloadType":"str","x":180,"y":1440,"wires":[["7c91d7349c82db25"]]},{"id":"40642fa670030eb6","type":"inject","z":"b263e6b23d8eb759","g":"0c7c436f8a5cc097","name":"reset error status message","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"{\"type\":\"reset\"}","payloadType":"json","x":240,"y":1980,"wires":[["c138f086f072f326"]]},{"id":"YYYYYYYYYYYY","type":"e-mail","z":"zzzzzzzzzzzzzzzz","g":"ggggggggggggggggg","server":"smtp.gmail.com","port":"465","authtype":"BASIC","saslformat":true,"token":"oauth2Response.access_token","secure":true,"tls":false,"name":"xxxx.net","dname":"e-mail to mobile phone","x":560,"y":1460,"wires":[]},{"id":"79cdbdde62581996","type":"inject","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","name":"Test-Telegram","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"hallo! Test-Telegram ","payloadType":"str","x":190,"y":1280,"wires":[["d2d3b354f8038248"]]},{"id":"d2d3b354f8038248","type":"function","z":"b263e6b23d8eb759","g":"3dcd10e3f8ad3578","name":"add RPI","func":"msg.payload = \"RPI-206: \" + msg.payload;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":1300,"wires":[["331e55c6bd666f1f"]]},{"id":"7c91d7349c82db25","type":"function","z":"b263e6b23d8eb759","g":"8e54367eeaadb373","name":"add RPI","func":"msg.topic = \"e-mail von RPI 206\"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":1460,"wires":[["ad4d925afcfcf69f"]]},{"id":"f53e21995a2c8d7d","type":"http in","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"output","url":"/output","method":"get","upload":true,"swaggerDoc":"","x":150,"y":1020,"wires":[["147d36e0d3e01835"]]},{"id":"92a9806a1d733d62","type":"http response","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"","statusCode":"200","headers":{},"x":500,"y":1000,"wires":[]},{"id":"0c8ff62e202e7bcf","type":"html","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"","property":"payload","outproperty":"payload","tag":"body","ret":"html","as":"single","chr":"","x":490,"y":1040,"wires":[["b8a0822ddfac9a0b"]]},{"id":"b8a0822ddfac9a0b","type":"function","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"","func":"msg.payload = msg.payload[0];\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":1040,"wires":[["28de2706d6486276"]]},{"id":"147d36e0d3e01835","type":"template","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"shelly page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head></head>\n    <body>\n        {{req.query.s}}\n    </body>\n</html>","x":310,"y":1020,"wires":[["0c8ff62e202e7bcf","92a9806a1d733d62"]]},{"id":"28de2706d6486276","type":"switch","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"shellyplugs_EGTV","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":1040,"wires":[["a985091ef02516db"]]},{"id":"a985091ef02516db","type":"link out","z":"b263e6b23d8eb759","g":"02fe5f91cc8b1c27","name":"http-input","mode":"link","links":["55b56250bf6c0582"],"x":835,"y":1040,"wires":[]},{"id":"99603ece.52e2a","type":"mqtt-broker","broker":"10.0.0.43","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":4,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]

this a sample for a shelly action:

(http://10.0.0.50:1880/output?s=shelly_1pm191:on)