Compare commits

...

2 Commits

Author SHA1 Message Date
Joachim Hummel
3576b18a3d Merge branch 'master' of https://git.unixweb.net/unixweb/netzfrequenz 2024-03-13 12:36:49 +00:00
Joachim Hummel
43ba79ab43 New NodeRED Flow 2024-03-13 12:36:30 +00:00

503
flow.json
View File

@ -1 +1,502 @@
[{"id":"a9fa47cbeb7f0912","type":"tab","label":"Flow 4","disabled":false,"info":"","env":[]},{"id":"d832bb581bea7f25","type":"group","z":"a9fa47cbeb7f0912","name":"","style":{"fill":"#bfdbef","label":true},"nodes":["0317149365c4f1f3","0c550ef4e393e187","a355aee9340a9ecc","554b7037ebfa363c","8ac36b2b5f1715a3","0d745433e5a8f5af","f664981292095622","25ef36794cc4aa8c","74ecb656dd57f070","b54a398aef2e7f74","3a55a8ac75e45386","32c4ad773c4f1a5f","f2d4c58a0f0202a2"],"env":[],"x":74,"y":99,"w":1032,"h":382},{"id":"0317149365c4f1f3","type":"http request","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Frequenzmessung","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":530,"y":240,"wires":[["554b7037ebfa363c"]]},{"id":"0c550ef4e393e187","type":"debug","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":240,"wires":[]},{"id":"a355aee9340a9ecc","type":"inject","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":180,"y":240,"wires":[["f2d4c58a0f0202a2"]]},{"id":"554b7037ebfa363c","type":"xml","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"","property":"payload","attr":"","chr":"","x":710,"y":240,"wires":[["8ac36b2b5f1715a3"]]},{"id":"8ac36b2b5f1715a3","type":"function","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Lese Wert","func":"var freq = msg.payload.r.f[0];\nmsg.payload = freq;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":860,"y":240,"wires":[["0c550ef4e393e187","f664981292095622"]]},{"id":"0d745433e5a8f5af","type":"comment","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Netzfrequenz Überwachung","info":"","x":620,"y":140,"wires":[]},{"id":"f664981292095622","type":"switch","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Schwellwerte","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"49.800","vt":"str"},{"t":"gt","v":"50.050","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":340,"wires":[["3a55a8ac75e45386"],["3a55a8ac75e45386"]]},{"id":"25ef36794cc4aa8c","type":"telegram sender","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"","bot":"4d6abd77c5388fab","haserroroutput":true,"outputs":2,"x":960,"y":440,"wires":[[],[]]},{"id":"74ecb656dd57f070","type":"inject","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"","props":[{"p":"payload.text","v":"","vt":"date"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":510,"y":440,"wires":[["b54a398aef2e7f74"]]},{"id":"b54a398aef2e7f74","type":"function","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Sende zu Telegram","func":"var msg1 = msg.payload.text;\nmsg.payload = {}\nmsg.payload.chatId = XXXXXXX\nmsg.payload.type = \"message\"\nmsg.payload.content = msg1+\": Aktuelle Netzfrequenz\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":440,"wires":[["25ef36794cc4aa8c"]]},{"id":"3a55a8ac75e45386","type":"change","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Text Payload","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.text","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":340,"wires":[["b54a398aef2e7f74"]]},{"id":"32c4ad773c4f1a5f","type":"inject","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"Test","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"<r> <f>50.06</f> <n>C_4</n> <z> 04.11.2021 12:18:49</z> <p>064</p> <d>007</d> <dt>-15,84</dt> </r>","payloadType":"str","x":570,"y":180,"wires":[["554b7037ebfa363c"]]},{"id":"f2d4c58a0f0202a2","type":"function","z":"a9fa47cbeb7f0912","g":"d832bb581bea7f25","name":"URL","func":"var url0='https://netzfrequenzmessung.de:9080/frequenz01.xml';\nmsg.url = url0+\"?\"+Math.round(Math.random()*100000);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":240,"wires":[["0317149365c4f1f3"]]},{"id":"4d6abd77c5388fab","type":"telegram bot","botname":"Dein_Bot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]
[
{
"id": "f271535cb0921814",
"type": "tab",
"label": "Netzfrequenz",
"disabled": false,
"info": "",
"env": []
},
{
"id": "cc2580d9d9b74a34",
"type": "group",
"z": "f271535cb0921814",
"name": "",
"style": {
"fill": "#bfdbef",
"label": true
},
"nodes": [
"4fbf298b16d2175c",
"c8183ed878f00901",
"af094afe8cc6365e",
"71c5b266fd4e1dfb",
"daf1ab2ff2a82e33",
"9e155d6fc334cfd7",
"c73b80c80340c897",
"1b8c0534a8bf05aa",
"5593b637082408d4",
"e4d1c17a58350d3b",
"45d1deed8eb29e0b",
"b2c6ca466d31d233",
"a7bf87d44b312b3b",
"3683993178d2b5f1",
"58b95e250e2977df",
"c762f0bf3b2b91f1"
],
"x": 134,
"y": 59,
"w": 1032,
"h": 342
},
{
"id": "4fbf298b16d2175c",
"type": "comment",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "Netzfrequenz Überwachung",
"info": "",
"x": 580,
"y": 100,
"wires": []
},
{
"id": "c8183ed878f00901",
"type": "switch",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "Schwellwerte",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lt",
"v": "49.850",
"vt": "str"
},
{
"t": "gt",
"v": "50.000",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 830,
"y": 160,
"wires": [
[
"daf1ab2ff2a82e33"
],
[]
]
},
{
"id": "af094afe8cc6365e",
"type": "inject",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "Test Telegram",
"props": [
{
"p": "payload.text",
"v": "50.01",
"vt": "str"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 470,
"y": 360,
"wires": [
[
"71c5b266fd4e1dfb"
]
]
},
{
"id": "71c5b266fd4e1dfb",
"type": "function",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "Sende zu Telegram",
"func": "var msg1 = msg.payload.text;\nmsg.payload = {}\nmsg.payload.chatId = 617681859\nmsg.payload.type = \"message\"\nmsg.payload.content = \"Aktuelle Netzfrequenz: \" +msg1+\" Hz\";\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 670,
"y": 360,
"wires": [
[
"e4d1c17a58350d3b"
]
]
},
{
"id": "daf1ab2ff2a82e33",
"type": "change",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "Text Payload",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "payload.text",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1010,
"y": 160,
"wires": [
[
"a7bf87d44b312b3b"
]
]
},
{
"id": "1b8c0534a8bf05aa",
"type": "inject",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "*/1 0-23 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 250,
"y": 160,
"wires": [
[
"c73b80c80340c897"
]
]
},
{
"id": "9e155d6fc334cfd7",
"type": "function",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "Netzfrequenz",
"func": "//msg.payload = (msg.payload.results[0].series[0].values[18][1])\n\n// Annahme: msg.payload enthält die Nummer 123456\n// let originalNumber = (msg.payload.results[0].series[0].values[4][1])\nlet originalNumber = (msg.payload[0].Frequency)\n\n// Die Nummer in eine Zeichenkette umwandeln\nlet numberAsString = originalNumber.toString();\n\n// Die ersten drei Ziffern extrahieren\nlet shortenedNumber = numberAsString.substr(0, 6);\n\n\n// Erstellen Sie ein neues Nachrichtenobjekt mit dem gekürzten Wert\nlet newMsg = {\n payload: shortenedNumber\n};\n\n// Rückgabe des neuen Nachrichtenobjekts\nreturn newMsg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 650,
"y": 160,
"wires": [
[
"c8183ed878f00901",
"5593b637082408d4",
"45d1deed8eb29e0b",
"b2c6ca466d31d233",
"58b95e250e2977df"
]
]
},
{
"id": "c73b80c80340c897",
"type": "influxdb in",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"influxdb": "e5abf1603d3de1f1",
"name": "",
"query": "SELECT \"Frequency\" FROM \"autogen\".\"energy\" WHERE (\"meter\" = 'Meter Group 1') AND time >= now() - 5m AND time <= now() ORDER BY time DESC LIMIT 1",
"rawOutput": false,
"precision": "",
"retentionPolicy": "",
"org": "organisation",
"x": 440,
"y": 160,
"wires": [
[
"9e155d6fc334cfd7",
"c762f0bf3b2b91f1"
]
]
},
{
"id": "5593b637082408d4",
"type": "debug",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 120,
"wires": []
},
{
"id": "e4d1c17a58350d3b",
"type": "telegram sender",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "",
"bot": "5f67fb38.18d094",
"haserroroutput": false,
"outputs": 1,
"x": 880,
"y": 360,
"wires": [
[]
]
},
{
"id": "45d1deed8eb29e0b",
"type": "ui_gauge",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "",
"group": "5606a0cfcaa653f5",
"order": 0,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Netzfrequenz",
"label": "Hz",
"format": "{{value}}",
"min": "49",
"max": "51",
"colors": [
"#cc3333",
"#33cc33",
"#33cc33"
],
"seg1": "49.8",
"seg2": "",
"diff": false,
"className": "",
"x": 830,
"y": 200,
"wires": []
},
{
"id": "b2c6ca466d31d233",
"type": "ui_chart",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "",
"group": "5606a0cfcaa653f5",
"order": 1,
"width": 0,
"height": 0,
"label": "Netzfrequenz",
"chartType": "line",
"legend": "false",
"xformat": "HH:mm:ss",
"interpolate": "bezier",
"nodata": "",
"dot": true,
"ymin": "49",
"ymax": "51",
"removeOlder": 1,
"removeOlderPoints": "",
"removeOlderUnit": "3600",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 830,
"y": 240,
"wires": [
[]
]
},
{
"id": "a7bf87d44b312b3b",
"type": "link out",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "link out 1",
"mode": "link",
"links": [
"3683993178d2b5f1"
],
"x": 1125,
"y": 160,
"wires": []
},
{
"id": "3683993178d2b5f1",
"type": "link in",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "link in 1",
"links": [
"a7bf87d44b312b3b"
],
"x": 505,
"y": 300,
"wires": [
[
"71c5b266fd4e1dfb"
]
]
},
{
"id": "58b95e250e2977df",
"type": "mqtt out",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "",
"topic": "netz",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "020a2e05c51bd021",
"x": 810,
"y": 280,
"wires": []
},
{
"id": "c762f0bf3b2b91f1",
"type": "debug",
"z": "f271535cb0921814",
"g": "cc2580d9d9b74a34",
"name": "debug 4",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 620,
"y": 240,
"wires": []
},
{
"id": "e5abf1603d3de1f1",
"type": "influxdb",
"hostname": "192.168.0.8",
"port": "8086",
"protocol": "http",
"database": "db_meter_home",
"name": "DB-Meter Home",
"usetls": false,
"tls": "",
"influxdbVersion": "1.x",
"url": "http://localhost:8086",
"timeout": "",
"rejectUnauthorized": true
},
{
"id": "5f67fb38.18d094",
"type": "telegram bot",
"botname": "nodered",
"usernames": "",
"chatids": "59",
"baseapiurl": "",
"updatemode": "polling",
"pollinterval": "300",
"usesocks": false,
"sockshost": "",
"socksport": "6667",
"socksusername": "anonymous",
"sockspassword": "",
"bothost": "",
"botpath": "",
"localbotport": "8443",
"publicbotport": "8443",
"privatekey": "",
"certificate": "",
"useselfsignedcertificate": false,
"sslterminated": false,
"verboselogging": false
},
{
"id": "5606a0cfcaa653f5",
"type": "ui_group",
"name": "Standard",
"tab": "4b174893e72db361",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "020a2e05c51bd021",
"type": "mqtt-broker",
"name": "",
"broker": "mqtt.unixweb.eu",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "4b174893e72db361",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]