Compare commits
2 commits
bc03b8d259
...
6ad117b2b8
Author | SHA1 | Date | |
---|---|---|---|
6ad117b2b8 | |||
6e9085066b |
2 changed files with 240 additions and 166 deletions
|
@ -98,7 +98,6 @@ class NodeRedMeterEinspeisung:
|
|||
|
||||
#send data to DBus
|
||||
self._dbusservice['/Ac/Power'] = meter_data['einspeisung']['total_power'] # positive: consumption, negative: feed into grid
|
||||
self._dbusservice['/Ac/Energy/Forward'] = meter_data['einspeisung']['total_kwh'];
|
||||
self._dbusservice['/Ac/Current'] = meter_data['einspeisung']['total_current']
|
||||
self._dbusservice['/Ac/L1/Voltage'] = meter_data['einspeisung']['l1_voltage']
|
||||
self._dbusservice['/Ac/L2/Voltage'] = meter_data['einspeisung']['l2_voltage']
|
||||
|
@ -112,9 +111,16 @@ class NodeRedMeterEinspeisung:
|
|||
self._dbusservice['/Ac/L1/Energy/Forward'] = meter_data['einspeisung']['l1_import']
|
||||
self._dbusservice['/Ac/L2/Energy/Forward'] = meter_data['einspeisung']['l2_import']
|
||||
self._dbusservice['/Ac/L3/Energy/Forward'] = meter_data['einspeisung']['l3_import']
|
||||
self._dbusservice['/Ac/L1/Energy/Reverse'] = meter_data['einspeisung']['l1_export']
|
||||
self._dbusservice['/Ac/L2/Energy/Reverse'] = meter_data['einspeisung']['l2_export']
|
||||
self._dbusservice['/Ac/L3/Energy/Reverse'] = meter_data['einspeisung']['l3_export']
|
||||
self._dbusservice['/Ac/Energy/Forward'] = meter_data['einspeisung']['total_import']
|
||||
self._dbusservice['/Ac/Energy/Reverse'] = meter_data['einspeisung']['total_export']
|
||||
|
||||
#logging
|
||||
logging.debug("House Consumption (/Ac/Power): %s" % (self._dbusservice['/Ac/Power']))
|
||||
logging.debug("House Forward (/Ac/Energy/Forward): %s" % (self._dbusservice['/Ac/Energy/Forward']))
|
||||
logging.debug("House Reverse (/Ac/Energy/Revers): %s" % (self._dbusservice['/Ac/Energy/Reverse']))
|
||||
logging.debug("---");
|
||||
|
||||
# increment UpdateIndex - to show that new data is available
|
||||
|
@ -165,9 +171,10 @@ def main():
|
|||
servicename='com.victronenergy.grid',
|
||||
deviceinstance=40,
|
||||
paths={
|
||||
'/Ac/Power': {'initial': 0, 'textformat': _w},
|
||||
'/Ac/Energy/Forward': {'initial': 0, 'textformat': _kwh},
|
||||
'/Ac/Current': {'initial': 0, 'textformat': _a},
|
||||
'/Ac/Energy/Forward': {'initial': 0, 'textformat': _kwh}, # energy bought from the grid, summ'd over all phases
|
||||
'/Ac/Energy/Reverse': {'initial': 0, 'textformat': _kwh}, # energy sold to the grid, summ'd over all phases
|
||||
'/Ac/Power': {'initial': 0, 'textformat': _w}, # power accumulated over all phases for ess regulation
|
||||
'/Ac/Current': {'initial': 0, 'textformat': _a}, # current accumulated over all phases
|
||||
'/Ac/L1/Voltage': {'initial': 0, 'textformat': _v},
|
||||
'/Ac/L2/Voltage': {'initial': 0, 'textformat': _v},
|
||||
'/Ac/L3/Voltage': {'initial': 0, 'textformat': _v},
|
||||
|
@ -180,6 +187,9 @@ def main():
|
|||
'/Ac/L1/Energy/Forward': {'initial': 0, 'textformat': _kwh},
|
||||
'/Ac/L2/Energy/Forward': {'initial': 0, 'textformat': _kwh},
|
||||
'/Ac/L3/Energy/Forward': {'initial': 0, 'textformat': _kwh},
|
||||
'/Ac/L1/Energy/Reverse': {'initial': 0, 'textformat': _kwh},
|
||||
'/Ac/L2/Energy/Reverse': {'initial': 0, 'textformat': _kwh},
|
||||
'/Ac/L3/Energy/Reverse': {'initial': 0, 'textformat': _kwh},
|
||||
})
|
||||
|
||||
logging.info('Connected to dbus, and switching over to gobject.MainLoop() (= event based)')
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 120,
|
||||
"y": 300,
|
||||
"x": 200,
|
||||
"y": 400,
|
||||
"wires": [
|
||||
[
|
||||
"5c5702e7ebd71a77",
|
||||
|
@ -59,8 +59,8 @@
|
|||
"method": "get",
|
||||
"upload": false,
|
||||
"swaggerDoc": "",
|
||||
"x": 100,
|
||||
"y": 760,
|
||||
"x": 120,
|
||||
"y": 880,
|
||||
"wires": [
|
||||
[
|
||||
"c61fcb67b3a33b47"
|
||||
|
@ -71,7 +71,7 @@
|
|||
"id": "fbe8cca3419d8161",
|
||||
"type": "change",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Set Headers",
|
||||
"name": "set http header",
|
||||
"rules": [
|
||||
{
|
||||
"t": "set",
|
||||
|
@ -93,8 +93,8 @@
|
|||
"from": "",
|
||||
"to": "",
|
||||
"reg": false,
|
||||
"x": 840,
|
||||
"y": 760,
|
||||
"x": 1150,
|
||||
"y": 880,
|
||||
"wires": [
|
||||
[
|
||||
"83f39f5649b78b86"
|
||||
|
@ -105,26 +105,26 @@
|
|||
"id": "83f39f5649b78b86",
|
||||
"type": "http response",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "",
|
||||
"name": "serve as http api",
|
||||
"statusCode": "",
|
||||
"headers": {},
|
||||
"x": 1080,
|
||||
"y": 760,
|
||||
"x": 1420,
|
||||
"y": 880,
|
||||
"wires": []
|
||||
},
|
||||
{
|
||||
"id": "c61fcb67b3a33b47",
|
||||
"type": "function",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Build Object",
|
||||
"func": "var einspeisung_total_power = parseFloat(global.get(\"einspeisung_total_power\"))\n\nvar einspeisung_l1_voltage = parseFloat(global.get(\"einspeisung_l1_voltage\"))\nvar einspeisung_l2_voltage = parseFloat(global.get(\"einspeisung_l2_voltage\"))\nvar einspeisung_l3_voltage = parseFloat(global.get(\"einspeisung_l3_voltage\"))\n\nvar einspeisung_l1_current = parseFloat(global.get(\"einspeisung_l1_current\"))\nvar einspeisung_l2_current = parseFloat(global.get(\"einspeisung_l2_current\"))\nvar einspeisung_l3_current = parseFloat(global.get(\"einspeisung_l3_current\"))\nvar einspeisung_total_current = einspeisung_l1_current + einspeisung_l2_current + einspeisung_l3_current\n\nvar einspeisung_l1_power = parseFloat(global.get(\"einspeisung_l1_power\"))\nvar einspeisung_l2_power = parseFloat(global.get(\"einspeisung_l2_power\"))\nvar einspeisung_l3_power = parseFloat(global.get(\"einspeisung_l3_power\"))\n\nvar einspeisung_l1_import = parseFloat(global.get(\"einspeisung_l1_import\") - global.get(\"einspeisung_l1_export\"));\nvar einspeisung_l2_import = parseFloat(global.get(\"einspeisung_l2_import\") - global.get(\"einspeisung_l2_export\"));\nvar einspeisung_l3_import = parseFloat(global.get(\"einspeisung_l3_import\") - global.get(\"einspeisung_l3_export\"));\n\nvar einspeisung_total_kWh = einspeisung_l1_import + einspeisung_l2_import + einspeisung_l3_import;\n\nmsg.payload.einspeisung = {total_kwh: einspeisung_total_kWh, total_power:einspeisung_total_power, total_current:einspeisung_total_current, l1_voltage:einspeisung_l1_voltage, l2_voltage:einspeisung_l2_voltage, l3_voltage:einspeisung_l3_voltage, l1_current:einspeisung_l1_current, l2_current:einspeisung_l2_current, l3_current:einspeisung_l3_current, l1_power:einspeisung_l1_power, l2_power:einspeisung_l2_power, l3_power:einspeisung_l3_power, l1_import:einspeisung_l1_import, l2_import:einspeisung_l2_import, l3_import:einspeisung_l3_import};\n\nreturn msg;\n",
|
||||
"name": "Create java objects",
|
||||
"func": "var einspeisung_total_power = parseFloat(global.get(\"einspeisung_total_power\"))\n\nvar einspeisung_l1_voltage = parseFloat(global.get(\"einspeisung_l1_voltage\"))\nvar einspeisung_l2_voltage = parseFloat(global.get(\"einspeisung_l2_voltage\"))\nvar einspeisung_l3_voltage = parseFloat(global.get(\"einspeisung_l3_voltage\"))\n\nvar einspeisung_l1_current = parseFloat(global.get(\"einspeisung_l1_current\"))\nvar einspeisung_l2_current = parseFloat(global.get(\"einspeisung_l2_current\"))\nvar einspeisung_l3_current = parseFloat(global.get(\"einspeisung_l3_current\"))\n\nvar einspeisung_l1_power = parseFloat(global.get(\"einspeisung_l1_power\"))\nvar einspeisung_l2_power = parseFloat(global.get(\"einspeisung_l2_power\"))\nvar einspeisung_l3_power = parseFloat(global.get(\"einspeisung_l3_power\"))\n\nvar einspeisung_l1_import = parseFloat(global.get(\"einspeisung_l1_import\"))\nvar einspeisung_l2_import = parseFloat(global.get(\"einspeisung_l2_import\"))\nvar einspeisung_l3_import = parseFloat(global.get(\"einspeisung_l3_import\"))\n\nvar einspeisung_l1_export = parseFloat(global.get(\"einspeisung_l1_export\"))\nvar einspeisung_l2_export = parseFloat(global.get(\"einspeisung_l2_export\"))\nvar einspeisung_l3_export = parseFloat(global.get(\"einspeisung_l3_export\"))\n\n//Totals\nvar einspeisung_total_current = einspeisung_l1_current + einspeisung_l2_current + einspeisung_l3_current\nvar einspeisung_total_import = parseFloat(global.get(\"einspeisung_total_import\"))\nvar einspeisung_total_export = parseFloat(global.get(\"einspeisung_total_export\"))\n\nmsg.payload.einspeisung = {total_power:einspeisung_total_power, total_current:einspeisung_total_current, total_import:einspeisung_total_import, total_export:einspeisung_total_export, l1_voltage:einspeisung_l1_voltage, l2_voltage:einspeisung_l2_voltage, l3_voltage:einspeisung_l3_voltage, l1_current:einspeisung_l1_current, l2_current:einspeisung_l2_current, l3_current:einspeisung_l3_current, l1_power:einspeisung_l1_power, l2_power:einspeisung_l2_power, l3_power:einspeisung_l3_power, l1_import:einspeisung_l1_import, l2_import:einspeisung_l2_import, l3_import:einspeisung_l3_import, l1_export:einspeisung_l1_export, l2_export:einspeisung_l2_export, l3_export:einspeisung_l3_export};\n\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 460,
|
||||
"y": 760,
|
||||
"x": 510,
|
||||
"y": 880,
|
||||
"wires": [
|
||||
[
|
||||
"307db2619dcf6228"
|
||||
|
@ -135,12 +135,12 @@
|
|||
"id": "307db2619dcf6228",
|
||||
"type": "json",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "",
|
||||
"name": "build json object",
|
||||
"property": "payload",
|
||||
"action": "",
|
||||
"pretty": false,
|
||||
"x": 660,
|
||||
"y": 760,
|
||||
"x": 910,
|
||||
"y": 880,
|
||||
"wires": [
|
||||
[
|
||||
"fbe8cca3419d8161"
|
||||
|
@ -161,8 +161,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 320,
|
||||
"y": 100,
|
||||
"x": 560,
|
||||
"y": 140,
|
||||
"wires": [
|
||||
[
|
||||
"f5853a536891d509"
|
||||
|
@ -180,8 +180,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 100,
|
||||
"x": 940,
|
||||
"y": 140,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -200,8 +200,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 320,
|
||||
"y": 140,
|
||||
"x": 560,
|
||||
"y": 180,
|
||||
"wires": [
|
||||
[
|
||||
"a3b33ef1225b85e7"
|
||||
|
@ -219,8 +219,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 140,
|
||||
"x": 940,
|
||||
"y": 180,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -239,8 +239,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 320,
|
||||
"y": 180,
|
||||
"x": 560,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[
|
||||
"b284d02cb539994f"
|
||||
|
@ -258,8 +258,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 180,
|
||||
"x": 940,
|
||||
"y": 220,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -278,8 +278,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 320,
|
||||
"y": 220,
|
||||
"x": 560,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[
|
||||
"1da7740caa290264"
|
||||
|
@ -297,8 +297,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 220,
|
||||
"x": 940,
|
||||
"y": 260,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -317,8 +317,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 320,
|
||||
"y": 260,
|
||||
"x": 560,
|
||||
"y": 300,
|
||||
"wires": [
|
||||
[
|
||||
"6c9ebd253a3c3b0d"
|
||||
|
@ -336,8 +336,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 260,
|
||||
"x": 940,
|
||||
"y": 300,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -356,8 +356,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 320,
|
||||
"y": 300,
|
||||
"x": 560,
|
||||
"y": 340,
|
||||
"wires": [
|
||||
[
|
||||
"d848102461062b3f"
|
||||
|
@ -375,8 +375,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 300,
|
||||
"x": 940,
|
||||
"y": 340,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -395,8 +395,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 340,
|
||||
"x": 550,
|
||||
"y": 380,
|
||||
"wires": [
|
||||
[
|
||||
"3e88cef8b8b508ac"
|
||||
|
@ -414,8 +414,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 340,
|
||||
"x": 940,
|
||||
"y": 380,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -434,8 +434,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 380,
|
||||
"x": 550,
|
||||
"y": 420,
|
||||
"wires": [
|
||||
[
|
||||
"466e66a05eddb62f"
|
||||
|
@ -453,8 +453,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 380,
|
||||
"x": 940,
|
||||
"y": 420,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -473,8 +473,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 420,
|
||||
"x": 550,
|
||||
"y": 460,
|
||||
"wires": [
|
||||
[
|
||||
"a0e6a154bfb85c09"
|
||||
|
@ -492,8 +492,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 420,
|
||||
"x": 940,
|
||||
"y": 460,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -512,7 +512,7 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 330,
|
||||
"x": 560,
|
||||
"y": 40,
|
||||
"wires": [
|
||||
[
|
||||
|
@ -531,7 +531,7 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 710,
|
||||
"x": 940,
|
||||
"y": 40,
|
||||
"wires": [
|
||||
[]
|
||||
|
@ -551,8 +551,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 460,
|
||||
"x": 550,
|
||||
"y": 500,
|
||||
"wires": [
|
||||
[
|
||||
"22bdca2522a4b3c9"
|
||||
|
@ -570,8 +570,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 460,
|
||||
"x": 940,
|
||||
"y": 500,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -590,8 +590,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 500,
|
||||
"x": 550,
|
||||
"y": 540,
|
||||
"wires": [
|
||||
[
|
||||
"51dc86ef4b4e31fd"
|
||||
|
@ -609,8 +609,8 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 500,
|
||||
"x": 940,
|
||||
"y": 540,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -629,8 +629,8 @@
|
|||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 540,
|
||||
"x": 550,
|
||||
"y": 580,
|
||||
"wires": [
|
||||
[
|
||||
"804899fa9686be16"
|
||||
|
@ -648,8 +648,125 @@
|
|||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 540,
|
||||
"x": 940,
|
||||
"y": 580,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "a5f8ee01c537330b",
|
||||
"type": "http request",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Export L1",
|
||||
"method": "GET",
|
||||
"ret": "txt",
|
||||
"paytoqs": "ignore",
|
||||
"url": "http://10.1.0.5/cgi-bin/readVal.exe?PDP,%20R150,d",
|
||||
"tls": "",
|
||||
"persist": false,
|
||||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 550,
|
||||
"y": 620,
|
||||
"wires": [
|
||||
[
|
||||
"ba0021b15f94fc41"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ba0021b15f94fc41",
|
||||
"type": "function",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "format and save to global var",
|
||||
"func": "temp = parseFloat(msg.payload * 0.001).toFixed(2);\nglobal.set(\"einspeisung_l1_export\", temp)\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 940,
|
||||
"y": 620,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "1e1823db7c7b4edd",
|
||||
"type": "http request",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Export L2",
|
||||
"method": "GET",
|
||||
"ret": "txt",
|
||||
"paytoqs": "ignore",
|
||||
"url": "http://10.1.0.5/cgi-bin/readVal.exe?PDP,%20R151,d",
|
||||
"tls": "",
|
||||
"persist": false,
|
||||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 550,
|
||||
"y": 660,
|
||||
"wires": [
|
||||
[
|
||||
"68157d83b4f176f5"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "68157d83b4f176f5",
|
||||
"type": "function",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "format and save to global var",
|
||||
"func": "temp = parseFloat(msg.payload * 0.001).toFixed(2);\nglobal.set(\"einspeisung_l2_export\", temp)\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 940,
|
||||
"y": 660,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "7857cce5b19d21ea",
|
||||
"type": "http request",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Export L3",
|
||||
"method": "GET",
|
||||
"ret": "txt",
|
||||
"paytoqs": "ignore",
|
||||
"url": "http://10.1.0.5/cgi-bin/readVal.exe?PDP,%20R152,d",
|
||||
"tls": "",
|
||||
"persist": false,
|
||||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 550,
|
||||
"y": 700,
|
||||
"wires": [
|
||||
[
|
||||
"4d12b6c71b023fc8"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "4d12b6c71b023fc8",
|
||||
"type": "function",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "format and save to global var",
|
||||
"func": "temp = parseFloat(msg.payload * 0.001).toFixed(2);\nglobal.set(\"einspeisung_l3_export\", temp)\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 940,
|
||||
"y": 700,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
|
@ -675,7 +792,7 @@
|
|||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 120,
|
||||
"x": 190,
|
||||
"y": 40,
|
||||
"wires": [
|
||||
[
|
||||
|
@ -684,120 +801,67 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"id": "a5f8ee01c537330b",
|
||||
"type": "http request",
|
||||
"id": "18e719ada7da042a",
|
||||
"type": "inject",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Export L1",
|
||||
"method": "GET",
|
||||
"ret": "txt",
|
||||
"paytoqs": "ignore",
|
||||
"url": "http://10.1.0.5/cgi-bin/readVal.exe?PDP,%20R150,d",
|
||||
"tls": "",
|
||||
"persist": false,
|
||||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 580,
|
||||
"name": "Calc every minute",
|
||||
"props": [
|
||||
{
|
||||
"p": "payload"
|
||||
},
|
||||
{
|
||||
"p": "topic",
|
||||
"vt": "str"
|
||||
}
|
||||
],
|
||||
"repeat": "60",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"payload": "",
|
||||
"payloadType": "date",
|
||||
"x": 190,
|
||||
"y": 760,
|
||||
"wires": [
|
||||
[
|
||||
"ba0021b15f94fc41"
|
||||
"983943d318a0ef33"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "ba0021b15f94fc41",
|
||||
"id": "983943d318a0ef33",
|
||||
"type": "function",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "format and save to global var",
|
||||
"func": "temp = parseFloat(msg.payload * 0.001).toFixed(1);\nglobal.set(\"einspeisung_l1_export\", temp)\nreturn msg;",
|
||||
"name": "Phase sum of import and export like EM24",
|
||||
"func": "//init counters if not defined\nif (global.get(\"einspeisung_total_import\") === undefined) {\n global.set(\"einspeisung_total_import\", 0);\n}\nif (global.get(\"einspeisung_total_export\") === undefined) {\n global.set(\"einspeisung_total_export\", 0);\n}\n//get counters from global variable\nvar total_import = parseFloat(global.get(\"einspeisung_total_import\"));\nvar total_export = parseFloat(global.get(\"einspeisung_total_export\"));\nvar phase_combined_last = parseFloat(global.get(\"einspeisung_total_phase_combined_last\"));\nvar check = \"Nothing\";\n\n//get measurements\nvar einspeisung_l1_import = parseFloat(global.get(\"einspeisung_l1_import\"));\nvar einspeisung_l2_import = parseFloat(global.get(\"einspeisung_l2_import\"));\nvar einspeisung_l3_import = parseFloat(global.get(\"einspeisung_l3_import\"));\n\nvar einspeisung_l1_export = parseFloat(global.get(\"einspeisung_l1_export\"));\nvar einspeisung_l2_export = parseFloat(global.get(\"einspeisung_l2_export\"));\nvar einspeisung_l3_export = parseFloat(global.get(\"einspeisung_l3_export\"));\n\n//get measurement of import and export\nvar phase_combined = (einspeisung_l1_import - einspeisung_l1_export) + (einspeisung_l2_import - einspeisung_l2_export) + (einspeisung_l3_import - einspeisung_l3_export);\n\nif (phase_combined < phase_combined_last) {\n total_export += Math.abs(phase_combined - phase_combined_last);\n check = \"Export: \" + Math.abs(phase_combined - phase_combined_last) + \" kWh\";\n}\nif (phase_combined > phase_combined_last) {\n total_import += Math.abs(phase_combined - phase_combined_last);\n check = \"Import: \" + Math.abs(phase_combined - phase_combined_last) + \" kWh\";\n}\n\nglobal.set(\"einspeisung_total_phase_combined_last\", phase_combined);\nglobal.set(\"einspeisung_total_import\", parseFloat(total_import).toFixed(2));\nglobal.set(\"einspeisung_total_export\", parseFloat(total_export).toFixed(2));\nmsg.payload = {total_import: total_import, total_export: total_export, phase_combined: phase_combined, phase_combined_last: phase_combined_last, check: check}\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 580,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "1e1823db7c7b4edd",
|
||||
"type": "http request",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Export L2",
|
||||
"method": "GET",
|
||||
"ret": "txt",
|
||||
"paytoqs": "ignore",
|
||||
"url": "http://10.1.0.5/cgi-bin/readVal.exe?PDP,%20R151,d",
|
||||
"tls": "",
|
||||
"persist": false,
|
||||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 620,
|
||||
"x": 960,
|
||||
"y": 760,
|
||||
"wires": [
|
||||
[
|
||||
"68157d83b4f176f5"
|
||||
"9b291dc80aff0a1a"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "68157d83b4f176f5",
|
||||
"type": "function",
|
||||
"id": "9b291dc80aff0a1a",
|
||||
"type": "debug",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "format and save to global var",
|
||||
"func": "temp = parseFloat(msg.payload * 0.001).toFixed(1);\nglobal.set(\"einspeisung_l2_export\", temp)\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 620,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "7857cce5b19d21ea",
|
||||
"type": "http request",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "Export L3",
|
||||
"method": "GET",
|
||||
"ret": "txt",
|
||||
"paytoqs": "ignore",
|
||||
"url": "http://10.1.0.5/cgi-bin/readVal.exe?PDP,%20R152,d",
|
||||
"tls": "",
|
||||
"persist": false,
|
||||
"proxy": "",
|
||||
"authType": "",
|
||||
"senderr": false,
|
||||
"x": 310,
|
||||
"y": 660,
|
||||
"wires": [
|
||||
[
|
||||
"4d12b6c71b023fc8"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "4d12b6c71b023fc8",
|
||||
"type": "function",
|
||||
"z": "f96eea4d4a3a345d",
|
||||
"name": "format and save to global var",
|
||||
"func": "temp = parseFloat(msg.payload * 0.001).toFixed(1);\nglobal.set(\"einspeisung_l3_export\", temp)\nreturn msg;",
|
||||
"outputs": 1,
|
||||
"noerr": 0,
|
||||
"initialize": "",
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 700,
|
||||
"y": 660,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
"name": "",
|
||||
"active": true,
|
||||
"tosidebar": true,
|
||||
"console": false,
|
||||
"tostatus": false,
|
||||
"complete": "false",
|
||||
"statusVal": "",
|
||||
"statusType": "auto",
|
||||
"x": 1460,
|
||||
"y": 760,
|
||||
"wires": []
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue