Hier das versprochene Subflow zum abfragen des NUT Servers.
Code: Alles auswählen
[{"id":"87ce2b97.60f178","type":"subflow","name":"USV / UPS","info":"# **USV / UPS NUT Server auslesen**\n[> homematic-forum Link <](https://homematic-forum.de/forum/viewtopic.php?f=77&t=57221)\n\n---\n\n## **INPUT**\n * Poll\n\n---\n## **OUTPUT**\n\n1. _QUITT_\n2. ups.status\n3. battery.charge\n4. battery.runtime\n5. battery.type\n6. ups.model\n7. ups.beeper.status\n8. output.voltage\n9. ups.load\n10. output.frequency.nominal\n11. _all Monitoring_\n\n\n---\n## _all Monitoring Bsp. output_\n\n - {\n - \t\"battery\": {\n - \t\t\"charge\": \"98\",\n - \t\t\"date\": \"not set\",\n - \t\t\"mfr\": {\n - \t\t\t\"date\": \"xxxx/xx/xx\"\n - \t\t},\n - \t\t\"runtime\": \"1785\",\n - \t\t\"type\": \"PbAc\",\n - \t\t\"voltage\": \"13.7\",\n - \t\t\"chargeState\": 100,\n - \t\t\"chargeState10\": 100,\n - \t\t\"chargeState20\": 100,\n - \t\t\"chargeChanged\": false\n - \t},\n - \t\"device\": {\n - \t\t\"mfr\": \"APC/EATON\",\n - \t\t\"model\": \"xxxxx\",\n - \t\t\"serial\": \"yyyy\",\n - \t\t\"type\": \"ups\"\n - \t},\n - \t\"driver\": {\n - \t\t\"name\": \"usbhid-ups\",\n - \t\t\"parameter\": {\n - \t\t\t\"pollfreq\": \"30\",\n - \t\t\t\"pollinterval\": \"10\",\n - \t\t\t\"port\": \"auto\",\n - \t\t\t\"synchronous\": \"no\"\n - \t\t},\n - \t\t\"version\": \"0815\"\n - \t},\n - \t\"input\": {\n - \t\t\"sensitivity\": \"medium\",\n - \t\t\"transfer\": {\n - \t\t\t\"high\": \"266\",\n - \t\t\t\"low\": \"180\"\n - \t\t},\n - \t\t\"voltage\": \"230.0\"\n - \t},\n - \t\"ups\": {\n - \t\t\"beeper\": {\n - \t\t\t\"status\": \"enabled\"\n - \t\t},\n - \t\t\"delay\": {\n - \t\t\t\"shutdown\": \"20\"\n - \t\t},\n - \t\t\"firmware\": \"x.x.x.x\",\n - \t\t\"load\": \"14\",\n - \t\t\"mfr\": \"xxx\",\n - \t\t\"model\": \"xxx\",\n - \t\t\"productid\": \"3456\",\n - \t\t\"serial\": \"yyy\",\n - \t\t\"status\": \"OL\",\n - \t\t\"timer\": {\n - \t\t\t\"reboot\": \"0\",\n - \t\t\t\"shutdown\": \"-1\"\n - \t\t},\n - \t\t\"vendorid\": \"xxx\",\n - \t\t\"isOnline\": true,\n - \t\t\"onBattery\": false,\n - \t\t\"discharging\": false,\n - \t\t\"charging\": false,\n - \t\t\"statusCodes\": [\"OL\"],\n - \t\t\"statusText\": \"On line (no power failure) (opposite of OB - on battery)\"\n - \t}\n - }\n\n\n---\n\n**Großen Dank an Hypnos!**\n\n\n## _erstellt durch [Matten Matten](https://homematic-forum.de/forum/memberlist.php?mode=viewprofile&u=25846)._\n","category":"USV","in":[{"x":60,"y":100,"wires":[{"id":"b86f61ef.cc2c4"}]}],"out":[{"x":1560,"y":400,"wires":[{"id":"320cdd2b.27fa82","port":0}]},{"x":1560,"y":460,"wires":[{"id":"69d0fc23.285e34","port":0}]},{"x":1560,"y":520,"wires":[{"id":"12484e86.c66b61","port":0}]},{"x":1560,"y":580,"wires":[{"id":"e9b7137e.10639","port":0}]},{"x":1560,"y":640,"wires":[{"id":"b0495451.4f5a48","port":0}]},{"x":1560,"y":700,"wires":[{"id":"6660227f.d632dc","port":0}]},{"x":1560,"y":760,"wires":[{"id":"13b5898c.2573c6","port":0}]},{"x":1560,"y":820,"wires":[{"id":"b005bb8b.f04f68","port":0}]},{"x":1560,"y":880,"wires":[{"id":"6855d798.6312e8","port":0}]},{"x":1560,"y":940,"wires":[{"id":"a92fb2.f1b6005","port":0}]},{"x":1560,"y":340,"wires":[{"id":"30a40996.570e46","port":0}]}],"env":[{"name":"DEBUG","type":"bool","value":"true","ui":{"icon":"font-awesome/fa-bug","label":{"en-US":"Debug"},"type":"checkbox","opts":{}}},{"name":"EXEC","type":"str","value":"","ui":{"icon":"font-awesome/fa-address-card-o","label":{"en-US":"UPS Name","de":"UPS Name"},"type":"input","opts":{"types":["str"]}}},{"name":"POLL","type":"str","value":"0","ui":{"icon":"font-awesome/fa-retweet","label":{"en-US":"Pollintervall"},"type":"select","opts":{"opts":[{"l":{"en-US":"deaktiviert"},"v":"0"},{"l":{"en-US":"5 Sekunden"},"v":"5"},{"l":{"en-US":"10 Sekunden"},"v":"10"},{"l":{"en-US":"15 Sekunden"},"v":"15"},{"l":{"en-US":"20 Sekunden"},"v":"20"},{"l":{"en-US":"25 Sekunden"},"v":"25"},{"l":{"en-US":"30 Sekunden"},"v":"30"},{"l":{"en-US":"1 Minute"},"v":"60"}]}}}],"color":"#F56666","inputLabels":["POLL"],"outputLabels":["QUITT","ups.status","battery.charge","battery.runtime","battery.type","ups.model","ups.beeper.status","output.voltage","ups.load","output.frequency.nominal",""],"icon":"font-awesome/fa-battery-3","status":{"x":680,"y":1280,"wires":[{"id":"c869d24.818613","port":0},{"id":"b0ef48af.559d28","port":0},{"id":"9015a060.7024c","port":0},{"id":"c382e0f1.056b3","port":0},{"id":"54e958c.2f560a8","port":0},{"id":"533f7427.3ff8fc","port":0},{"id":"b3a90358.f1ff1","port":0},{"id":"41c454a.10469ac","port":0},{"id":"cc1d9db.fcc746","port":0},{"id":"172f5b68.453fa5","port":0}]}},{"id":"b668a6f7.530b58","type":"debug","z":"87ce2b97.60f178","name":"USV Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1250,"y":400,"wires":[]},{"id":"cef17131.d26a1","type":"function","z":"87ce2b97.60f178","name":"format","func":"\ntry {\n const outData = {};\n if (msg.payload) {\n const inData = msg.payload.split('\\n');\n inData.forEach(element => {\n let val = element.split(':');\n let id=val[0].trim().split('.');\n setObj(outData,id,val[1]);\n });\n global.set('USV',outData,'file');\n msg.payload = outData;\n }\n msg.topic = 'USV';\n msg.measurement = 'USV';\n \n outData.ups.isOnline = false;\n outData.ups.onBattery = true;\n outData.ups.discharging = false;\n outData.ups.charging = false;\n \n if (outData && outData.ups && outData.ups.status) {\n outData.ups.statusCodes = outData.ups.status.split(' ');\n outData.battery.chargeState = parseFloat(outData.battery.charge);\n outData.battery.chargeState10 = (outData.battery.charge - (outData.battery.charge % 10));\n outData.battery.chargeState20 = (outData.battery.charge - (outData.battery.charge % 20));\n \n if (outData.ups.statusCodes.includes(\"OL\")) {\n outData.ups.statusText = \"On line (no power failure) (opposite of OB - on battery)\";\n outData.ups.isOnline = true;\n outData.ups.onBattery = false;\n } else if (outData.ups.statusCodes.includes(\"OB\")) {\n outData.ups.statusText = \"On Battery\";\n outData.ups.onBattery = true;\n outData.ups.isOnline = false;\n } else if (outData.ups.statusCodes.includes(\"LB\")) {\n outData.ups.statusText = \"Low battery\";\n } else if (outData.ups.statusCodes.includes(\"SD\")) {\n outData.ups.statusText = \"Shutdown load\";\n } else if (outData.ups.statusCodes.includes(\"CP\")) {\n outData.ups.isOnline = true;\n outData.ups.onBattery = false;\n outData.ups.statusText = \"Cable power (must be present for cable to have valid reading)\";\n } else if (outData.ups.statusCodes.includes(\"CTS\")) {\n outData.ups.statusText = \"Clear to Send. Received from the UPS.\";\n } else if (outData.ups.statusCodes.includes(\"RTS\")) {\n outData.ups.statusText = \"Ready to Send. Sent by the PC.\";\n } else if (outData.ups.statusCodes.includes(\"DCD\")) {\n outData.ups.statusText = \"Data Carrier Detect. Received from the UPS.\";\n } else if (outData.ups.statusCodes.includes(\"RNG\")) {\n outData.ups.statusText = \"Ring indicate. Received from the UPS.\";\n } else if (outData.ups.statusCodes.includes(\"DTR\")) {\n outData.ups.statusText = \"Data Terminal Ready. Sent by the PC.\";\n } else if (outData.ups.statusCodes.includes(\"ST\")) {\n outData.ups.statusText = \"Send a BREAK on the transmit data line\";\n } else {\n outData.ups.statusText = 'unknows state \"' + outData.ups.status + '\"';\n }\n \n if (outData.ups.statusCodes.includes(\"DISCHRG\")) {\n outData.ups.charging = false;\n outData.ups.discharging = true;\n return [msg, msg, null];\n } else if (outData.ups.statusCodes.includes(\"CHRG\")) {\n outData.ups.charging = true;\n outData.ups.discharging = false;\n return [msg, null, msg];\n }\n }\n \n let result = [msg, null, null];\n \n outData.battery.chargeChanged = false; \n const lastCharge = context.get('chargeState20');\n if (lastCharge != outData.battery.chargeState20) {\n context.set('chargeState20', outData.battery.chargeState20);\n outData.battery.chargeChanged = true;\n if (outData.ups.discharging || outData.ups.onBattery) {\n result[1] = msg;\n }\n }\n \n if (outData.ups.discharging || outData.ups.onBattery) {\n result[2] = msg;\n }\n \n \n return result;\n} catch (ex) {\n node.error('Error processing UPS output \"' + ex.message + '\"');\n}\nreturn null;\n\n// ----------------------------------------------------------------------------------\n\nfunction setObj(obj,list,val) {\n\tif (!val || !list) {\n\t\treturn;\n\t}\n\tlet id=list[0];\n list.splice(0, 1);\n if (list.length <= 0) {\n \tif (id) {\n \t\tobj[id] = val.trim();\n } else {\n \tobj = val.trim();\n }\n } else if (!id) {\n \tsetObj(obj,list,val);\n } else {\n \tif (!obj[id]) {\n \tobj[id] = {};\n }\n setObj(obj[id],list,val);\n }\n}","outputs":1,"noerr":0,"x":630,"y":400,"wires":[["6bf03939.ca1dc8","e1abf95d.719228","b6d4afc0.4e473","b6d139c3.a5b858","93d17328.15f8a","d10c87e8.48b2c8","43e9a8e.c25f958","66014b67.0077e4","d9008176.a5c2b","2977f12d.c3511e","30a40996.570e46"]]},{"id":"69d0fc23.285e34","type":"change","z":"87ce2b97.60f178","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"OL","fromt":"str","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"OB","fromt":"str","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":460,"wires":[["320cdd2b.27fa82"]]},{"id":"320cdd2b.27fa82","type":"switch","z":"87ce2b97.60f178","name":"OL","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1450,"y":400,"wires":[[]]},{"id":"a1b2b9f5.3bb778","type":"comment","z":"87ce2b97.60f178","name":"USV","info":"object\nbattery: object\ncharge: \"100\"\nruntime: \"4320\"\ntype: \"PbAc\"\nchargeState: 100\nchargeState10: 100\nchargeState20: 100\nchargeChanged: false\ndevice: object\nmfr: \"EATON\"\nmodel: \"Eaton 3S 550\"\nserial: \"Blank\"\ntype: \"ups\"\ndriver: object\nname: \"usbhid-ups\"\nparameter: object\npollfreq: \"30\"\npollinterval: \"2\"\nport: \"auto\"\nsynchronous: \"no\"\nversion: \"3.49.17.20200131-35-gcc1bc83d\"\ninput: object\ntransfer: object\nhigh: \"264\"\nlow: \"184\"\noutlet: object\n1: object\ndesc: \"PowerShare Outlet 1\"\nid: \"1\"\nstatus: \"on\"\nswitchable: \"no\"\ndesc: \"Main Outlet\"\nid: \"0\"\nswitchable: \"yes\"\noutput: object\nfrequency: object\nnominal: \"50\"\nvoltage: \"230.0\"\nups: object\nbeeper: object\nstatus: \"enabled\"\ndelay: object\nshutdown: \"20\"\nstart: \"30\"\nfirmware: \"02.04.0007\"\nload: \"0\"\nmfr: \"EATON\"\nmodel: \"Eaton 3S 550\"\npower: object\nnominal: \"550\"\nproductid: \"ffff\"\nserial: \"Blank\"\nstatus: \"OL\"\ntimer: object\nshutdown: \"-1\"\nstart: \"-1\"\ntype: \"offline / line interactive\"\nvendorid: \"0000\"\nisOnline: true\nonBattery: false\ndischarging: false\ncharging: false\nstatusCodes: array[1]\n0: \"OL\"\nstatusText: \"On line (no power failure) (opposite of OB - on battery)\"\n","x":90,"y":20,"wires":[]},{"id":"f11686c5.604148","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":460,"wires":[["69d0fc23.285e34"]]},{"id":"12484e86.c66b61","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":520,"wires":[[]]},{"id":"e9b7137e.10639","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":580,"wires":[[]]},{"id":"b0495451.4f5a48","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":640,"wires":[[]]},{"id":"6660227f.d632dc","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":700,"wires":[[]]},{"id":"13b5898c.2573c6","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":760,"wires":[[]]},{"id":"b005bb8b.f04f68","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":820,"wires":[[]]},{"id":"6855d798.6312e8","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":880,"wires":[[]]},{"id":"a92fb2.f1b6005","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":940,"wires":[[]]},{"id":"4f042450.a2cbfc","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1090,"y":400,"wires":[["b668a6f7.530b58"]]},{"id":"b86f61ef.cc2c4","type":"change","z":"87ce2b97.60f178","name":"DEBUG>EXEC>POLL ","rules":[{"t":"set","p":"DEBUG","pt":"msg","to":"DEBUG","tot":"env"},{"t":"set","p":"payload","pt":"msg","to":"EXEC","tot":"env"},{"t":"set","p":"POLL","pt":"msg","to":"POLL","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":100,"wires":[["d02ffc07.916a"]]},{"id":"6bf03939.ca1dc8","type":"switch","z":"87ce2b97.60f178","name":"DEBUG","property":"DEBUG","propertyType":"env","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":800,"y":400,"wires":[["4f042450.a2cbfc"]]},{"id":"d02ffc07.916a","type":"link out","z":"87ce2b97.60f178","name":"Input","links":["b85a9407.51bf28"],"x":415,"y":100,"wires":[]},{"id":"b85a9407.51bf28","type":"link in","z":"87ce2b97.60f178","name":"Input","links":["d02ffc07.916a"],"x":35,"y":400,"wires":[["4b1f0a47.898d94"]]},{"id":"4b1f0a47.898d94","type":"switch","z":"87ce2b97.60f178","name":"","property":"payload","propertyType":"msg","rules":[{"t":"empty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":130,"y":400,"wires":[["2dae9d59.b8c0c2","7051c812.07f9d8"],["cac2e073.434c2"]]},{"id":"cac2e073.434c2","type":"exec","z":"87ce2b97.60f178","command":"upsc ","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"exec Befehl","x":310,"y":440,"wires":[["582e052c.f42b3c","362313ad.6d505c"],["c077a63b.785728"],[]]},{"id":"2dae9d59.b8c0c2","type":"exec","z":"87ce2b97.60f178","d":true,"command":"upsc eaton3s","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Name leer","x":310,"y":320,"wires":[["54474ea3.460cd","362313ad.6d505c"],["c077a63b.785728"],[]]},{"id":"b0ef48af.559d28","type":"function","z":"87ce2b97.60f178","name":"dot","func":"msg.payload = {fill:\"yellow\",shape:\"dot\",text:\"aktualisiere...\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1200,"wires":[[]]},{"id":"c869d24.818613","type":"function","z":"87ce2b97.60f178","name":"ring","func":"msg.payload = {fill:\"yellow\",shape:\"ring\",text:\"aktualisiere...\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1080,"wires":[[]]},{"id":"eef536a5.4a84f8","type":"switch","z":"87ce2b97.60f178","name":"${POLL}","property":"POLL","propertyType":"env","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"5","vt":"str"},{"t":"eq","v":"10","vt":"str"},{"t":"eq","v":"15","vt":"str"},{"t":"eq","v":"20","vt":"str"},{"t":"eq","v":"25","vt":"str"},{"t":"eq","v":"30","vt":"str"},{"t":"eq","v":"60","vt":"str"}],"checkall":"false","repair":false,"outputs":8,"x":1000,"y":140,"wires":[[],["2532d87d.15d7d8"],["72687f45.8eea5"],["e05a0d6e.20a9b"],["c66990a8.f0edb"],["a4882d05.d2bfa"],["68b8fc15.4a28c4"],["7724ff76.b16bc"]]},{"id":"f5da662f.5d9ee8","type":"inject","z":"87ce2b97.60f178","name":"Poll","topic":"","payload":"Poll","payloadType":"str","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":850,"y":140,"wires":[["eef536a5.4a84f8"]]},{"id":"2532d87d.15d7d8","type":"delay","z":"87ce2b97.60f178","name":"5s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":20,"wires":[["d871c790.0324a8"]]},{"id":"72687f45.8eea5","type":"delay","z":"87ce2b97.60f178","name":"10s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":60,"wires":[["d871c790.0324a8"]]},{"id":"e05a0d6e.20a9b","type":"delay","z":"87ce2b97.60f178","name":"15s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"15","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":100,"wires":[["d871c790.0324a8"]]},{"id":"c66990a8.f0edb","type":"delay","z":"87ce2b97.60f178","name":"20s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"20","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":140,"wires":[["d871c790.0324a8"]]},{"id":"a4882d05.d2bfa","type":"delay","z":"87ce2b97.60f178","name":"25s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"25","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":180,"wires":[["d871c790.0324a8"]]},{"id":"68b8fc15.4a28c4","type":"delay","z":"87ce2b97.60f178","name":"30s","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":220,"wires":[["d871c790.0324a8"]]},{"id":"7724ff76.b16bc","type":"delay","z":"87ce2b97.60f178","name":"1min","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1210,"y":260,"wires":[["d871c790.0324a8"]]},{"id":"d871c790.0324a8","type":"link out","z":"87ce2b97.60f178","name":"Poll","links":["63970d9a.212ee4"],"x":1420,"y":160,"wires":[]},{"id":"63970d9a.212ee4","type":"link in","z":"87ce2b97.60f178","name":"Poll","links":["d871c790.0324a8"],"x":55,"y":160,"wires":[["b86f61ef.cc2c4"]]},{"id":"c382e0f1.056b3","type":"function","z":"87ce2b97.60f178","name":"ring","func":"msg.payload = {fill:\"green\",shape:\"ring\",text:msg.POLL + \"s\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1040,"wires":[[]]},{"id":"9015a060.7024c","type":"function","z":"87ce2b97.60f178","name":"dot","func":"msg.payload = {fill:\"green\",shape:\"dot\",text:msg.POLL + \"s\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1160,"wires":[[]]},{"id":"1a2e6894.57d567","type":"delay","z":"87ce2b97.60f178","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":1040,"wires":[["c382e0f1.056b3"]]},{"id":"9f45662b.5e9218","type":"delay","z":"87ce2b97.60f178","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":1160,"wires":[["9015a060.7024c"]]},{"id":"9a4f003e.ae492","type":"link in","z":"87ce2b97.60f178","name":"","links":["54474ea3.460cd"],"x":115,"y":1080,"wires":[["c869d24.818613","9d254732.581b38"]]},{"id":"54474ea3.460cd","type":"link out","z":"87ce2b97.60f178","name":"","links":["9a4f003e.ae492"],"x":475,"y":440,"wires":[]},{"id":"582e052c.f42b3c","type":"link out","z":"87ce2b97.60f178","name":"","links":["5df1e0a3.d3683"],"x":475,"y":480,"wires":[]},{"id":"5df1e0a3.d3683","type":"link in","z":"87ce2b97.60f178","name":"","links":["582e052c.f42b3c"],"x":115,"y":1200,"wires":[["b0ef48af.559d28","b77df038.c342c"]]},{"id":"9d254732.581b38","type":"switch","z":"87ce2b97.60f178","name":"","property":"POLL","propertyType":"env","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":250,"y":1020,"wires":[["45385dbb.624e04"],["1a2e6894.57d567"]]},{"id":"54e958c.2f560a8","type":"function","z":"87ce2b97.60f178","name":"ring","func":"msg.payload = {fill:\"green\",shape:\"ring\",text:\"\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1000,"wires":[[]]},{"id":"45385dbb.624e04","type":"delay","z":"87ce2b97.60f178","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":1000,"wires":[["54e958c.2f560a8"]]},{"id":"533f7427.3ff8fc","type":"function","z":"87ce2b97.60f178","name":"dot","func":"msg.payload = {fill:\"green\",shape:\"dot\",text:\"\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1120,"wires":[[]]},{"id":"f87fb1dc.f8a6f","type":"delay","z":"87ce2b97.60f178","name":"1s","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":390,"y":1120,"wires":[["533f7427.3ff8fc"]]},{"id":"b77df038.c342c","type":"switch","z":"87ce2b97.60f178","name":"","property":"POLL","propertyType":"env","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":250,"y":1140,"wires":[["f87fb1dc.f8a6f"],["9f45662b.5e9218"]]},{"id":"e1abf95d.719228","type":"change","z":"87ce2b97.60f178","name":"payload.ups.status","rules":[{"t":"move","p":"payload.ups.status","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":460,"wires":[["f11686c5.604148"]]},{"id":"b6d4afc0.4e473","type":"change","z":"87ce2b97.60f178","name":"payload.battery.charge","rules":[{"t":"move","p":"payload.battery.charge","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":520,"wires":[["12484e86.c66b61"]]},{"id":"b6d139c3.a5b858","type":"function","z":"87ce2b97.60f178","name":"payload.battery.runtime","func":"msg.payload = (msg.payload.battery.runtime/60).toFixed(1);\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":580,"wires":[["e9b7137e.10639"]]},{"id":"93d17328.15f8a","type":"change","z":"87ce2b97.60f178","name":"payload.battery.type","rules":[{"t":"move","p":"payload.battery.type","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":640,"wires":[["b0495451.4f5a48"]]},{"id":"d10c87e8.48b2c8","type":"change","z":"87ce2b97.60f178","name":"payload.ups.model","rules":[{"t":"move","p":"payload.ups.model","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":700,"wires":[[]]},{"id":"43e9a8e.c25f958","type":"change","z":"87ce2b97.60f178","name":"payload.ups.beeper.status","rules":[{"t":"move","p":"payload.ups.beeper.status","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":760,"wires":[["13b5898c.2573c6"]]},{"id":"66014b67.0077e4","type":"change","z":"87ce2b97.60f178","name":"payload.output.voltage","rules":[{"t":"move","p":"payload.output.voltage","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":820,"wires":[["b005bb8b.f04f68"]]},{"id":"d9008176.a5c2b","type":"change","z":"87ce2b97.60f178","name":"payload.ups.load","rules":[{"t":"move","p":"payload.ups.load","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":880,"wires":[["6855d798.6312e8"]]},{"id":"2977f12d.c3511e","type":"change","z":"87ce2b97.60f178","name":"payload.output.frequency.nominal","rules":[{"t":"move","p":"payload.output.frequency.nominal","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":940,"wires":[["a92fb2.f1b6005"]]},{"id":"368c298e.bfb796","type":"catch","z":"87ce2b97.60f178","name":"","scope":["cac2e073.434c2","2dae9d59.b8c0c2"],"uncaught":false,"x":120,"y":1280,"wires":[["b3a90358.f1ff1","9d132a93.dc01e8"]]},{"id":"b3a90358.f1ff1","type":"function","z":"87ce2b97.60f178","name":"error!","func":"//msg.status = {fill:\"green\",shape:\"dot\",text:\"hi\"};\nmsg.payload = {fill:\"red\",shape:\"ring\",text:\"Fehler keine Verbindung!\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1280,"wires":[[]]},{"id":"133f272d.215f59","type":"catch","z":"87ce2b97.60f178","name":"","scope":["cef17131.d26a1","b86f61ef.cc2c4","6bf03939.ca1dc8","eef536a5.4a84f8","e1abf95d.719228","b6d4afc0.4e473","b6d139c3.a5b858","93d17328.15f8a","d10c87e8.48b2c8","43e9a8e.c25f958","66014b67.0077e4","d9008176.a5c2b","2977f12d.c3511e"],"uncaught":false,"x":120,"y":1240,"wires":[["41c454a.10469ac"]]},{"id":"41c454a.10469ac","type":"function","z":"87ce2b97.60f178","name":"error!","func":"//msg.status = {fill:\"green\",shape:\"dot\",text:\"hi\"};\nmsg.payload = {fill:\"red\",shape:\"dot\",text:msg.error.message};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1240,"wires":[[]]},{"id":"11bda20e.2bda4e","type":"template","z":"87ce2b97.60f178","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n\t\"battery\": {\n\t\t\"charge\": \"98\",\n\t\t\"date\": \"not set\",\n\t\t\"mfr\": {\n\t\t\t\"date\": \"xxxx/xx/xx\"\n\t\t},\n\t\t\"runtime\": \"1785\",\n\t\t\"type\": \"PbAc\",\n\t\t\"voltage\": \"13.7\",\n\t\t\"chargeState\": 100,\n\t\t\"chargeState10\": 100,\n\t\t\"chargeState20\": 100,\n\t\t\"chargeChanged\": false\n\t},\n\t\"device\": {\n\t\t\"mfr\": \"APC/EATON\",\n\t\t\"model\": \"xxxxx\",\n\t\t\"serial\": \"yyyy\",\n\t\t\"type\": \"ups\"\n\t},\n\t\"driver\": {\n\t\t\"name\": \"usbhid-ups\",\n\t\t\"parameter\": {\n\t\t\t\"pollfreq\": \"30\",\n\t\t\t\"pollinterval\": \"10\",\n\t\t\t\"port\": \"auto\",\n\t\t\t\"synchronous\": \"no\"\n\t\t},\n\t\t\"version\": \"0815\"\n\t},\n\t\"input\": {\n\t\t\"sensitivity\": \"medium\",\n\t\t\"transfer\": {\n\t\t\t\"high\": \"266\",\n\t\t\t\"low\": \"180\"\n\t\t},\n\t\t\"voltage\": \"230.0\"\n\t},\n\t\"ups\": {\n\t\t\"beeper\": {\n\t\t\t\"status\": \"enabled\"\n\t\t},\n\t\t\"delay\": {\n\t\t\t\"shutdown\": \"20\"\n\t\t},\n\t\t\"firmware\": \"x.x.x.x\",\n\t\t\"load\": \"14\",\n\t\t\"mfr\": \"xxx\",\n\t\t\"model\": \"xxx\",\n\t\t\"productid\": \"3456\",\n\t\t\"serial\": \"yyy\",\n\t\t\"status\": \"OL\",\n\t\t\"timer\": {\n\t\t\t\"reboot\": \"0\",\n\t\t\t\"shutdown\": \"-1\"\n\t\t},\n\t\t\"vendorid\": \"xxx\",\n\t\t\"isOnline\": true,\n\t\t\"onBattery\": false,\n\t\t\"discharging\": false,\n\t\t\"charging\": false,\n\t\t\"statusCodes\": [\"OL\"],\n\t\t\"statusText\": \"On line (no power failure) (opposite of OB - on battery)\"\n\t}\n}","output":"str","x":1560,"y":160,"wires":[[]]},{"id":"ae4f8778.2e8638","type":"debug","z":"87ce2b97.60f178","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":350,"y":920,"wires":[]},{"id":"1ab7814b.71403f","type":"switch","z":"87ce2b97.60f178","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Error","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":210,"y":960,"wires":[["d12a764c.6146a8"]]},{"id":"fbf2ec9e.196ec","type":"switch","z":"87ce2b97.60f178","name":"","property":"DEBUG","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":210,"y":920,"wires":[["ae4f8778.2e8638"]]},{"id":"cc1d9db.fcc746","type":"function","z":"87ce2b97.60f178","name":"error!","func":"msg.payload = {fill:\"red\",shape:\"ring\",text:msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":960,"wires":[[]]},{"id":"d12a764c.6146a8","type":"delay","z":"87ce2b97.60f178","name":"","pauseType":"delay","timeout":"2500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":380,"y":960,"wires":[["cc1d9db.fcc746"]]},{"id":"c077a63b.785728","type":"link out","z":"87ce2b97.60f178","name":"errorDebug","links":["c67fc9ae.7da2b8"],"x":475,"y":520,"wires":[]},{"id":"c67fc9ae.7da2b8","type":"link in","z":"87ce2b97.60f178","name":"errorDebug","links":["c077a63b.785728"],"x":95,"y":940,"wires":[["fbf2ec9e.196ec","1ab7814b.71403f"]]},{"id":"c3244b8a.952a08","type":"debug","z":"87ce2b97.60f178","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"error.message","targetType":"msg","x":510,"y":1320,"wires":[]},{"id":"9d132a93.dc01e8","type":"switch","z":"87ce2b97.60f178","name":"","property":"DEBUG","propertyType":"env","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":310,"y":1320,"wires":[["c3244b8a.952a08"]]},{"id":"7d61f0a6.9a32","type":"catch","z":"87ce2b97.60f178","name":"","scope":["cef17131.d26a1"],"uncaught":false,"x":120,"y":1320,"wires":[["9d132a93.dc01e8"]]},{"id":"362313ad.6d505c","type":"switch","z":"87ce2b97.60f178","name":"n leer","property":"payload","propertyType":"msg","rules":[{"t":"nempty"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":400,"wires":[["cef17131.d26a1"]]},{"id":"7051c812.07f9d8","type":"link out","z":"87ce2b97.60f178","name":"","links":["d4d0f682.099a98"],"x":275,"y":380,"wires":[]},{"id":"d4d0f682.099a98","type":"link in","z":"87ce2b97.60f178","name":"","links":["7051c812.07f9d8"],"x":120,"y":860,"wires":[["172f5b68.453fa5"]]},{"id":"172f5b68.453fa5","type":"function","z":"87ce2b97.60f178","name":"error!","func":"msg.payload = {fill:\"red\",shape:\"ring\",text:\"Config leer!\"};\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":860,"wires":[[]]},{"id":"30a40996.570e46","type":"rbe","z":"87ce2b97.60f178","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":790,"y":340,"wires":[[]]},{"id":"42c30f6f.8a04c","type":"inject","z":"ddb9262b.de6fd8","name":"Poll","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":620,"wires":[["c9f03d05.9c07"]]},{"id":"3f9fb54c.1a690a","type":"link in","z":"ddb9262b.de6fd8","name":"UPS","links":["8e7295b.8b0b468"],"x":75,"y":580,"wires":[["c9f03d05.9c07"]]},{"id":"c9f03d05.9c07","type":"subflow:87ce2b97.60f178","z":"ddb9262b.de6fd8","name":"","env":[{"name":"POLL","value":"30","type":"str"},{"name":"ups.status","value":"38","type":"num"},{"name":"battery.charge","value":"0","type":"num"},{"name":"battery.runtime","value":"2","type":"num"},{"name":"battery.type","value":"3","type":"num"},{"name":"ups.model","value":"34","type":"num"},{"name":"ups.beeper.status","value":"28","type":"num"},{"name":"output.voltage","value":"26","type":"num"},{"name":"ups.load","value":"32","type":"num"},{"name":"output.frequency.nominal","value":"25","type":"num"}],"x":410,"y":580,"wires":[["2e1824db.39fbfc"],["c4b33516.791708","853f1c35.17fde"],["6e1f4864.b673c8"],["e8f59436.8bd798"],["c22ce402.6eb228"],["4cad0ff8.f0048"],["e4bd9c8a.4e914"],["e1ee6c8d.6d04"],["c24e0909.990c08"],["5d8ccd3d.4aa8d4"],["d82e208f.e741b"]]},{"id":"3f462935.4f6d26","type":"comment","z":"ddb9262b.de6fd8","name":"USV Alarm Variable ausgelöst","info":"","x":180,"y":540,"wires":[]}]
Wenn ihr die Alarmvariable die vom NUT Server bei einem Alarm erzeugt wird, Umbenennen wollt