[ { "id": "76c67ea9bb531d68", "type": "tab", "label": "VIctron ESS P1 MQTT Flow", "disabled": false, "info": "", "env": [] }, { "id": "4019dae3da3f0315", "type": "mqtt in", "z": "76c67ea9bb531d68", "name": "Electric Power Usage (Consumption)", "topic": "consumption", "qos": "2", "datatype": "auto-detect", "broker": "21058a300e91fcb2", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 200, "y": 160, "wires": [ [ "c4e226e7a3a9a8fc" ] ] }, { "id": "121cf4286ab1ab37", "type": "mqtt in", "z": "76c67ea9bb531d68", "name": "Electric Power Usage (Production)", "topic": "production", "qos": "2", "datatype": "auto-detect", "broker": "21058a300e91fcb2", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 180, "y": 320, "wires": [ [ "ada1dfc047df10b9" ] ] }, { "id": "c4e226e7a3a9a8fc", "type": "function", "z": "76c67ea9bb531d68", "name": "Add 5000", "func": "msg.payload = msg.payload + 5000\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 460, "y": 160, "wires": [ [ "ae438adb4e350455" ] ] }, { "id": "ae438adb4e350455", "type": "change", "z": "76c67ea9bb531d68", "name": "payload.gridPower", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "payload.gridPower", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 160, "wires": [ [ "85e890c551c91ae3" ] ] }, { "id": "bbe35c203caf4f62", "type": "function", "z": "76c67ea9bb531d68", "name": "Calculator Function", "func": "// Extract values from the payload\nvar consumptionGridPower = msg.payload.consumption.gridPower;\nvar victronValue = msg.payload.power.gridPoint;\nvar product = msg.payload.production.gridProduct;\n// Perform addition\nvar sum = consumptionGridPower + victronValue - product;\n\n// Update the payload with the sum\nmsg.payload.sum = sum;\n\n// Send the message to the next node\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1050, "y": 160, "wires": [ [ "617c5d14b00aea27" ] ] }, { "id": "617c5d14b00aea27", "type": "change", "z": "76c67ea9bb531d68", "name": "move to payload", "rules": [ { "t": "move", "p": "payload.sum", "pt": "msg", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1260, "y": 160, "wires": [ [ "3c7d0f365575ae1a" ] ] }, { "id": "8b191d3e7814d42d", "type": "victron-output-ess", "z": "76c67ea9bb531d68", "service": "com.victronenergy.settings", "path": "/Settings/CGwacs/AcPowerSetPoint", "serviceObj": { "service": "com.victronenergy.settings", "name": "Venus settings" }, "pathObj": { "path": "/Settings/CGwacs/AcPowerSetPoint", "type": "integer", "name": "Grid set-point (W)", "writable": true }, "name": "", "onlyChanges": false, "x": 880, "y": 480, "wires": [] }, { "id": "9b35d3146e5748b2", "type": "delay", "z": "76c67ea9bb531d68", "name": "", "pauseType": "rate", "timeout": "20", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "5", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": true, "allowrate": false, "outputs": 1, "x": 260, "y": 400, "wires": [ [ "5d3e5e05ed52961d" ] ] }, { "id": "a8622179cf9d4789", "type": "debug", "z": "76c67ea9bb531d68", "name": "debug 10", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 820, "y": 400, "wires": [] }, { "id": "5d3e5e05ed52961d", "type": "function", "z": "76c67ea9bb531d68", "name": "Invert Value & round", "func": "// Input value\nvar inputValue = msg.payload;\n\n// Invert the value\nvar invertedValue = -inputValue;\n\n// Update the payload with the inverted value\nmsg.payload = Number(invertedValue.toFixed(0));\n\n// Send the message to the next node\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 520, "y": 400, "wires": [ [ "a8622179cf9d4789", "8b191d3e7814d42d" ] ] }, { "id": "3cf137325b96ec92", "type": "comment", "z": "76c67ea9bb531d68", "name": "MQTT Grid Production", "info": "", "x": 160, "y": 460, "wires": [] }, { "id": "1631bdaadf73d53c", "type": "comment", "z": "76c67ea9bb531d68", "name": "MQTT Grid consumption", "info": "", "x": 170, "y": 100, "wires": [] }, { "id": "3c7d0f365575ae1a", "type": "link out", "z": "76c67ea9bb531d68", "name": "link out 2", "mode": "link", "links": [ "7836cbf72de913e7" ], "x": 1385, "y": 160, "wires": [] }, { "id": "7836cbf72de913e7", "type": "link in", "z": "76c67ea9bb531d68", "name": "link in 1", "links": [ "3c7d0f365575ae1a" ], "x": 105, "y": 400, "wires": [ [ "9b35d3146e5748b2" ] ] }, { "id": "5bfe8e9e740c0d80", "type": "comment", "z": "76c67ea9bb531d68", "name": "Output to Grid setpoint Venus OS", "info": "", "x": 1010, "y": 440, "wires": [] }, { "id": "16a91935b74209fe", "type": "change", "z": "76c67ea9bb531d68", "name": "payload.gridProduct", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "payload.gridProduct", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 680, "y": 320, "wires": [ [ "85e890c551c91ae3" ] ] }, { "id": "deb96f7f4aa689b1", "type": "victron-input-ess", "z": "76c67ea9bb531d68", "service": "com.victronenergy.vebus/276", "path": "/Hub4/L1/AcPowerSetpoint", "serviceObj": { "service": "com.victronenergy.vebus/276", "name": "MultiPlus-II 48/5000/70-50" }, "pathObj": { "path": "/Hub4/L1/AcPowerSetpoint", "type": "integer", "name": "AC Power L1 setpoint (W)" }, "initial": "", "name": "", "onlyChanges": false, "x": 200, "y": 240, "wires": [ [ "1ef27824948f8339" ] ] }, { "id": "ada1dfc047df10b9", "type": "function", "z": "76c67ea9bb531d68", "name": "Add 5000", "func": "msg.payload = msg.payload + 5000\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 460, "y": 320, "wires": [ [ "16a91935b74209fe" ] ] }, { "id": "f02c4bbc4b5c32db", "type": "change", "z": "76c67ea9bb531d68", "name": "payload.gridPoint", "rules": [ { "t": "move", "p": "payload", "pt": "msg", "to": "payload.gridPoint", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1110, "y": 240, "wires": [ [ "85e890c551c91ae3" ] ] }, { "id": "85e890c551c91ae3", "type": "join", "z": "76c67ea9bb531d68", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": false, "timeout": "", "count": "3", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 870, "y": 160, "wires": [ [ "bbe35c203caf4f62" ] ] }, { "id": "5f405f64598df1a9", "type": "change", "z": "76c67ea9bb531d68", "name": "Set topic to power", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "power", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 910, "y": 240, "wires": [ [ "f02c4bbc4b5c32db" ] ] }, { "id": "9b84fd26e1057189", "type": "debug", "z": "76c67ea9bb531d68", "name": "debug 17", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1480, "y": 100, "wires": [] }, { "id": "1ef27824948f8339", "type": "function", "z": "76c67ea9bb531d68", "name": "Invert Value & round", "func": "// Input value\nvar inputValue = msg.payload;\n\n// Invert the value\nvar invertedValue = -inputValue;\n\n// Update the payload with the inverted value\nmsg.payload = Number(invertedValue.toFixed(0));\n\n// Send the message to the next node\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 600, "y": 240, "wires": [ [ "5f405f64598df1a9", "0c93c8c5052df8c7" ] ] }, { "id": "0c93c8c5052df8c7", "type": "debug", "z": "76c67ea9bb531d68", "name": "debug 19", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 1200, "y": 320, "wires": [] }, { "id": "21058a300e91fcb2", "type": "mqtt-broker", "name": "", "broker": "localhost", "port": "1883", "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "userProps": "", "sessionExpiry": "" } ]