Monitoring shelly plug s

I am checking wifi strength only every 5min.
At midnight I am reading total energy in order to calculate daily consumption.

[{"id":"e3968abdf637a7a9","type":"ui_gauge","z":"cfc6b839afbbeb5d","name":"Computer power","group":"239c22c2.2384ce","order":3,"width":"6","height":"3","gtype":"gage","title":"","label":"Watt","format":"{{value | number:2}}","min":0,"max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":1220,"y":140,"wires":[]},{"id":"5c25436ecf31c535","type":"ui_text","z":"cfc6b839afbbeb5d","group":"239c22c2.2384ce","order":7,"width":"3","height":"1","name":"Computer-temperature","label":"","format":"{{msg.payload}}&nbsp;&deg;C","layout":"row-center","className":"","x":1240,"y":340,"wires":[]},{"id":"857755d80677d047","type":"ui_text","z":"cfc6b839afbbeb5d","group":"239c22c2.2384ce","order":6,"width":"3","height":"1","name":"Computer-stat","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1220,"y":300,"wires":[]},{"id":"de42fd13b1caa64f","type":"ui_chart","z":"cfc6b839afbbeb5d","name":"Computer12h Verlauf","group":"239c22c2.2384ce","order":8,"width":"6","height":"6","label":"12h Verlauf","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"warte auf Daten","dot":false,"ymin":"0","ymax":"200","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#fa9c19","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1240,"y":180,"wires":[[]]},{"id":"a68755d0244284fa","type":"ui_text","z":"cfc6b839afbbeb5d","group":"239c22c2.2384ce","order":1,"width":"5","height":"1","name":"Computer time","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1220,"y":100,"wires":[]},{"id":"1fd9232bd7e0cc32","type":"ui_text","z":"cfc6b839afbbeb5d","group":"239c22c2.2384ce","order":5,"width":"6","height":"1","name":"Computer-energy-total","label":"Gesamt:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1240,"y":220,"wires":[]},{"id":"f56ef6f5e77e3505","type":"mqtt in","z":"cfc6b839afbbeb5d","name":"","topic":"shellies/shellyplug-s-799C45/#","qos":"0","datatype":"utf8","broker":"f5f6599b.7711a8","nl":false,"rap":false,"inputs":0,"x":200,"y":320,"wires":[["b77a0c04834ede8d","ad55c4afed5d49ae"]]},{"id":"7e2ee056cfdc59bb","type":"function","z":"cfc6b839afbbeb5d","name":"shelly plug s Computer","func":"let timestamp = date_time_string();\nnode.status({ text: timestamp });\n\nif (msg.topic === 'wifi') {\n    let wifiin = msg.payload;\n    let wifiout = wifi_out(wifiin);\n    return [wifiout, { payload: timestamp }, null, null, null, null, null, null];\n}\n\nif (msg.topic === 'midnight') {\n    context.set('midnight',msg.payload);\n    return null;\n}\n\nlet power = msg.payload[\"shellies/shellyplug-s-799C45/relay/0/power\"];\nlet totalenergy = parseFloat(msg.payload[\"shellies/shellyplug-s-799C45/relay/0/energy\"]);\nlet dayenergy = (totalenergy - context.get('midnight'));\ntotalenergy = parseFloat((totalenergy/60/1000).toFixed(3));\ndayenergy = parseFloat((dayenergy/60/1000).toFixed(3));\nlet status = msg.payload[\"shellies/shellyplug-s-799C45/relay/0\"];\nstatus = status === 'off' ? '<font color=\"#000000\">off</font>' : '<font color=\"#ff0000\">on</font>'; \nlet temperature = msg.payload[\"shellies/shellyplug-s-799C45/temperature\"];\nlet overtemperature = msg.payload[\"shellies/shellyplug-s-799C45/overtemperature\"];\n\nreturn [\n    null,\n    {payload:timestamp},    \n    {payload:power},\n    {payload:totalenergy},\n    {payload:dayenergy },    \n    {payload:status},\n    {payload:temperature},\n    {payload:overtemperature}\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 = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}\n\n//--------------------------------------------------------------------\n\nfunction wifi_out(wifiin) {\n    let rssi = wifiin;\n    let color;\n    if (rssi < -80) {\n        color = 'red';\n    }\n    else if (rssi < -70) {\n        color = '#FFC300';\n    }\n    else {\n        color = 'green';\n    }\n    rssi = rssi.toString();\n    return ({ \"topic\": rssi, \"payload\": color });\n}\n\n//--------------------------------------------------------------------","outputs":8,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":240,"wires":[["7a7cc8a9b2753f7a"],["a68755d0244284fa"],["de42fd13b1caa64f","e3968abdf637a7a9"],["1fd9232bd7e0cc32"],["414376b343a2bf9a"],["857755d80677d047"],["5c25436ecf31c535","080579be16d42e04"],["482ffb01d13cbeee"]]},{"id":"b77a0c04834ede8d","type":"join","z":"cfc6b839afbbeb5d","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"6","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":690,"y":320,"wires":[["7e2ee056cfdc59bb"]]},{"id":"ad55c4afed5d49ae","type":"trigger","z":"cfc6b839afbbeb5d","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":460,"wires":[["1620e9f0aeecd3a3"]]},{"id":"1620e9f0aeecd3a3","type":"change","z":"cfc6b839afbbeb5d","name":"watchdog Alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s Telefon länger als 10 min offline!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":460,"wires":[["401cf8ae118b6735"]]},{"id":"ae5125a3cc6d2744","type":"inject","z":"cfc6b839afbbeb5d","name":"ervery midnight","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":190,"y":240,"wires":[["1689e8111357776d"]]},{"id":"1689e8111357776d","type":"http request","z":"cfc6b839afbbeb5d","name":"http comp 2","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://10.0.0.162/status/meter","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":370,"y":240,"wires":[["55fd05054728ae1a"]]},{"id":"6fb50f90819445b9","type":"function","z":"cfc6b839afbbeb5d","name":"midnight","func":"let midnight = parseFloat(msg.payload.meters[0].total);\nnode.status({text: midnight});\nreturn { topic: \"midnight\", payload:midnight};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":240,"wires":[["7e2ee056cfdc59bb"]]},{"id":"414376b343a2bf9a","type":"ui_text","z":"cfc6b839afbbeb5d","group":"239c22c2.2384ce","order":4,"width":"6","height":"1","name":"Computer-energy-tag","label":"Tag:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1240,"y":260,"wires":[]},{"id":"3fdbd395646f16f6","type":"inject","z":"cfc6b839afbbeb5d","name":"every 5 min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":170,"y":160,"wires":[["ec506966c5da5589"]]},{"id":"ec506966c5da5589","type":"http request","z":"cfc6b839afbbeb5d","name":"http comp 1","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://10.0.0.162/status","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":370,"y":160,"wires":[["cef00e47e1c14b71"]]},{"id":"3552e31531223543","type":"mqtt out","z":"cfc6b839afbbeb5d","name":"Telegram","topic":"Heizung-Telegram","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"69e1bb0a917095db","x":1600,"y":420,"wires":[]},{"id":"7a7cc8a9b2753f7a","type":"ui_template","z":"cfc6b839afbbeb5d","group":"239c22c2.2384ce","name":"Computer wifi","order":2,"width":"1","height":"1","format":"<div style=\"color:{{msg.payload}}; margin:auto;\" <i class=\"fa fa-wifi fa-1x\" aria-hidden=\"true\"> </i></div>\n<div>\n    <center>\n        <small><small><small>{{msg.topic}}</small></small></small>\n    </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1220,"y":60,"wires":[[]]},{"id":"cef00e47e1c14b71","type":"switch","z":"cfc6b839afbbeb5d","name":"200","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"neq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":160,"wires":[["5376df4f394b2393"],["12afc66c3fc7d39b"]]},{"id":"12afc66c3fc7d39b","type":"change","z":"cfc6b839afbbeb5d","name":"error comp http-request 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s computer: error http-request 1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":200,"wires":[["72d5e2d3f183a76c"]]},{"id":"55fd05054728ae1a","type":"switch","z":"cfc6b839afbbeb5d","name":"200","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"neq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":240,"wires":[["6fb50f90819445b9"],["f9604ed68fddf5bd"]]},{"id":"f9604ed68fddf5bd","type":"change","z":"cfc6b839afbbeb5d","name":"error Comp http-request 2","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s Computer: error http-request 2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":280,"wires":[["a0bb5446b129c503"]]},{"id":"72d5e2d3f183a76c","type":"link out","z":"cfc6b839afbbeb5d","name":"link out 9","mode":"link","links":["ea9a3d5f0e30902f"],"x":605,"y":200,"wires":[]},{"id":"a0bb5446b129c503","type":"link out","z":"cfc6b839afbbeb5d","name":"link out 10","mode":"link","links":["ea9a3d5f0e30902f"],"x":605,"y":280,"wires":[]},{"id":"ea9a3d5f0e30902f","type":"link in","z":"cfc6b839afbbeb5d","name":"telegram out","links":["72d5e2d3f183a76c","a0bb5446b129c503"],"x":1405,"y":340,"wires":[["401cf8ae118b6735"]]},{"id":"482ffb01d13cbeee","type":"function","z":"cfc6b839afbbeb5d","name":"overtemperature","func":"if (msg.payload != 0){\n    msg.payload = \"shelly pulg s Telefon Overtemperature Alarm!\"\n    return msg;\n}\nelse {\n    return { reset: 0 };\n} \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1220,"y":420,"wires":[["6f0e355597d7d848"]]},{"id":"080579be16d42e04","type":"function","z":"cfc6b839afbbeb5d","name":"temp > 60","func":"if (msg.payload > 60){\n    msg.payload = \"shelly plug s Telefon über 60 Grad!\"\n    return msg;\n}\nelse{\n    return{reset:0};\n}   \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":380,"wires":[["4b8e89a6ae7ecd0b"]]},{"id":"4b8e89a6ae7ecd0b","type":"rbe","z":"cfc6b839afbbeb5d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1370,"y":380,"wires":[["401cf8ae118b6735"]]},{"id":"397cf4f94d7491ee","type":"debug","z":"cfc6b839afbbeb5d","name":"debug 36","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1600,"y":380,"wires":[]},{"id":"6f0e355597d7d848","type":"rbe","z":"cfc6b839afbbeb5d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1370,"y":420,"wires":[["401cf8ae118b6735"]]},{"id":"5376df4f394b2393","type":"function","z":"cfc6b839afbbeb5d","name":"wifi","func":"node.status({ text: msg.payload.wifi_sta.rssi});\nreturn { topic: 'wifi', payload: msg.payload.wifi_sta.rssi};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":160,"wires":[["7e2ee056cfdc59bb"]]},{"id":"0e17ee180274f783","type":"junction","z":"cfc6b839afbbeb5d","x":1140,"y":60,"wires":[[]]},{"id":"401cf8ae118b6735","type":"junction","z":"cfc6b839afbbeb5d","x":1480,"y":400,"wires":[["397cf4f94d7491ee","3552e31531223543"]]},{"id":"239c22c2.2384ce","type":"ui_group","name":"UG Computer shelly plug s","tab":"743fd75e.f52cb8","order":13,"disp":true,"width":"6","collapse":false},{"id":"f5f6599b.7711a8","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":""},{"id":"69e1bb0a917095db","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":""},{"id":"743fd75e.f52cb8","type":"ui_tab","name":"Meßsteckdosen","icon":"dashboard","order":9,"disabled":false,"hidden":false}]
2 Likes

How have you handled this issue in shelly meters?
https://www.google.com/search?q=shelly+s+meter+reset+on+power+loss

good point!
Will check it out and if needed add a sw solution.

You are right! The shelly plug s looses its energy data after a power loss.
You can fix it per software if you need long time recording.
In my case, I am looking more on daily or longest one month basis. As my loads do not change over time it is ok for me.
However I will put some logic in my node but it will take some time.

One other tip when using my managing node and you have many of them, is to program the inject nodes that way, that all http request do not happen at the same time. I use a 1 second difference in order not to overload my RPI and/or router.

Have a look at this topic, it may give you some ideas how to resolve it.

Hi Paul,
thanks for the tip. I read this article already and I know how to do it. It is only a question of having enough time :wink:

1 Like

I also know the problem and have solved it for me as follows:

I save the reported energy values in the global.json in two different fields.

  1. last reported value and
  2. sum of the reported values.

in 1. comes the current value that is reported by the device. Should this - e.g. because of a power failure or reset fall to "0" (current value < memory 1.) then the current value from 1. is added to the value of 2. and stored in 2. The new smaller value from the device is then stored in 1. again.

The consumption is always the sum of 1st and 2nd memory.

If the consumption should really be reset, you have to reset the Shelly and then set both memories to "0".

BR
Hubertus

Why do you need to save 1) to global context?
You have the current reported value from the incoming msg, which is then added to 2), so it has then no further use?

See the link that I posted above.

I have changed the term from current to "last". Thus this corresponds to your

lastReading = context.get('energy') || 0

since I don't work with the databases at this point I think the approach to the solution is analogously identical.

BR
Hubertus

It's not the terminology, I'm wondering why you are saving two different values to context, when you really only need to save one

I mentioned that to many concurrent http-requests after deploying and at midnight overloaded my RPI and/or router. (I am monitoring 15 shellies) My first idea was to set differrent start times in the inject nodes which is not very smart.
I now made one flow that has a rate limiter (1msg/sec) and a single http-request) which gets called from all shelly modules. No problems any more! I am loosing some seconds a midnight but that's ok for me.

[{"id":"3c910825e08b5d8c","type":"tab","label":"http-request / 1 per sec","disabled":false,"info":"","env":[]},{"id":"d59a2325dd14c795","type":"link in","z":"3c910825e08b5d8c","name":"http-request-in","links":[],"x":115,"y":200,"wires":[["b6d25064a9175512"]]},{"id":"e68047ac842dec83","type":"http request","z":"3c910825e08b5d8c","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":610,"y":200,"wires":[["94280fbadd4967bf"]]},{"id":"94280fbadd4967bf","type":"link out","z":"3c910825e08b5d8c","name":"http-request-out","mode":"return","links":[],"x":735,"y":200,"wires":[]},{"id":"cf4c00a83026702e","type":"delay","z":"3c910825e08b5d8c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":420,"y":200,"wires":[["e68047ac842dec83"]]},{"id":"760087790f617ecf","type":"mqtt out","z":"3c910825e08b5d8c","name":"","topic":"Heizung-Telegram","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f5f6599b.7711a8","x":790,"y":340,"wires":[]},{"id":"8a57e75b488d416f","type":"function","z":"3c910825e08b5d8c","name":"","func":"msg.payload = \"Fehlerzeitpunkt: \" + msg.payload + \" / \" +\n              \"Flow: Monitor shellyplug s\" + \" / \" +\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;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":340,"wires":[["760087790f617ecf"]]},{"id":"25f7a21086c36253","type":"moment","z":"3c910825e08b5d8c","name":"HH:mm:ss DD:MM:YYYY","topic":"","input":"xyz","inputType":"flow","inTz":"Europe/Berlin","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm:ss DD:MM:YYYY","locale":"de_DE","output":"","outputType":"msg","outTz":"Europe/Berlin","x":390,"y":340,"wires":[["8a57e75b488d416f"]]},{"id":"9b34005634e064c9","type":"catch","z":"3c910825e08b5d8c","name":"All errors","scope":null,"uncaught":false,"x":180,"y":340,"wires":[["25f7a21086c36253"]]},{"id":"b6d25064a9175512","type":"function","z":"3c910825e08b5d8c","name":"function 50","func":"return msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":230,"y":200,"wires":[["cf4c00a83026702e"]]},{"id":"f5f6599b.7711a8","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 is my updated shelly plug s module. I also included an icon for software update and wifi strength.
The http-request is now much more compact. The temprerature is now color coded (green and red)

[{"id":"7a549274356baba2","type":"ui_gauge","z":"cfc6b839afbbeb5d","name":"Computer power","group":"eafd2b7dbf8b0d81","order":4,"width":"6","height":"3","gtype":"gage","title":"","label":"Watt","format":"{{value | number:2}}","min":0,"max":"200","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":1220,"y":160,"wires":[]},{"id":"e381a2d3df52b0f5","type":"ui_text","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","order":8,"width":"3","height":"1","name":"Computer-temperature","label":"","format":"{{msg.payload}}&nbsp;&deg;C","layout":"row-center","className":"","x":1240,"y":360,"wires":[]},{"id":"8ecbc210034fbb64","type":"ui_text","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","order":7,"width":"3","height":"1","name":"Computer-stat","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1220,"y":320,"wires":[]},{"id":"390b19ba50cccb39","type":"ui_chart","z":"cfc6b839afbbeb5d","name":"Computer12h Verlauf","group":"eafd2b7dbf8b0d81","order":9,"width":"6","height":"6","label":"12h Verlauf","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"warte auf Daten","dot":false,"ymin":"0","ymax":"200","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#fa9c19","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1240,"y":200,"wires":[[]]},{"id":"fb42c9306e064374","type":"ui_text","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","order":2,"width":"4","height":"1","name":"Computer time","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1220,"y":120,"wires":[]},{"id":"cf1d56a7541e013a","type":"ui_text","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","order":6,"width":"6","height":"1","name":"Computer-energy-total","label":"Gesamt:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1240,"y":240,"wires":[]},{"id":"8a9cd5db73da089d","type":"mqtt in","z":"cfc6b839afbbeb5d","name":"","topic":"shellies/shellyplug-s-799C45/#","qos":"0","datatype":"utf8","broker":"f5f6599b.7711a8","nl":false,"rap":false,"inputs":0,"x":200,"y":340,"wires":[["815cac44a06e5af1","167925d9f6ac34af"]]},{"id":"cbe24c9ead632103","type":"function","z":"cfc6b839afbbeb5d","name":"shelly plug s Computer","func":"let timestamp = date_time_string();\nnode.status({ text: timestamp });\nlet template;\n\nif (msg.topic === 'wifi') {\n    let wifiin = msg.payload;\n    let wifiout = wifi_out(wifiin);\n    return [null, wifiout, {payload:timestamp}, null, null, null, null, null, null, null];\n}\n\nif (msg.topic === 'midnight') {\n    context.set('midnight', msg.payload.meters[0].total);\n    let update = msg.payload.update.has_update;\n    delete msg.payload;\n\n    if (update === true) {\n        template = '<div style=\"color:red; margin:auto;\" <i class=\"fa fa-cloud-download\" aria-hidden=\"true\"></i> </div> <div>     <center> <small><small><small>sw</small></small></small> </center> </div>';\n        return [{template:template},null, null, null, null, null, null, null, null, null];\n    }\n    else {\n        template = '<div style=\"color:green; margin:auto;\" <i class=\"fa fa-check\" aria-hidden=\"true\"></i> </i></div> <div>     <center>         <small><small><small>sw</small></small></small>     </center> </div>';\n        return [{ template: template }, null, null, null, null, null, null, null, null, null];\n    }\n}\n\nlet power = msg.payload[\"shellies/shellyplug-s-799C45/relay/0/power\"];\nlet totalenergy = parseFloat(msg.payload[\"shellies/shellyplug-s-799C45/relay/0/energy\"]);\nlet dayenergy = (totalenergy - context.get('midnight'));\ntotalenergy = parseFloat((totalenergy/60/1000).toFixed(3));\ndayenergy = parseFloat((dayenergy/60/1000).toFixed(3));\nlet status = msg.payload[\"shellies/shellyplug-s-799C45/relay/0\"];\nstatus = status === 'off' ? '<font color=\"#000000\">off</font>' : '<font color=\"#ff0000\">on</font>'; \nlet temperature = msg.payload[\"shellies/shellyplug-s-799C45/temperature\"];\nlet temperaturealarm = temperature;\nif (temperature < 60) {\n    temperature = '<font color=\"green\">' + temperature + '</font>';\n}\nelse {\n    temperature = '<font color=\"red\">' + temperature + '</font>';\n}\nlet overtemperature = msg.payload[\"shellies/shellyplug-s-799C45/overtemperature\"];\nif (overtemperature === undefined) {\n    overtemperature = \"0\";\n}\n\nreturn [\n    null,\n    null,\n    {payload:timestamp},    \n    {payload:power},\n    {payload:totalenergy},\n    {payload:dayenergy },    \n    {payload:status},\n    {payload:temperature},\n    {payload:temperaturealarm},    \n    {payload:overtemperature}\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 = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}\n\n//--------------------------------------------------------------------\n\nfunction wifi_out(wifiin) {\n    let rssi = wifiin;\n    let color;\n    if (rssi < -80) {\n        color = 'red';\n    }\n    else if (rssi < -70) {\n        color = '#FFC300';\n    }\n    else {\n        color = 'green';\n    }\n    rssi = rssi.toString();\n    return ({ \"topic\": rssi, \"payload\": color });\n}\n\n//--------------------------------------------------------------------","outputs":10,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":260,"wires":[["baef590b6b71d94e"],["0e7886b771d3fcad"],["fb42c9306e064374"],["390b19ba50cccb39","7a549274356baba2"],["cf1d56a7541e013a"],["f79b5cff0f7672f4"],["8ecbc210034fbb64"],["e381a2d3df52b0f5"],["d146399ccd471dad"],["0d27cf990f191da3"]]},{"id":"815cac44a06e5af1","type":"join","z":"cfc6b839afbbeb5d","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"6","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":570,"y":340,"wires":[["6f04f0acebf0f906"]]},{"id":"167925d9f6ac34af","type":"trigger","z":"cfc6b839afbbeb5d","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":480,"wires":[["2a8deb50e80382c8"]]},{"id":"2a8deb50e80382c8","type":"change","z":"cfc6b839afbbeb5d","name":"watchdog Alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s Telefon länger als 10 min offline!","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1340,"y":480,"wires":[["bb72aedf71ee1586"]]},{"id":"25404910b62a1d68","type":"function","z":"cfc6b839afbbeb5d","name":"midnight","func":"let midnight = parseFloat(msg.payload.meters[0].total);\nnode.status({text: midnight});\nreturn { topic: \"midnight\", payload:msg.payload};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":260,"wires":[["cbe24c9ead632103"]]},{"id":"f79b5cff0f7672f4","type":"ui_text","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","order":5,"width":"6","height":"1","name":"Computer-energy-tag","label":"Tag:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1240,"y":280,"wires":[]},{"id":"9b1b8b81c34ea9a4","type":"mqtt out","z":"cfc6b839afbbeb5d","name":"Telegram","topic":"Heizung-Telegram","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f5f6599b.7711a8","x":1600,"y":440,"wires":[]},{"id":"0e7886b771d3fcad","type":"ui_template","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","name":"Computer wifi","order":3,"width":"1","height":"1","format":"<div style=\"color:{{msg.payload}}; margin:auto;\" <i class=\"fa fa-wifi fa-1x\" aria-hidden=\"true\"> </i></div>\n<div>\n    <center>\n        <small><small><small>{{msg.topic}}</small></small></small>\n    </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1220,"y":80,"wires":[[]]},{"id":"44122eef2a83204d","type":"link in","z":"cfc6b839afbbeb5d","name":"telegram out","links":["72d5e2d3f183a76c","a0bb5446b129c503","b7c1a37a0bf85e0f"],"x":1405,"y":360,"wires":[["bb72aedf71ee1586"]]},{"id":"0d27cf990f191da3","type":"function","z":"cfc6b839afbbeb5d","name":"overtemperature","func":"if (msg.payload != \"0\"){\n    msg.payload = \"shelly pulg s Computer Overtemperature Alarm!\"\n    return msg;\n}\nelse {\n    return { reset: 0 };\n} \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1220,"y":440,"wires":[["2f90e34578544394"]]},{"id":"d146399ccd471dad","type":"function","z":"cfc6b839afbbeb5d","name":"temp > 60","func":"if (msg.payload > 60){\n    msg.payload = \"shelly plug s Computer über 60 Grad!\"\n    return msg;\n}\nelse{\n    return{reset:0};\n}   \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":400,"wires":[["109fa76e0c24b29b"]]},{"id":"109fa76e0c24b29b","type":"rbe","z":"cfc6b839afbbeb5d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1370,"y":400,"wires":[["bb72aedf71ee1586"]]},{"id":"d2b329f64f322a28","type":"debug","z":"cfc6b839afbbeb5d","name":"debug 36","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1600,"y":400,"wires":[]},{"id":"2f90e34578544394","type":"rbe","z":"cfc6b839afbbeb5d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1370,"y":440,"wires":[["bb72aedf71ee1586"]]},{"id":"f68c13e5dc765218","type":"function","z":"cfc6b839afbbeb5d","name":"wifi","func":"node.status({ text: msg.payload.wifi_sta.rssi});\nreturn { topic: 'wifi', payload: msg.payload.wifi_sta.rssi};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":180,"wires":[["cbe24c9ead632103"]]},{"id":"64e257589521195f","type":"inject","z":"cfc6b839afbbeb5d","name":"ervery midnight","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":true,"onceDelay":"2","topic":"midnight","payload":"","payloadType":"date","x":170,"y":140,"wires":[["a65908418ab7a63f"]]},{"id":"73c7eed253f625ca","type":"inject","z":"cfc6b839afbbeb5d","name":"every 5 min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"0.5","topic":"5min","payload":"","payloadType":"date","x":190,"y":100,"wires":[["a65908418ab7a63f"]]},{"id":"8b4f13b34a4f492f","type":"switch","z":"cfc6b839afbbeb5d","name":"200","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"str"},{"t":"neq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":170,"y":240,"wires":[["171ac687cb9ef1ba"],["8886c36de5019c7a"]]},{"id":"b41d697ac89dfdc9","type":"link call","z":"cfc6b839afbbeb5d","name":"http-req","links":["d59a2325dd14c795"],"linkType":"static","timeout":"30","x":480,"y":120,"wires":[["8b4f13b34a4f492f"]]},{"id":"a65908418ab7a63f","type":"change","z":"cfc6b839afbbeb5d","name":"url 162","rules":[{"t":"set","p":"url","pt":"msg","to":"http://10.0.0.162/status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":120,"wires":[["b41d697ac89dfdc9"]]},{"id":"c89daf95e789bb39","type":"switch","z":"cfc6b839afbbeb5d","name":"Topic","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"5min","vt":"str"},{"t":"eq","v":"midnight","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":220,"wires":[["f68c13e5dc765218"],["25404910b62a1d68"]]},{"id":"8886c36de5019c7a","type":"change","z":"cfc6b839afbbeb5d","name":"error Telefon http-request","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s Telefon: error http-request 1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":260,"wires":[["b7c1a37a0bf85e0f"]]},{"id":"b7c1a37a0bf85e0f","type":"link out","z":"cfc6b839afbbeb5d","name":"link out 7","mode":"link","links":["44122eef2a83204d"],"x":515,"y":260,"wires":[]},{"id":"6f04f0acebf0f906","type":"rbe","z":"cfc6b839afbbeb5d","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":690,"y":340,"wires":[["cbe24c9ead632103"]]},{"id":"baef590b6b71d94e","type":"ui_template","z":"cfc6b839afbbeb5d","group":"eafd2b7dbf8b0d81","name":"software","order":1,"width":"1","height":"1","format":"{{msg.template}}","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1200,"y":40,"wires":[[]]},{"id":"9a07e2d8037f2120","type":"junction","z":"cfc6b839afbbeb5d","x":1140,"y":80,"wires":[[]]},{"id":"bb72aedf71ee1586","type":"junction","z":"cfc6b839afbbeb5d","x":1480,"y":420,"wires":[["d2b329f64f322a28","9b1b8b81c34ea9a4"]]},{"id":"171ac687cb9ef1ba","type":"junction","z":"cfc6b839afbbeb5d","x":260,"y":220,"wires":[["c89daf95e789bb39"]]},{"id":"eafd2b7dbf8b0d81","type":"ui_group","name":"UG Computer shelly plug s","tab":"743fd75e.f52cb8","order":13,"disp":true,"width":"6","collapse":false},{"id":"f5f6599b.7711a8","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":""},{"id":"743fd75e.f52cb8","type":"ui_tab","name":"Meßsteckdosen","icon":"dashboard","order":9,"disabled":false,"hidden":false}]

This version handles power loss situation of the shelly plug s.
If you have a power loss, most probably your RPI will be down as well. Therefore I have included a function (commented out) which will persist your energy data. Don't forget to change settings.js.

[{"id":"d6ff683a9330f8e5","type":"ui_gauge","z":"8ac5ac42307c5911","name":"VPN-power","group":"717d20278673a256","order":4,"width":"6","height":"3","gtype":"gage","title":"","label":"Watt","format":"{{value | number:2}}","min":0,"max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":1290,"y":520,"wires":[]},{"id":"126702277bb45ff3","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":8,"width":"3","height":"1","name":"VPN-temperature","label":"","format":"{{msg.payload}}&nbsp;&deg;C","layout":"row-center","className":"","x":1310,"y":720,"wires":[]},{"id":"5a11eb44ee184b34","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":7,"width":"3","height":"1","name":"VPN-stat","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1280,"y":680,"wires":[]},{"id":"62b509263e8777b9","type":"ui_chart","z":"8ac5ac42307c5911","name":"VPN-12h-Verlauf","group":"717d20278673a256","order":9,"width":"6","height":"6","label":"12h Verlauf","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"warte auf Daten","dot":false,"ymin":"0","ymax":"20","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#fa9c19","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1310,"y":560,"wires":[[]]},{"id":"36555df3eb8a5eb2","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":2,"width":"4","height":"1","name":"VPN-time","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1280,"y":480,"wires":[]},{"id":"639948b701b222f5","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":6,"width":"6","height":"1","name":" VPN-energy-total","label":"Gesamt:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1310,"y":600,"wires":[]},{"id":"0897a4e505cd6f76","type":"mqtt in","z":"8ac5ac42307c5911","name":"","topic":"shellies/shellyplug-s-040DEB/#","qos":"0","datatype":"utf8","broker":"99603ece.52e2a","nl":false,"rap":false,"inputs":0,"x":190,"y":700,"wires":[["bbde51f4262b793c","01359424be369378"]]},{"id":"bbe04db04cfe9591","type":"function","z":"8ac5ac42307c5911","name":"shelly plug s VPN","func":"let wifiout = {};\nlet timestamp = date_time_string();\nnode.status({ text: timestamp });\n\nswitch (msg.topic) {\n    case \"wifi\":\n        let wifiin = msg.payload;\n        wifiout = wifi_out(wifiin);\n        return [null, wifiout, { payload: timestamp }, null, null, null, null, null, null, null];\n    case \"midnight\":\n        context.set('midnight', msg.payload);\n        return [null, null, null, null, null, null, null, null, null, null]; \n    case \"firmware\":\n        let update = msg.payload.update.has_update;\n        delete msg.payload;\n        if (update === true) {\n            return [{ color: \"red\", icon: \"fa fa-cloud-download\" }, null, { payload: timestamp }, null, null, null, null, null, null, null];\n        }\n        else {\n            return [{ color: \"green\", icon: \"fa fa-thumbs-up\" }, null, { payload: timestamp }, null, null, null, null, null, null, null];\n        }              \n}\n\nif (msg.topic.includes(\"shellyplug-s-040DEB\")){\n    return display_data();\n}\n\n//========================================================================\n\nfunction display_data(){\n    let power = msg.payload[\"shellies/shellyplug-s-040DEB/relay/0/power\"];\n    let totalenergy = parseFloat(msg.payload[\"shellies/shellyplug-s-040DEB/relay/0/energy\"]);\n    totalenergy = check_energy(totalenergy);\n    let dayenergy = (totalenergy - context.get('midnight'));\n    totalenergy = parseFloat((totalenergy/60/1000).toFixed(3));\n    dayenergy = parseFloat((dayenergy/60/1000).toFixed(3));\n    let status = msg.payload[\"shellies/shellyplug-s-040DEB/relay/0\"];\n    status = status === 'off' ? '<font color=\"#000000\">off</font>' : '<font color=\"#ff0000\">on</font>'; \n    let temperature = msg.payload[\"shellies/shellyplug-s-040DEB/temperature\"] ||0;\n    let temperaturealarm = temperature;\n    if (temperature < 60) {\n        temperature = '<font color=\"green\">' + temperature + '</font>';\n    }\n    else {\n        temperature = '<font color=\"red\">' + temperature + '</font>';\n    }\n    let overtemperature = msg.payload[\"shellies/shellyplug-s-040DEB/overtemperature\"];\n    if (overtemperature === undefined) {\n        overtemperature = \"0\";\n    }\n    return [\n        null,\n        null,\n        {payload:timestamp},    \n        {payload:power},\n        {payload:totalenergy},\n        {payload:dayenergy },    \n        {payload:status},\n        {payload:temperature},\n        {payload: temperaturealarm},     \n        {payload:overtemperature}\n    ];\n}\n\n//--------------------------------------------------------------------\n\nfunction check_energy(data) {\n    let new_energy = data;\n    if (new_energy < context.get('last_energy')) {\n        new_energy = new_energy + context.get('last_energy');\n    }\n    context.set('last_energy', new_energy);\n    return new_energy;\n}\n\n/*\n\n// persisting energy data --> need to change config.js\n\nfunction check_energy(data) {\n    let new_energy = data;\n    if (new_energy < context.get('last_energy,file')) {\n        new_energy = new_energy + context.get('last_energy,file');\n    }\n    context.set('last_energy,file', new_energy);\n    //node.warn(new_energy);\n    return new_energy;\n}\n\n*/\n\n//--------------------------------------------------------------------\n\nfunction wifi_out(wifiin) {\n    let rssi = wifiin;\n    let color;\n    if (rssi < -80) {\n        color = 'red';\n    }\n    else if (rssi < -70) {\n        color = '#FFC300';\n    }\n    else {\n        color = 'green';\n    }\n    rssi = rssi.toString();\n    return ({ \"topic\": rssi, \"payload\": color });\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 = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}\n\n//--------------------------------------------------------------------","outputs":10,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set('last_energy', 0);","finalize":"","libs":[],"x":910,"y":620,"wires":[["c67d57a6146516f2"],["ed35e659ffc32152"],["36555df3eb8a5eb2"],["62b509263e8777b9","d6ff683a9330f8e5"],["639948b701b222f5"],["c69d330bc001c5d4"],["5a11eb44ee184b34"],["126702277bb45ff3"],["014dec58372a9ad3"],["a8d689251431bbf0"]]},{"id":"bbde51f4262b793c","type":"join","z":"8ac5ac42307c5911","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"6","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":700,"wires":[["78bd1827e8fc9361"]]},{"id":"01359424be369378","type":"trigger","z":"8ac5ac42307c5911","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":840,"wires":[["a0024f034b91efe5"]]},{"id":"a0024f034b91efe5","type":"change","z":"8ac5ac42307c5911","name":"watchdog Alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s VPN länger als 10 min offline!","tot":"str"},{"t":"set","p":"WD_VPN","pt":"global","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1420,"y":840,"wires":[["91037bd9f6621d25"]]},{"id":"5c3f5bdcc686a06f","type":"function","z":"8ac5ac42307c5911","name":"midnight","func":"let midnight = parseFloat(msg.payload.meters[0].total) || 0;\nnode.status({text: midnight});\nreturn { topic: \"midnight\", payload:midnight};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":580,"wires":[["bbe04db04cfe9591"]]},{"id":"c69d330bc001c5d4","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":5,"width":"6","height":"1","name":"VPN-energy-tag","label":"Tag:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1300,"y":640,"wires":[]},{"id":"ed35e659ffc32152","type":"ui_template","z":"8ac5ac42307c5911","group":"717d20278673a256","name":"VPN-wifi","order":3,"width":"1","height":"1","format":"<div style=\"color:{{msg.payload}}; margin:auto;\" <i class=\"fa fa-wifi fa-1x\" aria-hidden=\"true\"> </i></div>\n<div>\n    <center>\n        <small><small><small>{{msg.topic}}</small></small></small>\n    </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1280,"y":440,"wires":[[]]},{"id":"ba1afd43bf0e2e1f","type":"link in","z":"8ac5ac42307c5911","name":"telegram out","links":["dbd434df290c7ccc","7011c80c99109772","b41418dd7e757344"],"x":1485,"y":720,"wires":[["91037bd9f6621d25"]]},{"id":"a8d689251431bbf0","type":"function","z":"8ac5ac42307c5911","name":"overtemperature","func":"if (msg.payload != \"0\"){\n    msg.payload = \"shelly pulg s VPN Overtemperature Alarm!\"\n    return msg;\n}\nelse {\n    return { reset: 0 };\n} \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":800,"wires":[["9b9b68a2ca670c73"]]},{"id":"014dec58372a9ad3","type":"function","z":"8ac5ac42307c5911","name":"temp > 60","func":"if (msg.payload > 60){\n    msg.payload = \"shelly plug s VPN über 60 Grad!\"\n    return msg;\n}\nelse{\n    return{reset:0};\n}   \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1280,"y":760,"wires":[["f3533e8bfad8e0a2"]]},{"id":"f3533e8bfad8e0a2","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1450,"y":760,"wires":[["91037bd9f6621d25"]]},{"id":"70d06acf0b2cf05f","type":"debug","z":"8ac5ac42307c5911","name":"debug 40","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1680,"y":760,"wires":[]},{"id":"9b9b68a2ca670c73","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1450,"y":800,"wires":[["91037bd9f6621d25"]]},{"id":"5f2bfa8d2ab7545a","type":"function","z":"8ac5ac42307c5911","name":"wifi","func":"node.status({ text: msg.payload.wifi_sta.rssi});\nreturn { topic: 'wifi', payload: msg.payload.wifi_sta.rssi};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":520,"wires":[["bbe04db04cfe9591"]]},{"id":"9a3dd5a5d10e21db","type":"inject","z":"8ac5ac42307c5911","name":"ervery midnight","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":true,"onceDelay":"2","topic":"mid_night","payload":"","payloadType":"date","x":160,"y":460,"wires":[["c04dad602f80eabd"]]},{"id":"6f569b7cc8777391","type":"inject","z":"8ac5ac42307c5911","name":"every 5 min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"1","topic":"5min","payload":"","payloadType":"date","x":170,"y":420,"wires":[["c04dad602f80eabd"]]},{"id":"9e452fd0f7c9a5d6","type":"switch","z":"8ac5ac42307c5911","name":"200","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"str"},{"t":"eq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":460,"wires":[["b41418dd7e757344"],["134bf4c37eb35cf0"]]},{"id":"2bfeaecc7302f21e","type":"change","z":"8ac5ac42307c5911","name":"url 163","rules":[{"t":"set","p":"url","pt":"msg","to":"http://10.0.0.163/status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":460,"wires":[["397ec9a0afb01b76"]]},{"id":"cbdab224bdd6cde0","type":"switch","z":"8ac5ac42307c5911","name":"Topic","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"5min","vt":"str"},{"t":"eq","v":"mid_night","vt":"str"},{"t":"eq","v":"firmware","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":470,"y":580,"wires":[["5f2bfa8d2ab7545a"],["5c3f5bdcc686a06f"],["fd5363e43298ac2d"]]},{"id":"b41418dd7e757344","type":"link out","z":"8ac5ac42307c5911","name":"link out 22","mode":"link","links":["ba1afd43bf0e2e1f"],"x":1025,"y":460,"wires":[]},{"id":"78bd1827e8fc9361","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":690,"y":700,"wires":[["bbe04db04cfe9591"]]},{"id":"d154d3841a1ce9f4","type":"link out","z":"8ac5ac42307c5911","name":"link out 35","mode":"link","links":["f633e61698bc93f8"],"x":1635,"y":800,"wires":[]},{"id":"c67d57a6146516f2","type":"ui_template","z":"8ac5ac42307c5911","group":"717d20278673a256","name":"VPN-Firmware","order":1,"width":"1","height":"1","format":"<div style=\"color:{{msg.color}}; margin:auto;\" <i class=\"{{msg.icon}}\" aria-hidden=\"true\"></i> </div>\n<div>\n    <center> <small><small><small>fw</small></small></small> </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1300,"y":400,"wires":[[]]},{"id":"fd5363e43298ac2d","type":"function","z":"8ac5ac42307c5911","name":"firmware","func":"node.status({ text: msg.payload.update.has_update });\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":640,"wires":[["bbe04db04cfe9591"]]},{"id":"290882ea483ecb79","type":"inject","z":"8ac5ac42307c5911","name":"firmware 01:00","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 01 * * *","once":true,"onceDelay":"3","topic":"firmware","payload":"","payloadType":"date","x":160,"y":500,"wires":[["c04dad602f80eabd"]]},{"id":"c04dad602f80eabd","type":"switch","z":"8ac5ac42307c5911","name":"VPN_Stat","property":"VPN_Stat","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":360,"y":460,"wires":[["6c6f9e33558c9e34"]]},{"id":"59a5aa09eee2f884","type":"inject","z":"8ac5ac42307c5911","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":360,"wires":[["ae2af3f934efd0d3"]]},{"id":"ae2af3f934efd0d3","type":"change","z":"8ac5ac42307c5911","name":"","rules":[{"t":"set","p":"VPN_Stat","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":360,"wires":[[]]},{"id":"397ec9a0afb01b76","type":"http request","z":"8ac5ac42307c5911","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":770,"y":460,"wires":[["9e452fd0f7c9a5d6"]]},{"id":"25f7c9ce5dc00b34","type":"comment","z":"8ac5ac42307c5911","name":"to Telegram","info":"","x":1730,"y":800,"wires":[]},{"id":"6c6f9e33558c9e34","type":"switch","z":"8ac5ac42307c5911","name":"WD_VPN","property":"WD_VPN","propertyType":"global","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":500,"y":460,"wires":[["2bfeaecc7302f21e"]]},{"id":"5864751f3fb43d4b","type":"inject","z":"8ac5ac42307c5911","name":"reset","props":[{"p":"reset","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":550,"y":780,"wires":[["01359424be369378","d6b3e5edef5b55b4"]]},{"id":"d6b3e5edef5b55b4","type":"change","z":"8ac5ac42307c5911","name":"WD_VPN on","rules":[{"t":"set","p":"WD_VPN","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":780,"wires":[[]]},{"id":"67f38a6ed90b27c7","type":"junction","z":"8ac5ac42307c5911","x":1220,"y":440,"wires":[[]]},{"id":"91037bd9f6621d25","type":"junction","z":"8ac5ac42307c5911","x":1560,"y":780,"wires":[["70d06acf0b2cf05f","d154d3841a1ce9f4"]]},{"id":"134bf4c37eb35cf0","type":"junction","z":"8ac5ac42307c5911","x":340,"y":520,"wires":[["cbdab224bdd6cde0"]]},{"id":"717d20278673a256","type":"ui_group","name":"UG VPN shelly plug s","tab":"afb5efc18304bb85","order":15,"disp":true,"width":"6","collapse":false},{"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":""},{"id":"afb5efc18304bb85","type":"ui_tab","name":"Meßsteckdosen","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

some small changes made:

now you have to change the shelly id only once at the top of the node.

I am checking timeouts of the mqtt input. When this happens I stop the http requests, which in this case would send lots of alarms to Telegram. The lock can be reset in the flow.

I am also checking if my VPN RPI is running with another shelly plug s. If not running there will be no http requests as well in order to avoid alarms

[{"id":"d6ff683a9330f8e5","type":"ui_gauge","z":"8ac5ac42307c5911","name":"VPN-power","group":"717d20278673a256","order":4,"width":"6","height":"3","gtype":"gage","title":"","label":"Watt","format":"{{value | number:2}}","min":0,"max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":1290,"y":520,"wires":[]},{"id":"126702277bb45ff3","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":8,"width":"3","height":"1","name":"VPN-temperature","label":"","format":"{{msg.payload}}&nbsp;&deg;C","layout":"row-center","className":"","x":1310,"y":720,"wires":[]},{"id":"5a11eb44ee184b34","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":7,"width":"3","height":"1","name":"VPN-stat","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1280,"y":680,"wires":[]},{"id":"62b509263e8777b9","type":"ui_chart","z":"8ac5ac42307c5911","name":"VPN-12h-Verlauf","group":"717d20278673a256","order":9,"width":"6","height":"6","label":"12h Verlauf","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"warte auf Daten","dot":false,"ymin":"0","ymax":"20","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#fa9c19","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1310,"y":560,"wires":[[]]},{"id":"36555df3eb8a5eb2","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":2,"width":"4","height":"1","name":"VPN-time","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1280,"y":480,"wires":[]},{"id":"639948b701b222f5","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":6,"width":"6","height":"1","name":" VPN-energy-total","label":"Gesamt:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1310,"y":600,"wires":[]},{"id":"0897a4e505cd6f76","type":"mqtt in","z":"8ac5ac42307c5911","name":"","topic":"shellies/shellyplug-s-040DEB/#","qos":"0","datatype":"utf8","broker":"99603ece.52e2a","nl":false,"rap":false,"inputs":0,"x":190,"y":700,"wires":[["bbde51f4262b793c","01359424be369378"]]},{"id":"bbe04db04cfe9591","type":"function","z":"8ac5ac42307c5911","name":"shelly plug s VPN","func":"//=================================================================\nconst id = \"shellyplug-s-040DEB\";    // change id to your shelly id\n//=================================================================\n\nlet wifiout = {};\nlet timestamp = date_time_string();\nnode.status({ text: timestamp });\n\nswitch (msg.topic) {\n    case \"wifi\":\n        let wifiin = msg.payload;\n        wifiout = wifi_out(wifiin);\n        return [null, wifiout, { payload: timestamp }, null, null, null, null, null, null, null];\n    case \"midnight\":\n        context.set('midnight', msg.payload);\n        return [null, null, null, null, null, null, null, null, null, null]; \n    case \"firmware\":\n        let update = msg.payload.update.has_update;\n        delete msg.payload;\n        if (update === true) {\n            return [{ color: \"red\", icon: \"fa fa-cloud-download\" }, null, { payload: timestamp }, null, null, null, null, null, null, null];\n        }\n        else {\n            return [{ color: \"green\", icon: \"fa fa-thumbs-up\" }, null, { payload: timestamp }, null, null, null, null, null, null, null];\n        }              \n}\n\nreturn display_data();\n\n\n//========================================================================\n\nfunction display_data(){\n    let power = msg.payload[\"shellies/\" + id + \"/relay/0/power\"];\n    let totalenergy = parseFloat(msg.payload[\"shellies/\" + id + \"/relay/0/energy\"]);\n    totalenergy = check_energy(totalenergy);\n    let dayenergy = (totalenergy - context.get('midnight'));\n    totalenergy = parseFloat((totalenergy/60/1000).toFixed(3));\n    dayenergy = parseFloat((dayenergy/60/1000).toFixed(3));\n    let status = msg.payload[\"shellies/\" + id + \"/relay/0\"];\n    status = status === 'off' ? '<font color=\"#000000\">off</font>' : '<font color=\"#ff0000\">on</font>'; \n    let temperature = msg.payload[\"shellies/\" + id + \"/temperature\"] ||0;\n    let temperaturealarm = temperature;\n    if (temperature < 60) {\n        temperature = '<font color=\"green\">' + temperature + '</font>';\n    }\n    else {\n        temperature = '<font color=\"red\">' + temperature + '</font>';\n    }\n    let overtemperature = msg.payload[\"shellies/\" + id + \"/overtemperature\"];\n    if (overtemperature === undefined) {\n        overtemperature = \"0\";\n    }\n    return [\n        null,\n        null,\n        {payload:timestamp},    \n        {payload:power},\n        {payload:totalenergy},\n        {payload:dayenergy },    \n        {payload:status},\n        {payload:temperature},\n        {payload: temperaturealarm},     \n        {payload:overtemperature}\n    ];\n}\n\n//--------------------------------------------------------------------\n\nfunction check_energy(data) {\n    let new_energy = data;\n    if (new_energy < context.get('last_energy')) {\n        new_energy = new_energy + context.get('last_energy');\n    }\n    context.set('last_energy', new_energy);\n    return new_energy;\n}\n\n/*\n\n// persisting energy data --> need to change config.js\n\nfunction check_energy(data) {\n    let new_energy = data;\n    if (new_energy < context.get('last_energy,file')) {\n        new_energy = new_energy + context.get('last_energy,file');\n    }\n    context.set('last_energy,file', new_energy);\n    //node.warn(new_energy);\n    return new_energy;\n}\n\n*/\n\n//--------------------------------------------------------------------\n\nfunction wifi_out(wifiin) {\n    let rssi = wifiin;\n    let color;\n    if (rssi < -80) {\n        color = 'red';\n    }\n    else if (rssi < -70) {\n        color = '#FFC300';\n    }\n    else {\n        color = 'green';\n    }\n    rssi = rssi.toString();\n    return ({ \"topic\": rssi, \"payload\": color });\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 = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}\n\n//--------------------------------------------------------------------","outputs":10,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set('last_energy', 0);","finalize":"","libs":[],"x":910,"y":620,"wires":[["c67d57a6146516f2"],["ed35e659ffc32152"],["36555df3eb8a5eb2"],["62b509263e8777b9","d6ff683a9330f8e5"],["639948b701b222f5"],["c69d330bc001c5d4"],["5a11eb44ee184b34"],["126702277bb45ff3"],["014dec58372a9ad3"],["a8d689251431bbf0"]]},{"id":"bbde51f4262b793c","type":"join","z":"8ac5ac42307c5911","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"6","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":700,"wires":[["78bd1827e8fc9361"]]},{"id":"01359424be369378","type":"trigger","z":"8ac5ac42307c5911","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":840,"wires":[["a0024f034b91efe5"]]},{"id":"a0024f034b91efe5","type":"change","z":"8ac5ac42307c5911","name":"watchdog Alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s VPN länger als 10 min offline!","tot":"str"},{"t":"set","p":"WD_VPN","pt":"global","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1420,"y":840,"wires":[["91037bd9f6621d25"]]},{"id":"5c3f5bdcc686a06f","type":"function","z":"8ac5ac42307c5911","name":"midnight","func":"let midnight = parseFloat(msg.payload.meters[0].total) || 0;\nnode.status({text: midnight});\nreturn { topic: \"midnight\", payload:midnight};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":580,"wires":[["bbe04db04cfe9591"]]},{"id":"c69d330bc001c5d4","type":"ui_text","z":"8ac5ac42307c5911","group":"717d20278673a256","order":5,"width":"6","height":"1","name":"VPN-energy-tag","label":"Tag:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1300,"y":640,"wires":[]},{"id":"ed35e659ffc32152","type":"ui_template","z":"8ac5ac42307c5911","group":"717d20278673a256","name":"VPN-wifi","order":3,"width":"1","height":"1","format":"<div style=\"color:{{msg.payload}}; margin:auto;\" <i class=\"fa fa-wifi fa-1x\" aria-hidden=\"true\"> </i></div>\n<div>\n    <center>\n        <small><small><small>{{msg.topic}}</small></small></small>\n    </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1280,"y":440,"wires":[[]]},{"id":"ba1afd43bf0e2e1f","type":"link in","z":"8ac5ac42307c5911","name":"telegram out","links":["dbd434df290c7ccc","7011c80c99109772","b41418dd7e757344"],"x":1485,"y":720,"wires":[["91037bd9f6621d25"]]},{"id":"a8d689251431bbf0","type":"function","z":"8ac5ac42307c5911","name":"overtemperature","func":"if (msg.payload != \"0\"){\n    msg.payload = \"shelly pulg s VPN Overtemperature Alarm!\"\n    return msg;\n}\nelse {\n    return { reset: 0 };\n} \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":800,"wires":[["9b9b68a2ca670c73"]]},{"id":"014dec58372a9ad3","type":"function","z":"8ac5ac42307c5911","name":"temp > 60","func":"if (msg.payload > 60){\n    msg.payload = \"shelly plug s VPN über 60 Grad!\"\n    return msg;\n}\nelse{\n    return{reset:0};\n}   \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1280,"y":760,"wires":[["f3533e8bfad8e0a2"]]},{"id":"f3533e8bfad8e0a2","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1450,"y":760,"wires":[["91037bd9f6621d25"]]},{"id":"70d06acf0b2cf05f","type":"debug","z":"8ac5ac42307c5911","name":"debug 40","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1680,"y":760,"wires":[]},{"id":"9b9b68a2ca670c73","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1450,"y":800,"wires":[["91037bd9f6621d25"]]},{"id":"5f2bfa8d2ab7545a","type":"function","z":"8ac5ac42307c5911","name":"wifi","func":"node.status({ text: msg.payload.wifi_sta.rssi});\nreturn { topic: 'wifi', payload: msg.payload.wifi_sta.rssi};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":520,"wires":[["bbe04db04cfe9591"]]},{"id":"9a3dd5a5d10e21db","type":"inject","z":"8ac5ac42307c5911","name":"ervery midnight","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":true,"onceDelay":"2","topic":"mid_night","payload":"","payloadType":"date","x":160,"y":460,"wires":[["c04dad602f80eabd"]]},{"id":"6f569b7cc8777391","type":"inject","z":"8ac5ac42307c5911","name":"every 5 min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"1","topic":"5min","payload":"","payloadType":"date","x":170,"y":420,"wires":[["c04dad602f80eabd"]]},{"id":"9e452fd0f7c9a5d6","type":"switch","z":"8ac5ac42307c5911","name":"200","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"str"},{"t":"eq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":460,"wires":[["b41418dd7e757344"],["134bf4c37eb35cf0"]]},{"id":"2bfeaecc7302f21e","type":"change","z":"8ac5ac42307c5911","name":"url 163","rules":[{"t":"set","p":"url","pt":"msg","to":"http://10.0.0.163/status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":460,"wires":[["397ec9a0afb01b76"]]},{"id":"cbdab224bdd6cde0","type":"switch","z":"8ac5ac42307c5911","name":"Topic","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"5min","vt":"str"},{"t":"eq","v":"mid_night","vt":"str"},{"t":"eq","v":"firmware","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":470,"y":580,"wires":[["5f2bfa8d2ab7545a"],["5c3f5bdcc686a06f"],["fd5363e43298ac2d"]]},{"id":"b41418dd7e757344","type":"link out","z":"8ac5ac42307c5911","name":"link out 22","mode":"link","links":["ba1afd43bf0e2e1f"],"x":1025,"y":460,"wires":[]},{"id":"78bd1827e8fc9361","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":690,"y":700,"wires":[["bbe04db04cfe9591"]]},{"id":"d154d3841a1ce9f4","type":"link out","z":"8ac5ac42307c5911","name":"link out 35","mode":"link","links":["f633e61698bc93f8"],"x":1635,"y":800,"wires":[]},{"id":"c67d57a6146516f2","type":"ui_template","z":"8ac5ac42307c5911","group":"717d20278673a256","name":"VPN-Firmware","order":1,"width":"1","height":"1","format":"<div style=\"color:{{msg.color}}; margin:auto;\" <i class=\"{{msg.icon}}\" aria-hidden=\"true\"></i> </div>\n<div>\n    <center> <small><small><small>fw</small></small></small> </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1300,"y":400,"wires":[[]]},{"id":"fd5363e43298ac2d","type":"function","z":"8ac5ac42307c5911","name":"firmware","func":"node.status({ text: msg.payload.update.has_update });\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":640,"wires":[["bbe04db04cfe9591"]]},{"id":"290882ea483ecb79","type":"inject","z":"8ac5ac42307c5911","name":"firmware 01:00","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 01 * * *","once":true,"onceDelay":"3","topic":"firmware","payload":"","payloadType":"date","x":160,"y":500,"wires":[["c04dad602f80eabd"]]},{"id":"c04dad602f80eabd","type":"switch","z":"8ac5ac42307c5911","name":"VPN_Stat","property":"VPN_Stat","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":360,"y":460,"wires":[["6c6f9e33558c9e34"]]},{"id":"59a5aa09eee2f884","type":"inject","z":"8ac5ac42307c5911","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":360,"wires":[["ae2af3f934efd0d3"]]},{"id":"ae2af3f934efd0d3","type":"change","z":"8ac5ac42307c5911","name":"","rules":[{"t":"set","p":"VPN_Stat","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":360,"wires":[[]]},{"id":"397ec9a0afb01b76","type":"http request","z":"8ac5ac42307c5911","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":770,"y":460,"wires":[["9e452fd0f7c9a5d6"]]},{"id":"25f7c9ce5dc00b34","type":"comment","z":"8ac5ac42307c5911","name":"to Telegram","info":"","x":1730,"y":800,"wires":[]},{"id":"6c6f9e33558c9e34","type":"switch","z":"8ac5ac42307c5911","name":"WD_VPN","property":"WD_VPN","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":500,"y":460,"wires":[["2bfeaecc7302f21e"]]},{"id":"5864751f3fb43d4b","type":"inject","z":"8ac5ac42307c5911","name":"reset","props":[{"p":"reset","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":550,"y":780,"wires":[["01359424be369378","d6b3e5edef5b55b4"]]},{"id":"d6b3e5edef5b55b4","type":"change","z":"8ac5ac42307c5911","name":"WD_VPN on","rules":[{"t":"set","p":"WD_VPN","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":780,"wires":[[]]},{"id":"67f38a6ed90b27c7","type":"junction","z":"8ac5ac42307c5911","x":1220,"y":440,"wires":[[]]},{"id":"91037bd9f6621d25","type":"junction","z":"8ac5ac42307c5911","x":1560,"y":780,"wires":[["70d06acf0b2cf05f","d154d3841a1ce9f4"]]},{"id":"134bf4c37eb35cf0","type":"junction","z":"8ac5ac42307c5911","x":340,"y":520,"wires":[["cbdab224bdd6cde0"]]},{"id":"717d20278673a256","type":"ui_group","name":"UG VPN shelly plug s","tab":"afb5efc18304bb85","order":15,"disp":true,"width":"6","collapse":false},{"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":""},{"id":"afb5efc18304bb85","type":"ui_tab","name":"Meßsteckdosen","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

After running my shelly plug s monitoring for a while, I found that due to the join node the UI was not reactive enough. Therefore, I rewrote the node. Responsiveness is now ok, especially for on and off status. The way how I handle multiple outputs of the node is also much easier now and better to read. As the inputs and the UI have not changed, it is possible to just replace the code in your node. But then don’t forget to copy Tab “On Start” as well and remove the join node.

[{"id":"d6ff683a9330f8e5","type":"ui_gauge","z":"8ac5ac42307c5911","name":"VPN-power","group":"d5178392f725ae47","order":4,"width":"6","height":"3","gtype":"gage","title":"","label":"Watt","format":"{{value | number:2}}","min":0,"max":"20","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","diff":false,"className":"","x":1290,"y":500,"wires":[]},{"id":"126702277bb45ff3","type":"ui_text","z":"8ac5ac42307c5911","group":"d5178392f725ae47","order":8,"width":"3","height":"1","name":"VPN-temperature","label":"","format":"{{msg.payload}}&nbsp;&deg;C","layout":"row-center","className":"","x":1310,"y":700,"wires":[]},{"id":"5a11eb44ee184b34","type":"ui_text","z":"8ac5ac42307c5911","group":"d5178392f725ae47","order":7,"width":"3","height":"1","name":"VPN-stat","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1280,"y":660,"wires":[]},{"id":"62b509263e8777b9","type":"ui_chart","z":"8ac5ac42307c5911","name":"VPN-12h-Verlauf","group":"d5178392f725ae47","order":9,"width":"6","height":"6","label":"12h Verlauf","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"warte auf Daten","dot":false,"ymin":"0","ymax":"20","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#fa9c19","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1310,"y":540,"wires":[[]]},{"id":"36555df3eb8a5eb2","type":"ui_text","z":"8ac5ac42307c5911","group":"d5178392f725ae47","order":2,"width":"4","height":"1","name":"VPN-time","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","x":1280,"y":460,"wires":[]},{"id":"639948b701b222f5","type":"ui_text","z":"8ac5ac42307c5911","group":"d5178392f725ae47","order":6,"width":"6","height":"1","name":" VPN-energy-total","label":"Gesamt:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1310,"y":580,"wires":[]},{"id":"0897a4e505cd6f76","type":"mqtt in","z":"8ac5ac42307c5911","name":"","topic":"shellies/shellyplug-s-040DEB/#","qos":"0","datatype":"utf8","broker":"99603ece.52e2a","nl":false,"rap":false,"inputs":0,"x":170,"y":700,"wires":[["01359424be369378","cd22249708dd2da4"]]},{"id":"01359424be369378","type":"trigger","z":"8ac5ac42307c5911","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"10","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":550,"y":820,"wires":[["a0024f034b91efe5"]]},{"id":"a0024f034b91efe5","type":"change","z":"8ac5ac42307c5911","name":"watchdog Alarm","rules":[{"t":"set","p":"payload","pt":"msg","to":"shelly plug s VPN länger als 10 min offline!","tot":"str"},{"t":"set","p":"WD_VPN","pt":"global","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1420,"y":820,"wires":[["91037bd9f6621d25"]]},{"id":"5c3f5bdcc686a06f","type":"function","z":"8ac5ac42307c5911","name":"midnight","func":"let midnight = parseFloat(msg.payload.meters[0].total) || 0;\nnode.status({text: midnight});\nreturn { topic: \"midnight\", payload:midnight};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":580,"wires":[["c47a3e9fa4d3be92"]]},{"id":"c69d330bc001c5d4","type":"ui_text","z":"8ac5ac42307c5911","group":"d5178392f725ae47","order":5,"width":"6","height":"1","name":"VPN-energy-tag","label":"Tag:","format":"{{msg.payload}}&nbsp;kWh","layout":"row-center","className":"","x":1300,"y":620,"wires":[]},{"id":"ed35e659ffc32152","type":"ui_template","z":"8ac5ac42307c5911","group":"d5178392f725ae47","name":"VPN-wifi","order":3,"width":"1","height":"1","format":"<div style=\"color:{{msg.payload}}; margin:auto;\" <i class=\"fa fa-wifi fa-1x\" aria-hidden=\"true\"> </i></div>\n<div>\n    <center>\n        <small><small><small>{{msg.topic}}</small></small></small>\n    </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1280,"y":420,"wires":[[]]},{"id":"ba1afd43bf0e2e1f","type":"link in","z":"8ac5ac42307c5911","name":"telegram out","links":["dbd434df290c7ccc","7011c80c99109772","b41418dd7e757344"],"x":1485,"y":700,"wires":[["91037bd9f6621d25"]]},{"id":"a8d689251431bbf0","type":"function","z":"8ac5ac42307c5911","name":"overtemperature","func":"if (msg.payload != \"0\"){\n    msg.payload = \"shelly pulg s VPN Overtemperature Alarm!\"\n    return msg;\n}\nelse {\n    return { reset: 0 };\n} \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1300,"y":780,"wires":[["9b9b68a2ca670c73"]]},{"id":"014dec58372a9ad3","type":"function","z":"8ac5ac42307c5911","name":"temp > 60","func":"if (msg.payload > 60){\n    msg.payload = \"shelly plug s VPN über 60 Grad!\"\n    return msg;\n}\nelse{\n    return{reset:0};\n}   \n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1280,"y":740,"wires":[["f3533e8bfad8e0a2"]]},{"id":"f3533e8bfad8e0a2","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1450,"y":740,"wires":[["91037bd9f6621d25"]]},{"id":"70d06acf0b2cf05f","type":"debug","z":"8ac5ac42307c5911","name":"debug 40","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1680,"y":740,"wires":[]},{"id":"9b9b68a2ca670c73","type":"rbe","z":"8ac5ac42307c5911","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1450,"y":780,"wires":[["91037bd9f6621d25"]]},{"id":"5f2bfa8d2ab7545a","type":"function","z":"8ac5ac42307c5911","name":"wifi","func":"node.status({ text: msg.payload.wifi_sta.rssi});\nreturn { topic: 'wifi', payload: msg.payload.wifi_sta.rssi};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":520,"wires":[["c47a3e9fa4d3be92"]]},{"id":"9a3dd5a5d10e21db","type":"inject","z":"8ac5ac42307c5911","name":"ervery midnight","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":true,"onceDelay":"2","topic":"mid_night","payload":"","payloadType":"date","x":130,"y":460,"wires":[["fd532125656d8500"]]},{"id":"6f569b7cc8777391","type":"inject","z":"8ac5ac42307c5911","name":"every 5 min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"1","topic":"5min","payload":"","payloadType":"date","x":150,"y":420,"wires":[["fd532125656d8500"]]},{"id":"9e452fd0f7c9a5d6","type":"switch","z":"8ac5ac42307c5911","name":"200","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"str"},{"t":"eq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":930,"y":460,"wires":[["b41418dd7e757344"],["134bf4c37eb35cf0"]]},{"id":"2bfeaecc7302f21e","type":"change","z":"8ac5ac42307c5911","name":"url 163","rules":[{"t":"set","p":"url","pt":"msg","to":"http://10.0.0.163/status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":460,"wires":[["397ec9a0afb01b76"]]},{"id":"cbdab224bdd6cde0","type":"switch","z":"8ac5ac42307c5911","name":"Topic","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"5min","vt":"str"},{"t":"eq","v":"mid_night","vt":"str"},{"t":"eq","v":"firmware","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":490,"y":580,"wires":[["5f2bfa8d2ab7545a"],["5c3f5bdcc686a06f"],["fd5363e43298ac2d"]]},{"id":"b41418dd7e757344","type":"link out","z":"8ac5ac42307c5911","name":"link out 22","mode":"link","links":["ba1afd43bf0e2e1f"],"x":1085,"y":460,"wires":[]},{"id":"d154d3841a1ce9f4","type":"link out","z":"8ac5ac42307c5911","name":"link out 35","mode":"link","links":["f633e61698bc93f8"],"x":1635,"y":780,"wires":[]},{"id":"c67d57a6146516f2","type":"ui_template","z":"8ac5ac42307c5911","group":"d5178392f725ae47","name":"VPN-Firmware","order":1,"width":"1","height":"1","format":"<div style=\"color:{{msg.color}}; margin:auto;\" <i class=\"{{msg.icon}}\" aria-hidden=\"true\"></i> </div>\n<div>\n    <center> <small><small><small>fw</small></small></small> </center>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":1300,"y":380,"wires":[[]]},{"id":"fd5363e43298ac2d","type":"function","z":"8ac5ac42307c5911","name":"firmware","func":"node.status({ text: msg.payload.update.has_update });\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":640,"wires":[["c47a3e9fa4d3be92"]]},{"id":"290882ea483ecb79","type":"inject","z":"8ac5ac42307c5911","name":"firmware 01:00","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 01 * * *","once":true,"onceDelay":"3","topic":"firmware","payload":"","payloadType":"date","x":140,"y":500,"wires":[["fd532125656d8500"]]},{"id":"59a5aa09eee2f884","type":"inject","z":"8ac5ac42307c5911","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":360,"wires":[["ae2af3f934efd0d3"]]},{"id":"ae2af3f934efd0d3","type":"change","z":"8ac5ac42307c5911","name":"","rules":[{"t":"set","p":"VPN_Stat","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":360,"wires":[[]]},{"id":"397ec9a0afb01b76","type":"http request","z":"8ac5ac42307c5911","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":790,"y":460,"wires":[["9e452fd0f7c9a5d6"]]},{"id":"25f7c9ce5dc00b34","type":"comment","z":"8ac5ac42307c5911","name":"to Telegram","info":"","x":1730,"y":780,"wires":[]},{"id":"5864751f3fb43d4b","type":"inject","z":"8ac5ac42307c5911","name":"reset","props":[{"p":"reset","v":"0","vt":"num"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":550,"y":760,"wires":[["01359424be369378","d6b3e5edef5b55b4"]]},{"id":"d6b3e5edef5b55b4","type":"change","z":"8ac5ac42307c5911","name":"WD_VPN on","rules":[{"t":"set","p":"WD_VPN","pt":"global","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":760,"wires":[[]]},{"id":"c47a3e9fa4d3be92","type":"function","z":"8ac5ac42307c5911","name":"shelly plugs VPN 2.0","func":"//=================================================================\nconst id = \"shellyplug-s-040DEB\";    // change id to your shelly id\n//=================================================================\n\nconst timestamp = date_time_string();\nnode_send({ payload: timestamp }, context.get('timestamp'));\nnode.status({ text: timestamp });\nlet wifiout = {};\n\nswitch (msg.topic) {\n    case \"shellies/\" + id + \"/relay/0\":\n        display_status();\n        break;        \n\n    case \"shellies/\" + id + \"/relay/0/power\":\n        display_power();\n        break;        \n\n    case \"shellies/\" + id + \"/relay/0/energy\":\n        display_energy();\n        break;        \n\n    case \"shellies/\" + id + \"/temperature\":\n        display_temperature();\n        break;        \n\n    case \"shellies/\" + id + \"/overtemperature\":\n        display_overtemperature();\n        break;        \n\n    case \"wifi\":\n        let wifiin = msg.payload;\n        wifiout = wifi_out(wifiin);\n        node_send(wifiout, context.get('wifi')); \n        break;       \n        \n    case \"midnight\":\n        context.set('midnight', msg.payload);\n        break;\n\n    case \"firmware\":\n        let update = msg.payload.update.has_update;\n        delete msg.payload;\n        if (update === true) {\n                         \n            node_send({ color: \"red\", icon: \"fa fa-cloud-download\" }, context.get('firmware'));\n        }\n        else {\n            node_send({ payload: timestamp }, context.get('timestamp'));\n            node_send({ color: \"green\", icon: \"fa fa-thumbs-up\" }, context.get('firmware'));\n        }\n        break;\n}\n\nreturn null;\n\n\n//========================================================================\n\nfunction display_status() {\n    let status = msg.payload;\n    status = status === 'off' ? '<font color=\"#000000\">off</font>' : '<font color=\"#ff0000\">on</font>';\n\n    node_send({ payload: status }, context.get('status'));\n}\n\n//--------------------------------------------------------------------\n\nfunction display_power() {\n    let power = msg.payload;\n\n    node_send({ payload: power }, context.get('power'));\n    node_send({ payload: power }, context.get('verlauf'));    \n}\n\n//--------------------------------------------------------------------\n\nfunction display_energy() {\n    let totalenergy = parseFloat(msg.payload);\n    totalenergy = check_energy(totalenergy);\n    let dayenergy = (totalenergy - context.get('midnight'));\n    totalenergy = parseFloat((totalenergy / 60 / 1000).toFixed(3));\n    dayenergy = parseFloat((dayenergy / 60 / 1000).toFixed(3));\n\n    node_send({ payload: totalenergy }, context.get('totalenergy'));\n    node_send({ payload: dayenergy }, context.get('dayenergy')); \n}\n\n//--------------------------------------------------------------------\n\nfunction display_temperature() {\n    let temperature = parseFloat(msg.payload) || 0;\n    let temperaturealarm = temperature;\n    if (temperature < 60) {\n        temperature = '<font color=\"green\">' + temperature + '</font>';\n    }\n    else {\n        temperature = '<font color=\"red\">' + temperature + '</font>';\n    }\n    node_send({ payload: temperature }, context.get('temperature'));\n    node_send({ payload: temperaturealarm }, context.get('temperaturealarm')); \n}\n\n//--------------------------------------------------------------------\n\nfunction display_overtemperature() {\n    let overtemperature = msg.payload || 0;\n    node_send({ payload: overtemperature }, context.get('overtemperature'));\n}\n\n//====================================================================\n\nfunction node_send(value, port) {\n    const messages = new Array(node.outputCount);\n    messages[port] = value;\n    node.send(messages);\n}\n\n//====================================================================\n\nfunction check_energy(data) {\n    let new_energy = data;\n    if (new_energy < context.get('last_energy')) {\n        new_energy = new_energy + context.get('last_energy');\n    }\n    context.set('last_energy', new_energy);\n    return new_energy;\n}\n\n/*\n\n// persisting energy data --> need to change config.js\n\nfunction check_energy(data) {\n    let new_energy = data;\n    if (new_energy < context.get('last_energy,file')) {\n        new_energy = new_energy + context.get('last_energy,file');\n    }\n    context.set('last_energy,file', new_energy);\n    //node.warn(new_energy);\n    return new_energy;\n}\n\n*/\n\n//--------------------------------------------------------------------\n\nfunction wifi_out(wifiin) {\n    let rssi = wifiin;\n    let color;\n    if (rssi < -80) {\n        color = 'red';\n    }\n    else if (rssi < -70) {\n        color = '#FFC300';\n    }\n    else {\n        color = 'green';\n    }\n    rssi = rssi.toString();\n    return ({ \"topic\": rssi, \"payload\": color });\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 = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    return datetimestring;\n}\n\n//--------------------------------------------------------------------","outputs":10,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\ncontext.set('firmware',0);\ncontext.set('wifi', 1);\ncontext.set('timestamp', 2);\ncontext.set('power', 3);\ncontext.set('verlauf', 3);\ncontext.set('totalenergy', 4);\ncontext.set('dayenergy', 5);\ncontext.set('status', 6);\ncontext.set('temperature', 7);\ncontext.set('temperaturealarm', 8);\ncontext.set('overtemperature', 9);\n\ncontext.set('last_energy', 0.0);","finalize":"","libs":[],"x":1000,"y":580,"wires":[["c67d57a6146516f2"],["ed35e659ffc32152"],["36555df3eb8a5eb2"],["d6ff683a9330f8e5","62b509263e8777b9"],["639948b701b222f5"],["c69d330bc001c5d4"],["5a11eb44ee184b34"],["126702277bb45ff3"],["014dec58372a9ad3"],["a8d689251431bbf0"]]},{"id":"ed8dd632559d2a94","type":"switch","z":"8ac5ac42307c5911","name":"WD_VPN on","property":"WD_VPN","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":460,"wires":[["2bfeaecc7302f21e"]]},{"id":"fd532125656d8500","type":"switch","z":"8ac5ac42307c5911","name":"VPN_Stat on","property":"VPN_Stat","propertyType":"global","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":460,"wires":[["ed8dd632559d2a94"]]},{"id":"67f38a6ed90b27c7","type":"junction","z":"8ac5ac42307c5911","x":1220,"y":420,"wires":[[]]},{"id":"91037bd9f6621d25","type":"junction","z":"8ac5ac42307c5911","x":1560,"y":760,"wires":[["70d06acf0b2cf05f","d154d3841a1ce9f4"]]},{"id":"134bf4c37eb35cf0","type":"junction","z":"8ac5ac42307c5911","x":340,"y":520,"wires":[["cbdab224bdd6cde0"]]},{"id":"cd22249708dd2da4","type":"junction","z":"8ac5ac42307c5911","x":780,"y":700,"wires":[["c47a3e9fa4d3be92"]]},{"id":"d5178392f725ae47","type":"ui_group","name":"Group 1","tab":"743fd75e.f52cb8","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"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":""},{"id":"743fd75e.f52cb8","type":"ui_tab","name":"Meßsteckdosen","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Ich versuche das ganze einzurichten und erhalte folgende Fehlermeldung.

"Error: target link-in node 'd59a2325dd14c795' not found"

Wer kann mir Bitte helfen?

Mit freundlichen Grüßen
Frank

Hi Frank,
ich freue mich, dass Du mein Modul nutzt.
Folgendes ist zu tun:

  1. Shelly MQTT einschalten
  2. IP Adresse des Shelly's ermitteln
  3. MQTT Server im Netz einrichten
    Kopiere meine nodes in einen Flow und trage dann dort die IP Adresse Deines Shelly's ein.
    In diesen nodes findest Du einen grauen link call node der einen zentralen HTTP-request aufruft.
    Ich füge dir hier die entsprechenden nodes ein welche Du dann am besten in einen seperaten Flow kopierst.
    Dann sollte alles funtionieren :-).
[{"id":"d59a2325dd14c795","type":"link in","z":"3c910825e08b5d8c","name":"http-request-in","links":[],"x":105,"y":200,"wires":[["cf4c00a83026702e"]]},{"id":"e68047ac842dec83","type":"http request","z":"3c910825e08b5d8c","name":"single HTTP request","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":840,"y":200,"wires":[["318d1a387dd6fefa","94280fbadd4967bf","b68f7ae31ac3a47e"]]},{"id":"94280fbadd4967bf","type":"link out","z":"3c910825e08b5d8c","name":"http-request-out","mode":"return","links":[],"x":1035,"y":200,"wires":[]},{"id":"cf4c00a83026702e","type":"delay","z":"3c910825e08b5d8c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":240,"y":200,"wires":[["5ab34b4781bc1caf","df7750b047be4014"]]},{"id":"5ab34b4781bc1caf","type":"function","z":"3c910825e08b5d8c","name":"requestTimeout","func":"let z = date_time_string();\nlet to = 12000;\nlet s = z + \" | \" + msg.url + \" | \" + to + \"ms\"\nnode.status({ text: s });\n//msg.headers = {};\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,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":200,"wires":[["e68047ac842dec83"]]},{"id":"318d1a387dd6fefa","type":"debug","z":"3c910825e08b5d8c","name":" debug out","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"","statusType":"counter","x":1080,"y":140,"wires":[]},{"id":"df7750b047be4014","type":"debug","z":"3c910825e08b5d8c","name":"debug in","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"","statusType":"counter","x":480,"y":140,"wires":[]},{"id":"9cd47f96db4c3ff4","type":"file","z":"3c910825e08b5d8c","name":"http-error-file","filename":"filename","filenameType":"msg","appendNewline":true,"createDir":true,"overwriteFile":"false","x":1010,"y":340,"wires":[[]]},{"id":"5c568b90c8060dfd","type":"function","z":"3c910825e08b5d8c","name":"function 4","func":"let count;\nlet t = msg.date\nlet m = msg.payload;\nlet c = counter();\nlet s = t + \" | \" + m + \" | \" + c;\nnode.status({ fill: \"red\", shape: \"dot\", text: s });\nlet p = t + \": \" + msg.payload;\nmsg.payload = p;\nmsg.filename = \"/home/pi/logs/http-error.txt\";\nnode.error(p);\nreturn msg;\n\n//-----------------------------------------------------------------------\n\nfunction counter(){\n    count = context.get('count');    \n    count += 1;\n    context.set('count', count);\n    return count;\n}","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ncontext.set('count',0);","finalize":"","libs":[],"x":740,"y":340,"wires":[["9cd47f96db4c3ff4"]]},{"id":"b68f7ae31ac3a47e","type":"switch","z":"3c910825e08b5d8c","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"neq","v":"200","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":290,"y":320,"wires":[["9f7a1cabf228adde","edc5b91a18992ab2"]]},{"id":"9f7a1cabf228adde","type":"change","z":"3c910825e08b5d8c","name":"HH:mm:ss DD-MM-YYYY","rules":[{"t":"set","p":"date","pt":"msg","to":"$moment().format(\"HH:mm:ss DD-MM-YYYY\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":340,"wires":[["5c568b90c8060dfd"]]},{"id":"a46c1edbaae12c0f","type":"inject","z":"3c910825e08b5d8c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Test für logging http-request","payloadType":"str","x":290,"y":360,"wires":[["9f7a1cabf228adde"]]},{"id":"edc5b91a18992ab2","type":"debug","z":"3c910825e08b5d8c","name":" ","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"","statusType":"counter","x":415,"y":300,"wires":[],"l":false}]

Danke, Punkt 1-3 habe ich schon, jetzt schnappe ich mir mal den neuen Code....

Hallo juntiedt
Ich habe mir den ersten Code geschnappt und muss vermutlich da wo die blauen Peile sind noch etwas ändern?

du hast nicht die neuste Version.
gehe über Deinen post und lade da die neuste software.
Mein Text dort startet so : After running my shelly plug s monitoring for a while ......

Wenn Du den haupt-node öffnest findest Du in der ersten Zeile die Daten für Deinen shelly. Die musst Du anpassen. Das ist alles, was Du in diesem Node machen musst.

Eins noch, falls der http request mit timeout endet, wird die http-Abfrage gestoppt (sw-update etc) um nicht viel Fehlermeldungen zu verursachen. Du kannst es mit einem inject node ziemlich unten im Flow resetten.