Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {
- "id": "58b78185.c44a5",
- "type": "tab",
- "label": "Solar Panels",
- "disabled": false,
- "info": ""
- },
- {
- "id": "1248a3fb.e201cc",
- "type": "tab",
- "label": "Read Victron BMV",
- "disabled": false,
- "info": ""
- },
- {
- "id": "8be735f2.3402c8",
- "type": "tab",
- "label": "Automations",
- "disabled": false,
- "info": ""
- },
- {
- "id": "9564f63a.05e388",
- "type": "server",
- "z": "",
- "name": "Home Assistant"
- },
- {
- "id": "219c759.73a028a",
- "type": "serial-port",
- "z": "",
- "serialport": "/dev/serial/by-id/usb-VictronEnergy_BV_VE_Direct_cable_VE3B3Q0X-if00-port0",
- "serialbaud": "19200",
- "databits": "8",
- "parity": "none",
- "stopbits": "1",
- "newline": "\\n",
- "bin": "false",
- "out": "char",
- "addchar": false,
- "responsetimeout": "10000"
- },
- {
- "id": "c3857c6e.4c937",
- "type": "mqtt-broker",
- "z": "",
- "name": "homeassistant",
- "broker": "localhost",
- "port": "1883",
- "clientid": "",
- "usetls": false,
- "compatmode": false,
- "keepalive": "60",
- "cleansession": true,
- "birthTopic": "",
- "birthQos": "0",
- "birthPayload": "",
- "closeTopic": "",
- "closeQos": "0",
- "closePayload": "",
- "willTopic": "",
- "willQos": "0",
- "willPayload": ""
- },
- {
- "id": "a7648dab.0118a",
- "type": "serial-port",
- "z": "",
- "serialport": "/dev/ttyUSB0",
- "serialbaud": "19200",
- "databits": "8",
- "parity": "none",
- "stopbits": "1",
- "newline": "\\n",
- "bin": "false",
- "out": "char",
- "addchar": false,
- "responsetimeout": "600"
- },
- {
- "id": "ae94b9c.e02f648",
- "type": "mqtt-broker",
- "z": "",
- "name": "homeassistant-delete",
- "broker": "localhost",
- "port": "1883",
- "clientid": "",
- "usetls": false,
- "compatmode": false,
- "keepalive": "60",
- "cleansession": true,
- "birthTopic": "",
- "birthQos": "0",
- "birthPayload": "",
- "closeTopic": "",
- "closeQos": "0",
- "closePayload": "",
- "willTopic": "",
- "willQos": "0",
- "willPayload": ""
- },
- {
- "id": "b3a2ecc4.b349",
- "type": "mqtt-broker",
- "z": "",
- "name": "localhost",
- "broker": "localhost",
- "port": "1883",
- "tls": "",
- "clientid": "",
- "usetls": true,
- "compatmode": true,
- "keepalive": "60",
- "cleansession": true,
- "birthTopic": "",
- "birthQos": "0",
- "birthPayload": "",
- "closeTopic": "",
- "closeQos": "0",
- "closePayload": "",
- "willTopic": "",
- "willQos": "0",
- "willPayload": ""
- },
- {
- "id": "919a2834.429b58",
- "type": "serial-port",
- "z": "",
- "serialport": "/dev/serial/by-id/usb-VictronEnergy_BV_VE_Direct_cable_VE26ZM61-if00-port0",
- "serialbaud": "19200",
- "databits": "8",
- "parity": "none",
- "stopbits": "1",
- "waitfor": "",
- "newline": "\\n",
- "bin": "false",
- "out": "char",
- "addchar": "",
- "responsetimeout": "10000"
- },
- {
- "id": "8168b04d.8f5f2",
- "type": "server",
- "z": "",
- "name": "Home Assistant",
- "legacy": true,
- "hassio": true,
- "rejectUnauthorizedCerts": true,
- "ha_boolean": "y|yes|true|on|home|open",
- "connectionDelay": true
- },
- {
- "id": "bea7d6fe.b77288",
- "type": "serial in",
- "z": "58b78185.c44a5",
- "name": "MPPT",
- "serial": "219c759.73a028a",
- "x": 100,
- "y": 40,
- "wires": [
- [
- "71a7e419.99387c",
- "37bdf89.083a408"
- ]
- ]
- },
- {
- "id": "71a7e419.99387c",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 590,
- "y": 40,
- "wires": []
- },
- {
- "id": "d470ca37.0ccdc8",
- "type": "split",
- "z": "58b78185.c44a5",
- "name": "",
- "splt": "\\n",
- "spltType": "str",
- "arraySplt": 1,
- "arraySpltType": "len",
- "stream": true,
- "addname": "topic",
- "x": 150,
- "y": 140,
- "wires": [
- [
- "ea07f69f.b70cd8",
- "183e624d.7a455e"
- ]
- ]
- },
- {
- "id": "ea07f69f.b70cd8",
- "type": "switch",
- "z": "58b78185.c44a5",
- "name": "Routing",
- "property": "parts.key",
- "propertyType": "msg",
- "rules": [
- {
- "t": "eq",
- "v": "VPV",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "PPV",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "V",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "I",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "H21",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "H23",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "H21",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "H22",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "H19",
- "vt": "str"
- }
- ],
- "checkall": "true",
- "repair": false,
- "outputs": 9,
- "x": 180,
- "y": 320,
- "wires": [
- [
- "391f3cdd.75cb24"
- ],
- [
- "c0d42df5.a0d3"
- ],
- [
- "43ef1fc.e6f90e"
- ],
- [
- "7057316a.0ac6f"
- ],
- [
- "4376a0b3.6ec1f"
- ],
- [
- "fce43672.70f0d8"
- ],
- [
- "f3023499.2ef918"
- ],
- [
- "28595d77.2e7662"
- ],
- [
- "e790abfb.d0bf08"
- ]
- ]
- },
- {
- "id": "183e624d.7a455e",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 390,
- "y": 140,
- "wires": []
- },
- {
- "id": "ce5dd878.fa0d88",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 730,
- "y": 160,
- "wires": []
- },
- {
- "id": "24bd53e6.98484c",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 240,
- "wires": []
- },
- {
- "id": "934ddaf3.c6fa48",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 320,
- "wires": []
- },
- {
- "id": "5433bdc8.32aa54",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 400,
- "wires": []
- },
- {
- "id": "37bdf89.083a408",
- "type": "function",
- "z": "58b78185.c44a5",
- "name": "Convert",
- "func": "// 'msg' is the message object the Function node receives\nvar myVars = msg.payload.split(\"\\r\\n\");\nvar result = {};\nmyVars.forEach(function(v) {\n // The following split uses ' = ' - because your example output appears to\n // have spaces around the equals sign.\n var parts = v.split(\"\\t\");\n result[parts[0]] = parts[1];\n});\nmsg.payload = result;\n// The Function node returns the message to be sent to the next node(s) in the flow\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 300,
- "y": 80,
- "wires": [
- [
- "d470ca37.0ccdc8"
- ]
- ]
- },
- {
- "id": "391f3cdd.75cb24",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Solar V",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 440,
- "y": 200,
- "wires": [
- [
- "ce5dd878.fa0d88",
- "fad7a11d.81dfa"
- ]
- ]
- },
- {
- "id": "c0d42df5.a0d3",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Solar Power",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 450,
- "y": 280,
- "wires": [
- [
- "24bd53e6.98484c",
- "90a501d2.2f5e8"
- ]
- ]
- },
- {
- "id": "43ef1fc.e6f90e",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Batt V",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 430,
- "y": 360,
- "wires": [
- [
- "934ddaf3.c6fa48",
- "67344b05.beab74"
- ]
- ]
- },
- {
- "id": "7057316a.0ac6f",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Solar Amp",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 450,
- "y": 440,
- "wires": [
- [
- "5433bdc8.32aa54",
- "1f71772c.c3d2c9"
- ]
- ]
- },
- {
- "id": "fad7a11d.81dfa",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "Volt",
- "topic": "homeassistant/sensor/solarV/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 200,
- "wires": []
- },
- {
- "id": "1f71772c.c3d2c9",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "Amp",
- "topic": "homeassistant/sensor/solarA/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 440,
- "wires": []
- },
- {
- "id": "67344b05.beab74",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "Volt",
- "topic": "homeassistant/sensor/solarbattV/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 360,
- "wires": []
- },
- {
- "id": "90a501d2.2f5e8",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "Watt",
- "topic": "homeassistant/sensor/solarW/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 280,
- "wires": []
- },
- {
- "id": "6d98f134.a5e72",
- "type": "inject",
- "z": "58b78185.c44a5",
- "name": "powjson",
- "topic": "",
- "payload": "{\"name\":\"Solceller Effekt\",\"state_topic\":\"homeassistant/sensor/solarW/state\",\"unit_of_measurement\":\"W\",\"icon\":\"mdi:resistor\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 980,
- "y": 120,
- "wires": [
- [
- "34120993.2afdd6"
- ]
- ]
- },
- {
- "id": "34120993.2afdd6",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "wattconfig",
- "topic": "homeassistant/sensor/solarW/config",
- "qos": "",
- "retain": "false",
- "broker": "c3857c6e.4c937",
- "x": 1240,
- "y": 120,
- "wires": []
- },
- {
- "id": "cccc492a.c06e38",
- "type": "inject",
- "z": "58b78185.c44a5",
- "name": "vjson",
- "topic": "",
- "payload": "{\"name\":\"Forbruksbatteri (sol)\",\"state_topic\":\"homeassistant/sensor/solarbattV/state\",\"unit_of_measurement\":\"V\",\"device_class\":\"current-dc\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 970,
- "y": 160,
- "wires": [
- [
- "dca29649.1cb2b8"
- ]
- ]
- },
- {
- "id": "dca29649.1cb2b8",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "battVconfig",
- "topic": "homeassistant/sensor/solarbattV/config",
- "qos": "",
- "retain": "false",
- "broker": "c3857c6e.4c937",
- "x": 1250,
- "y": 160,
- "wires": []
- },
- {
- "id": "77412ace.e8ba24",
- "type": "inject",
- "z": "58b78185.c44a5",
- "name": "voltjson",
- "topic": "",
- "payload": "{\"name\":\"Solcellespenning\",\"state_topic\":\"homeassistant/sensor/solarV/state\",\"unit_of_measurement\":\"V\",\"icon\":\"mdi:current-dc\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 980,
- "y": 80,
- "wires": [
- [
- "623a4194.5117b",
- "86a41eb6.5f16b"
- ]
- ]
- },
- {
- "id": "623a4194.5117b",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "voltconfig",
- "topic": "homeassistant/sensor/solarV/config",
- "qos": "",
- "retain": "false",
- "broker": "c3857c6e.4c937",
- "x": 1240,
- "y": 80,
- "wires": []
- },
- {
- "id": "40dd02ac.0be99c",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "ampconfig",
- "topic": "homeassistant/sensor/solarA/config",
- "qos": "",
- "retain": "false",
- "broker": "c3857c6e.4c937",
- "x": 1250,
- "y": 200,
- "wires": []
- },
- {
- "id": "9c8baf7d.3d6e9",
- "type": "inject",
- "z": "58b78185.c44a5",
- "name": "ajson",
- "topic": "",
- "payload": "{\"name\":\"Lading Solceller\",\"state_topic\":\"homeassistant/sensor/solarA/state\",\"unit_of_measurement\":\"A\",\"icon\":\"mdi:resistor\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 970,
- "y": 200,
- "wires": [
- [
- "40dd02ac.0be99c"
- ]
- ]
- },
- {
- "id": "86a41eb6.5f16b",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 1190,
- "y": 40,
- "wires": []
- },
- {
- "id": "4376a0b3.6ec1f",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Max Power Today",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 470,
- "y": 520,
- "wires": [
- [
- "fb8ee719.fe6428",
- "65a84815.c27688"
- ]
- ]
- },
- {
- "id": "fce43672.70f0d8",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Max Power Yesterday",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 480,
- "y": 600,
- "wires": [
- [
- "a8c87522.1c5d38",
- "217fddf.05f9722"
- ]
- ]
- },
- {
- "id": "f3023499.2ef918",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Yeld Today",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 450,
- "y": 680,
- "wires": [
- [
- "dfba5021.07c89"
- ]
- ]
- },
- {
- "id": "28595d77.2e7662",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Yeld Yesterday",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 460,
- "y": 760,
- "wires": [
- [
- "e9bf2576.097e78"
- ]
- ]
- },
- {
- "id": "e790abfb.d0bf08",
- "type": "change",
- "z": "58b78185.c44a5",
- "name": "Yeld Total",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 440,
- "y": 840,
- "wires": [
- [
- "9ff15b1b.e12f48"
- ]
- ]
- },
- {
- "id": "dfba5021.07c89",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 640,
- "wires": []
- },
- {
- "id": "a8c87522.1c5d38",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 560,
- "wires": []
- },
- {
- "id": "fb8ee719.fe6428",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 480,
- "wires": []
- },
- {
- "id": "e9bf2576.097e78",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 720,
- "wires": []
- },
- {
- "id": "9ff15b1b.e12f48",
- "type": "debug",
- "z": "58b78185.c44a5",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 730,
- "y": 800,
- "wires": []
- },
- {
- "id": "e787bb23.ac74d8",
- "type": "inject",
- "z": "58b78185.c44a5",
- "name": "solarmxpwtdyWjson",
- "topic": "",
- "payload": "{\"name\":\"Maks effekt i dag\",\"state_topic\":\"homeassistant/sensor/solarmxpwtdyW/state\",\"unit_of_measurement\":\"W\",\"icon\":\"mdi:resistor\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 1020,
- "y": 240,
- "wires": [
- [
- "88bbcbe2.1173e8"
- ]
- ]
- },
- {
- "id": "88bbcbe2.1173e8",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "wattconfig",
- "topic": "homeassistant/sensor/solarmxpwtdyW/config",
- "qos": "",
- "retain": "false",
- "broker": "c3857c6e.4c937",
- "x": 1240,
- "y": 240,
- "wires": []
- },
- {
- "id": "65a84815.c27688",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "Watt",
- "topic": "homeassistant/sensor/solarmxpwtdyW/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 520,
- "wires": []
- },
- {
- "id": "217fddf.05f9722",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "Watt",
- "topic": "homeassistant/sensor/solarmxpwydyW/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 600,
- "wires": []
- },
- {
- "id": "d4303b67.4b4aa8",
- "type": "inject",
- "z": "58b78185.c44a5",
- "name": "solarmxpwydyWjson",
- "topic": "",
- "payload": "{\"name\":\"Maks effekt i går\",\"state_topic\":\"homeassistant/sensor/solarmxpwydyW/state\",\"unit_of_measurement\":\"W\",\"icon\":\"mdi:resistor\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 1020,
- "y": 280,
- "wires": [
- [
- "b2ac78c9.64fe28"
- ]
- ]
- },
- {
- "id": "b2ac78c9.64fe28",
- "type": "mqtt out",
- "z": "58b78185.c44a5",
- "name": "wattconfig",
- "topic": "homeassistant/sensor/solarmxpwydyW/config",
- "qos": "",
- "retain": "false",
- "broker": "c3857c6e.4c937",
- "x": 1240,
- "y": 280,
- "wires": []
- },
- {
- "id": "abf3360d.515ab8",
- "type": "serial in",
- "z": "1248a3fb.e201cc",
- "name": "Victron Monitor",
- "serial": "919a2834.429b58",
- "x": 100,
- "y": 20,
- "wires": [
- [
- "15a86d6a.4ed843",
- "3aeab4d.cb2334c"
- ]
- ]
- },
- {
- "id": "15a86d6a.4ed843",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 850,
- "y": 20,
- "wires": []
- },
- {
- "id": "b061fc1c.c58ea",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 850,
- "y": 60,
- "wires": []
- },
- {
- "id": "3aeab4d.cb2334c",
- "type": "function",
- "z": "1248a3fb.e201cc",
- "name": "Convert_obj",
- "func": "// 'msg' is the message object the Function node receives\nvar myVars = msg.payload.split(\"\\r\\n\");\nvar result = {};\nmyVars.forEach(function(v) {\n // The following split uses ' = ' - because your example output appears to\n // have spaces around the equals sign.\n var parts = v.split(\"\\t\");\n result[parts[0]] = parts[1];\n});\nmsg.payload = result;\n// The Function node returns the message to be sent to the next node(s) in the flow\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 210,
- "y": 60,
- "wires": [
- [
- "b061fc1c.c58ea",
- "e80d983b.58d088"
- ]
- ]
- },
- {
- "id": "f603268b.a24d48",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "true",
- "x": 830,
- "y": 120,
- "wires": []
- },
- {
- "id": "e80d983b.58d088",
- "type": "split",
- "z": "1248a3fb.e201cc",
- "name": "",
- "splt": "\\n",
- "spltType": "str",
- "arraySplt": 1,
- "arraySpltType": "len",
- "stream": true,
- "addname": "topic",
- "x": 190,
- "y": 120,
- "wires": [
- [
- "f603268b.a24d48",
- "7e8fa6c1.839ee8"
- ]
- ]
- },
- {
- "id": "7e8fa6c1.839ee8",
- "type": "switch",
- "z": "1248a3fb.e201cc",
- "name": "Route",
- "property": "parts.key",
- "propertyType": "msg",
- "rules": [
- {
- "t": "eq",
- "v": "V",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "I",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "SOC",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "VS",
- "vt": "str"
- }
- ],
- "checkall": "true",
- "repair": false,
- "outputs": 4,
- "x": 190,
- "y": 256,
- "wires": [
- [
- "b06e03d1.0d794"
- ],
- [
- "7024a40c.a4fcac"
- ],
- [
- "f9b638a6.6bcca8"
- ],
- [
- "ca255fb3.6d65"
- ]
- ]
- },
- {
- "id": "9e70d012.46da9",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 890,
- "y": 180,
- "wires": []
- },
- {
- "id": "c6400c4d.b7d57",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 891,
- "y": 261,
- "wires": []
- },
- {
- "id": "b06e03d1.0d794",
- "type": "change",
- "z": "1248a3fb.e201cc",
- "name": "V to num",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 400,
- "y": 224,
- "wires": [
- [
- "4c2d5cca.e6cf84"
- ]
- ]
- },
- {
- "id": "7024a40c.a4fcac",
- "type": "change",
- "z": "1248a3fb.e201cc",
- "name": "I to num",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 400,
- "y": 304,
- "wires": [
- [
- "4d8fdfcb.bced8"
- ]
- ]
- },
- {
- "id": "4da5c91c.907828",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 890,
- "y": 358,
- "wires": []
- },
- {
- "id": "e72165b5.590b78",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "Volt",
- "topic": "homeassistant/sensor/battV/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 224,
- "wires": []
- },
- {
- "id": "f9b638a6.6bcca8",
- "type": "change",
- "z": "1248a3fb.e201cc",
- "name": "SoC to num",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/10",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 410,
- "y": 404,
- "wires": [
- [
- "5e314c82.dd3384"
- ]
- ]
- },
- {
- "id": "faa99bc8.82e9b8",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "Current",
- "topic": "homeassistant/sensor/battA/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 720,
- "y": 304,
- "wires": []
- },
- {
- "id": "52a32ea4.2675c",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "SOC",
- "topic": "homeassistant/sensor/battSOC/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 710,
- "y": 404,
- "wires": []
- },
- {
- "id": "4d8fdfcb.bced8",
- "type": "smooth",
- "z": "1248a3fb.e201cc",
- "name": "Two dec",
- "property": "payload",
- "action": "mean",
- "count": "5",
- "round": "2",
- "mult": "multi",
- "x": 560,
- "y": 304,
- "wires": [
- [
- "faa99bc8.82e9b8",
- "c6400c4d.b7d57"
- ]
- ]
- },
- {
- "id": "5e314c82.dd3384",
- "type": "smooth",
- "z": "1248a3fb.e201cc",
- "name": "No dec",
- "property": "payload",
- "action": "mean",
- "count": "5",
- "round": "0",
- "mult": "multi",
- "x": 560,
- "y": 404,
- "wires": [
- [
- "52a32ea4.2675c",
- "4da5c91c.907828",
- "99c57c5a.1f1ac"
- ]
- ]
- },
- {
- "id": "ca255fb3.6d65",
- "type": "change",
- "z": "1248a3fb.e201cc",
- "name": "V to num",
- "rules": [
- {
- "t": "set",
- "p": "payload",
- "pt": "msg",
- "to": "$number(msg.payload)/1000",
- "tot": "jsonata"
- }
- ],
- "action": "",
- "property": "",
- "from": "",
- "to": "",
- "reg": false,
- "x": 400,
- "y": 484,
- "wires": [
- [
- "6eecd797.740b88"
- ]
- ]
- },
- {
- "id": "c08493ae.d9862",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "Start Volt",
- "topic": "homeassistant/sensor/battVS/state",
- "qos": "",
- "retain": "",
- "broker": "c3857c6e.4c937",
- "x": 720,
- "y": 484,
- "wires": []
- },
- {
- "id": "e9b0a5b6.fa5288",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 890,
- "y": 444,
- "wires": []
- },
- {
- "id": "4c2d5cca.e6cf84",
- "type": "smooth",
- "z": "1248a3fb.e201cc",
- "name": "Two dec",
- "property": "payload",
- "action": "mean",
- "count": "5",
- "round": "2",
- "mult": "multi",
- "x": 560,
- "y": 224,
- "wires": [
- [
- "e72165b5.590b78",
- "9e70d012.46da9"
- ]
- ]
- },
- {
- "id": "6eecd797.740b88",
- "type": "smooth",
- "z": "1248a3fb.e201cc",
- "name": "Two dec",
- "property": "payload",
- "action": "mean",
- "count": "5",
- "round": "2",
- "mult": "multi",
- "x": 560,
- "y": 484,
- "wires": [
- [
- "c08493ae.d9862",
- "e9b0a5b6.fa5288"
- ]
- ]
- },
- {
- "id": "9e554b79.8b4d68",
- "type": "inject",
- "z": "1248a3fb.e201cc",
- "name": "ajsonn",
- "topic": "",
- "payload": "{\"name\":\"Øyeblikksforbruk\",\"state_topic\":\"homeassistant/sensor/battA/state\",\"unit_of_measurement\":\"A\",\"icon\":\"mdi:resistor\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 150,
- "y": 620,
- "wires": [
- [
- "2c4785ba.d07aca"
- ]
- ]
- },
- {
- "id": "2c4785ba.d07aca",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "ampconfig",
- "topic": "homeassistant/sensor/battA/config",
- "qos": "",
- "retain": "true",
- "broker": "c3857c6e.4c937",
- "x": 310,
- "y": 620,
- "wires": []
- },
- {
- "id": "60c967a6.571758",
- "type": "inject",
- "z": "1248a3fb.e201cc",
- "name": "socjson",
- "topic": "",
- "payload": "{\"name\":\"Batterinivå\",\"state_topic\":\"homeassistant/sensor/battSOC/state\",\"unit_of_measurement\":\"%\",\"device_class\":\"battery\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 160,
- "y": 660,
- "wires": [
- [
- "d107693b.425388"
- ]
- ]
- },
- {
- "id": "d107693b.425388",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "socconfig",
- "topic": "homeassistant/sensor/battSOC/config",
- "qos": "",
- "retain": "true",
- "broker": "c3857c6e.4c937",
- "x": 300,
- "y": 660,
- "wires": []
- },
- {
- "id": "32c8f506.da7d9a",
- "type": "inject",
- "z": "1248a3fb.e201cc",
- "name": "voltjson",
- "topic": "",
- "payload": "{\"name\":\"Forbruksbatteri\",\"state_topic\":\"homeassistant/sensor/battV/state\",\"unit_of_measurement\":\"V\",\"icon\":\"mdi:current-dc\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 160,
- "y": 580,
- "wires": [
- [
- "8a3e88d4.588b78",
- "1f74b02a.d311c"
- ]
- ]
- },
- {
- "id": "8a3e88d4.588b78",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "voltconfig",
- "topic": "homeassistant/sensor/battV/config",
- "qos": "",
- "retain": "true",
- "broker": "c3857c6e.4c937",
- "x": 300,
- "y": 580,
- "wires": []
- },
- {
- "id": "5ad0d5c4.f317bc",
- "type": "mqtt out",
- "z": "1248a3fb.e201cc",
- "name": "voltsconfig",
- "topic": "homeassistant/sensor/battVS/config",
- "qos": "",
- "retain": "true",
- "broker": "c3857c6e.4c937",
- "x": 310,
- "y": 700,
- "wires": []
- },
- {
- "id": "515d2304.14cfbc",
- "type": "inject",
- "z": "1248a3fb.e201cc",
- "name": "vsjson",
- "topic": "",
- "payload": "{\"name\":\"Startbatteri\",\"state_topic\":\"homeassistant/sensor/battVS/state\",\"unit_of_measurement\":\"V\",\"icon\":\"mdi:current-dc\"}",
- "payloadType": "json",
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "240",
- "x": 150,
- "y": 700,
- "wires": [
- [
- "5ad0d5c4.f317bc"
- ]
- ]
- },
- {
- "id": "1f74b02a.d311c",
- "type": "debug",
- "z": "1248a3fb.e201cc",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "x": 410,
- "y": 544,
- "wires": []
- },
- {
- "id": "ce1df2c7.17257",
- "type": "link in",
- "z": "8be735f2.3402c8",
- "name": "State of Charge",
- "links": [
- "99c57c5a.1f1ac"
- ],
- "x": 75,
- "y": 60,
- "wires": [
- [
- "b6318b69.0808c8"
- ]
- ]
- },
- {
- "id": "979499b2.2c64c8",
- "type": "api-current-state",
- "z": "8be735f2.3402c8",
- "name": "target",
- "server": "8168b04d.8f5f2",
- "version": 1,
- "outputs": 1,
- "halt_if": "",
- "halt_if_type": "str",
- "halt_if_compare": "is",
- "override_topic": true,
- "entity_id": "input_number.ladeprosent",
- "state_type": "num",
- "state_location": "payload",
- "override_payload": "msg",
- "entity_location": "data",
- "override_data": "msg",
- "blockInputOverrides": false,
- "x": 210,
- "y": 160,
- "wires": [
- [
- "440dec3b.c54964"
- ]
- ]
- },
- {
- "id": "440dec3b.c54964",
- "type": "function",
- "z": "8be735f2.3402c8",
- "name": "Time to Charge?",
- "func": "\n\n// Current state of Charge of batteries\nif (msg.topic == 'SOC') {\n context.set('status', msg.payload);\n}\n\n// Target for charge \nif (msg.topic == 'input_number.ladeprosent') {\n context.set('target', msg.payload);\n}\n\n// Check if status is 3% below target\nvar diff = context.get('target') - context.get('status');\n\nif ( diff > 3 ) { // Start to charge if 3% below target\n msg.payload = \"charge\";\n} else if ( diff < 0 ) { // Stop charging when target reached\n msg.payload = \"stop\";\n}\n\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "x": 420,
- "y": 160,
- "wires": [
- [
- "5c40e320.57bdac",
- "bbeb3e31.d7f9b"
- ]
- ]
- },
- {
- "id": "5c40e320.57bdac",
- "type": "switch",
- "z": "8be735f2.3402c8",
- "name": "charge on or off",
- "property": "payload",
- "propertyType": "msg",
- "rules": [
- {
- "t": "eq",
- "v": "charge",
- "vt": "str"
- },
- {
- "t": "eq",
- "v": "stop",
- "vt": "str"
- }
- ],
- "checkall": "false",
- "repair": false,
- "outputs": 2,
- "x": 645,
- "y": 160,
- "wires": [
- [
- "9c20b3fd.5dabb",
- "d01a2df1.d90e6"
- ],
- [
- "3f022e2a.e704f2",
- "d46defa5.15052"
- ]
- ]
- },
- {
- "id": "748e4eda.120d4",
- "type": "api-call-service",
- "z": "8be735f2.3402c8",
- "name": "start charge",
- "server": "8168b04d.8f5f2",
- "version": 1,
- "service_domain": "switch",
- "service": "turn_on",
- "entityId": "switch.osram_plug_01_000d1a23_3",
- "data": "",
- "dataType": "json",
- "mergecontext": "",
- "output_location": "payload",
- "output_location_type": "msg",
- "mustacheAltTags": false,
- "x": 1070,
- "y": 140,
- "wires": [
- []
- ]
- },
- {
- "id": "d01a2df1.d90e6",
- "type": "api-current-state",
- "z": "8be735f2.3402c8",
- "name": "charging?",
- "server": "8168b04d.8f5f2",
- "version": "1",
- "outputs": 2,
- "halt_if": "on",
- "halt_if_type": "str",
- "halt_if_compare": "is",
- "override_topic": true,
- "entity_id": "switch.osram_plug_01_000d1a23_3",
- "state_type": "str",
- "state_location": "payload",
- "override_payload": "msg",
- "entity_location": "data",
- "override_data": "msg",
- "blockInputOverrides": false,
- "x": 880,
- "y": 143,
- "wires": [
- [],
- [
- "748e4eda.120d4"
- ]
- ]
- },
- {
- "id": "d60378e5.588fe8",
- "type": "api-call-service",
- "z": "8be735f2.3402c8",
- "name": "stop charge",
- "server": "8168b04d.8f5f2",
- "version": 1,
- "service_domain": "switch",
- "service": "turn_off",
- "entityId": "switch.osram_plug_01_000d1a23_3",
- "data": "",
- "dataType": "json",
- "mergecontext": "",
- "output_location": "payload",
- "output_location_type": "msg",
- "mustacheAltTags": false,
- "x": 1070,
- "y": 220,
- "wires": [
- []
- ]
- },
- {
- "id": "d46defa5.15052",
- "type": "api-current-state",
- "z": "8be735f2.3402c8",
- "name": "charging?",
- "server": "8168b04d.8f5f2",
- "version": "1",
- "outputs": 2,
- "halt_if": "off",
- "halt_if_type": "str",
- "halt_if_compare": "is",
- "override_topic": true,
- "entity_id": "switch.osram_plug_01_000d1a23_3",
- "state_type": "str",
- "state_location": "payload",
- "override_payload": "msg",
- "entity_location": "data",
- "override_data": "msg",
- "blockInputOverrides": false,
- "x": 880,
- "y": 203,
- "wires": [
- [],
- [
- "d60378e5.588fe8"
- ]
- ]
- },
- {
- "id": "b6318b69.0808c8",
- "type": "api-current-state",
- "z": "8be735f2.3402c8",
- "name": "automation on?",
- "server": "8168b04d.8f5f2",
- "version": 1,
- "outputs": 2,
- "halt_if": "off",
- "halt_if_type": "str",
- "halt_if_compare": "is",
- "override_topic": false,
- "entity_id": "input_boolean.charge_automation",
- "state_type": "str",
- "state_location": "",
- "override_payload": "none",
- "entity_location": "",
- "override_data": "none",
- "blockInputOverrides": false,
- "x": 200,
- "y": 60,
- "wires": [
- [],
- [
- "440dec3b.c54964",
- "979499b2.2c64c8"
- ]
- ]
- },
- {
- "id": "9c20b3fd.5dabb",
- "type": "debug",
- "z": "8be735f2.3402c8",
- "name": "below - start",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 890,
- "y": 80,
- "wires": []
- },
- {
- "id": "3f022e2a.e704f2",
- "type": "debug",
- "z": "8be735f2.3402c8",
- "name": "above - stop",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 890,
- "y": 260,
- "wires": []
- },
- {
- "id": "bbeb3e31.d7f9b",
- "type": "debug",
- "z": "8be735f2.3402c8",
- "name": "SOC",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "x": 615,
- "y": 200,
- "wires": []
- },
- {
- "id": "99c57c5a.1f1ac",
- "type": "link out",
- "z": "1248a3fb.e201cc",
- "name": "SOC",
- "links": [
- "ce1df2c7.17257"
- ],
- "x": 835,
- "y": 400,
- "wires": []
- }
- ]
Advertisement
Add Comment
Please, Sign In to add comment