First Flow i get the Power....
[
{
"id": "ddd17256ad3d16a3",
"type": "tab",
"label": "Einspeisung - Zählerstände",
"disabled": false,
"info": "",
"env": [
{
"name": "Threshold",
"value": "-1050",
"type": "num"
}
]
},
{
"id": "3f1db29997650257",
"type": "smartmeter",
"z": "ddd17256ad3d16a3",
"name": "VZahlerstandZ1",
"datasource": "0fb0b4f0cce9c7a9",
"protocol": "SmlProtocol",
"transport": "SerialResponseTransport",
"requestInterval": "1",
"d0WakeupCharacters": "",
"d0SignOnMessage": "",
"d0BaudrateChangeoverOverwrite": "",
"protocolSmlIgnoreInvalidCRC": false,
"debugging": true,
"x": 100,
"y": 80,
"wires": [
[
"204c4d6691f0f95b",
"5dc24479545f7393",
"9b11b3dde8e4456b",
"f393b7a51e8505c4"
]
]
},
{
"id": "5dc24479545f7393",
"type": "debug",
"z": "ddd17256ad3d16a3",
"name": "Ausgelesene Daten",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 130,
"y": 140,
"wires": []
},
{
"id": "204c4d6691f0f95b",
"type": "function",
"z": "ddd17256ad3d16a3",
"name": "Auslesen der Wattzahl",
"func": "var StromZ2A = msg.payload[\"1-0:16.7.0*255\"].values[0].value;\n\nreturn [\n { payload: StromZ2A },\n]",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 80,
"wires": [
[
"bc59e3835caff765",
"c6974c6e6932abdb",
"1021df5268aa3460"
]
]
},
{
"id": "bc59e3835caff765",
"type": "debug",
"z": "ddd17256ad3d16a3",
"name": "Watt Einspeisung / Verbrauch Live pro Sekunde",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 640,
"y": 20,
"wires": []
},
{
"id": "c6974c6e6932abdb",
"type": "smooth",
"z": "ddd17256ad3d16a3",
"name": "Durchschnitt berechnen",
"property": "payload",
"action": "mean",
"count": "3",
"round": "0",
"mult": "multi",
"reduce": true,
"x": 570,
"y": 80,
"wires": [
[
"f277c1d6d773992d",
"e71926ad6b59b7f5"
]
]
},
{
"id": "9b11b3dde8e4456b",
"type": "function",
"z": "ddd17256ad3d16a3",
"name": "Zählerstand Einkauf",
"func": "var StromZ1A = msg.payload[\"1-0:1.8.0*255\"].values[0].value;\n\nreturn [\n { payload: StromZ1A },\n]",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 140,
"y": 220,
"wires": [
[
"d7022a8e40019a6f",
"8305383cc5422ac6"
]
]
},
{
"id": "d7022a8e40019a6f",
"type": "debug",
"z": "ddd17256ad3d16a3",
"name": "Zählerstand Einkauf",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 140,
"y": 280,
"wires": []
},
{
"id": "f393b7a51e8505c4",
"type": "function",
"z": "ddd17256ad3d16a3",
"name": "Zählerstand Verkauf",
"func": "var StromZ3A = msg.payload[\"1-0:2.8.0*255\"].values[0].value;\n\nreturn [\n { payload: StromZ3A },\n]",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 140,
"y": 340,
"wires": [
[
"62a501f2b9e43e4a",
"02aade26ac4759a8"
]
]
},
{
"id": "62a501f2b9e43e4a",
"type": "debug",
"z": "ddd17256ad3d16a3",
"name": "Zählerstand Verkauf",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 140,
"y": 400,
"wires": []
},
{
"id": "02aade26ac4759a8",
"type": "change",
"z": "ddd17256ad3d16a3",
"name": "übergebe Zählerstand Verkauf zum Template",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$round(payload, 0)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 340,
"wires": [
[
"e534c9db3955e7f5"
]
]
},
{
"id": "8305383cc5422ac6",
"type": "change",
"z": "ddd17256ad3d16a3",
"name": "übergebe Zählerstand Einkauf zum Template",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$round(payload, 0)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 450,
"y": 220,
"wires": [
[
"4ae9d2d26bec3f2e"
]
]
},
{
"id": "1021df5268aa3460",
"type": "ui_gauge",
"z": "ddd17256ad3d16a3",
"name": "Stromverbauch live Gauge",
"group": "3063edc21d564397",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "STROM",
"label": "units",
"format": "{{value}}",
"min": "-3800",
"max": "6000",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 580,
"y": 140,
"wires": []
},
{
"id": "4ae9d2d26bec3f2e",
"type": "ui_template",
"z": "ddd17256ad3d16a3",
"group": "941b98732acb116e",
"name": "Ausgabe Einkauf",
"order": 0,
"width": 0,
"height": 0,
"format": "EINKAUF\n<div ng-bind-html=\"msg.payload\"></div>",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 750,
"y": 220,
"wires": [
[]
]
},
{
"id": "e534c9db3955e7f5",
"type": "ui_template",
"z": "ddd17256ad3d16a3",
"group": "941b98732acb116e",
"name": "Ausgabe Verkauf",
"order": 1,
"width": 0,
"height": 0,
"format": "Verkauf\n<div ng-bind-html=\"msg.payload\"></div>",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 750,
"y": 340,
"wires": [
[]
]
},
{
"id": "f277c1d6d773992d",
"type": "debug",
"z": "ddd17256ad3d16a3",
"name": "Durchschnitt ausgabe",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 820,
"y": 120,
"wires": []
},
{
"id": "e71926ad6b59b7f5",
"type": "link out",
"z": "ddd17256ad3d16a3",
"name": "durschnitt ausgabe",
"mode": "link",
"links": [
"9182d91383ad9eb7",
"3b6f81c71fc4d5fe"
],
"x": 735,
"y": 80,
"wires": []
},
{
"id": "0fb0b4f0cce9c7a9",
"type": "smartmeter-connection",
"sourcetype": "serial",
"serialport": "/dev/ttyUSB0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"httphost": "localhost",
"httpport": "80",
"tcphost": "localhost",
"tcpport": "502",
"filepath": "/dev/null"
},
{
"id": "3063edc21d564397",
"type": "ui_group",
"name": "Aktuelle Einspeisung Verbrauch",
"tab": "fad73bed835f5485",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "941b98732acb116e",
"type": "ui_group",
"name": "Zählerstände",
"tab": "fad73bed835f5485",
"order": 2,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "fad73bed835f5485",
"type": "ui_tab",
"name": "Übersicht",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]
next flow i want to switch the power plugs
[
{
"id": "af5613b75f0b562a",
"type": "tab",
"label": "E-Heizungen",
"disabled": false,
"info": "",
"env": []
},
{
"id": "3b6f81c71fc4d5fe",
"type": "link in",
"z": "af5613b75f0b562a",
"name": "link in 1",
"links": [
"e71926ad6b59b7f5"
],
"x": 35,
"y": 80,
"wires": [
[
"4a11a0d4d5ac42db",
"286491866f8a0c91"
]
]
},
{
"id": "4a11a0d4d5ac42db",
"type": "function",
"z": "af5613b75f0b562a",
"name": "Befehl An/Aus erstellen",
"func": "var thr = flow.get(\"Threshold\");\nlet state = flow.get(\"state\") || \"unknown\";\nmsg.threshold = thr;\n\nvar durchschnitt = msg.payload;\nmsg.durchschnitt = durchschnitt;\n\nif (durchschnitt <= thr) {\n // AN\n msg.payload = 'on';\n flow.set(\"Threshold\", -50);\n flow.set(\"state\", \"on\");\n}\nelse \n{\n // AUS\n msg.payload = 'off';\n flow.set(\"Threshold\", -1050);\n flow.set(\"state\", \"off\");\n}\nif (state == msg.payload) return null ;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 210,
"y": 100,
"wires": [
[
"6e6f640bec6d1f8c",
"de6844fd24344d17"
]
],
"outputLabels": [
"on"
]
},
{
"id": "286491866f8a0c91",
"type": "debug",
"z": "af5613b75f0b562a",
"name": "Ø Verbrauch / Einspeisung",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 220,
"y": 40,
"wires": []
},
{
"id": "5d3f8a151369d559",
"type": "alexa-remote-routine",
"z": "af5613b75f0b562a",
"name": "Heizung 1050W einschalten",
"account": "f8eeb77e2edc13dc",
"routineNode": {
"type": "routine",
"payload": {
"routine": {
"type": "str",
"value": "amzn1.alexa.automation.xxx"
},
"device": {
"type": "str",
"value": "G091JJ1xxxx"
}
}
},
"x": 720,
"y": 60,
"wires": [
[]
]
},
{
"id": "b647244a04e0ccf7",
"type": "alexa-remote-routine",
"z": "af5613b75f0b562a",
"name": "Heizung 1050W ausschalten",
"account": "f8eeb77xxxxxxxxx",
"routineNode": {
"type": "routine",
"payload": {
"routine": {
"type": "str",
"value": "amzn1.alexa.automation.133913dd-1f40xxxxxxxxxxxxxx"
},
"device": {
"type": "str",
"value": "G091JJxxxxxx"
}
}
},
"x": 720,
"y": 120,
"wires": [
[]
]
},
{
"id": "6e6f640bexxxxxxx",
"type": "switch",
"z": "af5613b75f0b562a",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 430,
"y": 100,
"wires": [
[
"5d3f8a15136xxxxx",
"e6f7361e153axxxxxx"
],
[
"b647244a04exxxxxx",
"e6f7361e153xxxxxx"
]
]
},
{
"id": "de6844fd24344d17",
"type": "debug",
"z": "af5613b75f0b562a",
"name": "aktueller status ... wenn leer dann off",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 210,
"y": 160,
"wires": []
},
{
"id": "e6f7361e15xxxxx",
"type": "ui_text",
"z": "af5613b75f0b562a",
"group": "c6f8431344dcd050",
"order": 1,
"width": 0,
"height": 0,
"name": "Status Heizung 1050W",
"label": "",
"format": "{{msg.payload}}",
"layout": "col-center",
"className": "",
"x": 700,
"y": 180,
"wires": []
},
{
"id": "a4cbe16f94941f40",
"type": "ui_text",
"z": "af5613b75f0b562a",
"group": "7d7fb540b925c2c9",
"order": 1,
"width": 0,
"height": 0,
"name": "Status Heizung 1750",
"label": "",
"format": "{{msg.payload}}",
"layout": "col-center",
"className": "",
"x": 700,
"y": 360,
"wires": []
},
{
"id": "b67c2e959bf532f3",
"type": "alexa-remote-routine",
"z": "af5613b75f0b562a",
"name": "Heizung 1750W einschalten",
"account": "f8eeb77e2edc13dc",
"routineNode": {
"type": "routine",
"payload": {
"routine": {
"type": "str",
"value": "amzn1.alexa.automation.ae7b8474-4xxxxxxxxxxxxxxxxx"
},
"device": {
"type": "str",
"value": "G091JJ1421xxxxxxxxxxxx"
}
}
},
"x": 720,
"y": 240,
"wires": [
[]
]
},
{
"id": "f2bc9f193c11ff9a",
"type": "alexa-remote-routine",
"z": "af5613b75f0b562a",
"name": "Heizung 1750W ausschalten",
"account": "f8eeb7xxxxxxxxx",
"routineNode": {
"type": "routine",
"payload": {
"routine": {
"type": "str",
"value": "amzn1.alexa.automation.040f7996-fefe-4d7xxxxxxxxxxxx"
},
"device": {
"type": "str",
"value": "G091JJ14xxxxxxx"
}
}
},
"x": 720,
"y": 300,
"wires": [
[]
]
},
{
"id": "f8eeb77e2edc13dc",
"type": "alexa-remote-account",
"name": "my-account",
"authMethod": "proxy",
"proxyOwnIp": "192.168.0.xxx",
"proxyPort": "3456",
"cookieFile": "/home/pi/alexa.txt",
"refreshInterval": "3",
"alexaServiceHost": "layla.amazon.de",
"amazonPage": "amazon.de",
"acceptLanguage": "de-DE",
"userAgent": "",
"useWsMqtt": "on",
"autoInit": "on"
},
{
"id": "c6f8431344dcd050",
"type": "ui_group",
"name": "E-Heizung 1 - 1000 Watt",
"tab": "fad73bed835f5485",
"order": 4,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "7d7fb540b925c2c9",
"type": "ui_group",
"name": "E-Heizung 2 - 1750 Watt",
"tab": "fad73bed835f5485",
"order": 5,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "fad73bed835f5485",
"type": "ui_tab",
"name": "Übersicht",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]