Ich betreibe 2 Zähler in Kaskadenschaltung. Mein HA bzw. das Energie Dashboard füttere üner mqtt mit Zählerauslesung via Tasmota.
Um den Korrekten Zählerstand zu ermitteln muss ich Zählwerk Z2 von Z1 subtrahieren.
Hier hänge ich seit Weihnachten dran rum und komme nicht weiter.
Anbei der Flow
[
{
"id": "d2af8ff2e9dc87aa",
"type": "comment",
"z": "1a45702f9f8357ba",
"name": "Zähler EVU Z1",
"info": "",
"x": 90,
"y": 60,
"wires": []
},
{
"id": "2b182a8dd690478d",
"type": "mqtt in",
"z": "1a45702f9f8357ba",
"name": "",
"topic": "tele/Zahler/EVUZ1WMP/Zahlerstand/KWH/SENSOR",
"qos": "0",
"datatype": "auto-detect",
"broker": "571760fff4daa5ae",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 200,
"y": 100,
"wires": [
[
"9b40db818510d472",
"e2ff64f61b29671e"
]
]
},
{
"id": "9b40db818510d472",
"type": "debug",
"z": "1a45702f9f8357ba",
"name": "debug 21",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 490,
"y": 100,
"wires": []
},
{
"id": "da8efacfadb49365",
"type": "function",
"z": "1a45702f9f8357ba",
"name": "Komma wegrechnen",
"func": "msg.payload = parseFloat((msg.payload / 1).toFixed(1));\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 220,
"wires": [
[
"26e698448e4036f1",
"e711f96b7fcb418d",
"90479da841cf1470"
]
]
},
{
"id": "26e698448e4036f1",
"type": "debug",
"z": "1a45702f9f8357ba",
"name": "Zählerstand Z1 1.8.0",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 680,
"y": 220,
"wires": []
},
{
"id": "e2ff64f61b29671e",
"type": "change",
"z": "1a45702f9f8357ba",
"name": "Umwandeln in Jason",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.MT691.Total_in",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 260,
"y": 160,
"wires": [
[
"2310e8cd545e9795",
"da8efacfadb49365"
]
]
},
{
"id": "2310e8cd545e9795",
"type": "debug",
"z": "1a45702f9f8357ba",
"name": "debug 23",
"active": true,
"tosidebar": false,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 490,
"y": 160,
"wires": []
},
{
"id": "e2f3b0f135576722",
"type": "comment",
"z": "1a45702f9f8357ba",
"name": "Zähler EVU Z2",
"info": "",
"x": 90,
"y": 400,
"wires": []
},
{
"id": "3be7a1929bbdd9fa",
"type": "mqtt in",
"z": "1a45702f9f8357ba",
"name": "",
"topic": "tele/Zahler/EVUZ2Haushalt/Zahlerstand/KWH/SENSOR",
"qos": "0",
"datatype": "auto-detect",
"broker": "571760fff4daa5ae",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 210,
"y": 440,
"wires": [
[
"5c62af95e7401e5f",
"580ce86e9bfe60ee"
]
]
},
{
"id": "5c62af95e7401e5f",
"type": "debug",
"z": "1a45702f9f8357ba",
"name": "debug 24",
"active": true,
"tosidebar": false,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 520,
"y": 440,
"wires": []
},
{
"id": "ab3d2a649afddc0f",
"type": "function",
"z": "1a45702f9f8357ba",
"name": "Komma wegrechnen",
"func": "msg.payload = parseFloat((msg.payload / 1).toFixed(1));\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 560,
"wires": [
[
"d34ee5122af73ddf",
"d0be112a76829812"
]
]
},
{
"id": "d34ee5122af73ddf",
"type": "debug",
"z": "1a45702f9f8357ba",
"name": "Zählerstand Z2 1.8.0",
"active": true,
"tosidebar": false,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 700,
"y": 560,
"wires": []
},
{
"id": "580ce86e9bfe60ee",
"type": "change",
"z": "1a45702f9f8357ba",
"name": "Umwandeln in Json",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.MT691.Total_in",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 270,
"y": 500,
"wires": [
[
"2d5ae647be3dd027",
"ab3d2a649afddc0f"
]
]
},
{
"id": "2d5ae647be3dd027",
"type": "debug",
"z": "1a45702f9f8357ba",
"name": "debug 26",
"active": true,
"tosidebar": false,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 510,
"y": 500,
"wires": []
},
{
"id": "e711f96b7fcb418d",
"type": "influxdb out",
"z": "1a45702f9f8357ba",
"influxdb": "8d4670114b89464c",
"name": "Zahlerstand Z1 180 EVU",
"measurement": "Zahlerstand Z1 180 EVU",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "EFH-goetz",
"bucket": "efhgoetz",
"x": 710,
"y": 280,
"wires": []
},
{
"id": "90479da841cf1470",
"type": "mqtt out",
"z": "1a45702f9f8357ba",
"name": "",
"topic": "Zahler/EVUZ1/180/Zahlerstand",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "571760fff4daa5ae",
"x": 730,
"y": 340,
"wires": []
},
{
"id": "d0be112a76829812",
"type": "mqtt out",
"z": "1a45702f9f8357ba",
"name": "",
"topic": "Zahler/EVUZ2/180/Zahlerstand",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "571760fff4daa5ae",
"x": 750,
"y": 620,
"wires": []
},
{
"id": "571760fff4daa5ae",
"type": "mqtt-broker",
"name": "",
"broker": "192.168.3.150",
"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": "8d4670114b89464c",
"type": "influxdb",
"hostname": "192.168.2.27",
"port": "8086",
"protocol": "http",
"database": "database",
"name": "InfluxDB",
"usetls": false,
"tls": "",
"influxdbVersion": "2.0",
"url": "http://192.168.3.150:8086",
"rejectUnauthorized": true
}
]
Von mqtt kommt ein Objekt rein. Da zeihe ich mir den Zählerstand raus.
Mit einem change in JSONData.
Danach mach kürze ich noch die Komma stellen.
Ich habe schon mit dem Node Join experimentiert.
Allerdings begreiffe ich nicht wie den Werten Topic zuteilen kann.
evtl. kann mir jemand hlefen.