[ { "id": "4587847568fd2353", "type": "tab", "label": "Solarwatt Local v6 MQTT", "disabled": false, "info": "Migration v5→v6 : remplacement des noeuds ha-sensor Companion par MQTT Discovery. Les entity_id HA sont identiques à la v5." }, { "id": "b2f1d497c83e5a12", "type": "mqtt-broker", "name": "Mosquitto local Solarwatt", "broker": "core-mosquitto", "port": "1883", "clientid": "nodered_solarwatt", "autoConnect": true, "usetls": false, "compatmode": false, "protocolVersion": 4, "keepalive": "60", "cleansession": true, "autoUnsubscribe": true, "birthTopic": "solarwatt/status", "birthQos": "1", "birthPayload": "online", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "solarwatt/status", "willQos": "1", "willPayload": "offline", "willMsg": {}, "userProps": "", "sessionExpiry": "", "willRetain": true, "birthRetain": true }, { "id": "770612abc2ebe36d", "type": "inject", "z": "4587847568fd2353", "name": "Login au démarrage", "props": [], "repeat": "", "crontab": "", "once": true, "onceDelay": "3", "topic": "", "x": 140, "y": 80, "wires": [ [ "8ffb0174365ed9be" ] ] }, { "id": "e2eb572a08473c56", "type": "inject", "z": "4587847568fd2353", "name": "Refresh login 30 min", "props": [], "repeat": "1800", "crontab": "", "once": false, "onceDelay": "0", "topic": "", "x": 140, "y": 120, "wires": [ [ "8ffb0174365ed9be" ] ] }, { "id": "8ffb0174365ed9be", "type": "exec", "z": "4587847568fd2353", "command": "curl -s -c /tmp/sw.cookie -A \"Mozilla/5.0\" http://192.168.1.110/logon.html -o /dev/null", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "winHide": false, "oldrc": false, "name": "GET /logon.html", "x": 390, "y": 100, "wires": [ [ "e5e188a8e9086896" ], [ "c4cc578945748c64" ], [ "fbe3f52862ebaca5" ] ] }, { "id": "e5e188a8e9086896", "type": "exec", "z": "4587847568fd2353", "command": "curl -s -L -b /tmp/sw.cookie -c /tmp/sw.cookie -H \"Content-Type: application/x-www-form-urlencoded\" -H \"Referer: http://192.168.1.110/logon.html\" --data \"username=installer&url=%2F&password=hvpiimld&submit=Login\" http://192.168.1.110/auth/login -o /dev/null", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "winHide": false, "oldrc": false, "name": "POST /auth/login", "x": 620, "y": 100, "wires": [ [ "3c00344a6efd7589" ], [ "79a409c5565c37b2" ], [ "bfb5ac533e8d5120" ] ] }, { "id": "3c00344a6efd7589", "type": "exec", "z": "4587847568fd2353", "command": "cat /tmp/sw.cookie", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "winHide": false, "oldrc": false, "name": "Voir cookie", "x": 840, "y": 100, "wires": [ [ "a2b17344e43630eb" ], [], [] ] }, { "id": "a2b17344e43630eb", "type": "debug", "z": "4587847568fd2353", "name": "DEBUG cookie file", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 1040, "y": 100, "wires": [] }, { "id": "c4cc578945748c64", "type": "debug", "z": "4587847568fd2353", "name": "GET logon stderr", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 390, "y": 40, "wires": [] }, { "id": "fbe3f52862ebaca5", "type": "debug", "z": "4587847568fd2353", "name": "GET logon rc", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 380, "y": 160, "wires": [] }, { "id": "79a409c5565c37b2", "type": "debug", "z": "4587847568fd2353", "name": "POST login stderr", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 630, "y": 40, "wires": [] }, { "id": "bfb5ac533e8d5120", "type": "debug", "z": "4587847568fd2353", "name": "POST login rc", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 620, "y": 160, "wires": [] }, { "id": "70ad92976ba19345", "type": "inject", "z": "4587847568fd2353", "name": "Poll energy 15s", "props": [], "repeat": "15", "crontab": "", "once": true, "onceDelay": "8", "topic": "", "x": 120, "y": 1100, "wires": [ [ "236adc97608b73f6" ] ] }, { "id": "236adc97608b73f6", "type": "exec", "z": "4587847568fd2353", "command": "curl -s -b /tmp/sw.cookie \"http://192.168.1.110/rest/hems-configurator/energy-overview?kg_session_extend=false\"", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "winHide": false, "oldrc": false, "name": "GET energy-overview", "x": 380, "y": 1100, "wires": [ [ "f4f9d2dadc100f93", "56941a627669dee7" ], [ "9908ece2c4f23f1f" ], [ "98b0f0acd301348c" ] ] }, { "id": "56941a627669dee7", "type": "debug", "z": "4587847568fd2353", "name": "DEBUG energy JSON", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 610, "y": 1060, "wires": [] }, { "id": "9908ece2c4f23f1f", "type": "debug", "z": "4587847568fd2353", "name": "energy stderr", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 380, "y": 1160, "wires": [] }, { "id": "98b0f0acd301348c", "type": "debug", "z": "4587847568fd2353", "name": "energy rc", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 370, "y": 1200, "wires": [] }, { "id": "f4f9d2dadc100f93", "type": "function", "z": "4587847568fd2353", "name": "Parse energy-overview → MQTT", "func": "let d;\ntry {\n d = JSON.parse(msg.payload);\n} catch (e) {\n node.error('Réponse non JSON sur energy-overview', msg);\n return null;\n}\n\nconst pv = Number(d.production || 0);\nconst gridExport = Number(d.feedIn || 0);\nconst gridImport = Number(d.feedOut || 0);\nconst home = Number(d.householdConsumption || 0);\nconst battCharge = Number(d.storagePowerIn || 0);\nconst battDischarge = Number(d.storagePowerOut || 0);\nconst battNet = battDischarge - battCharge;\n\nconst vals = {\n pv_power: pv,\n home_power: home,\n grid_import_power: gridImport,\n grid_export_power: gridExport,\n battery_charge_power: battCharge,\n battery_discharge_power: battDischarge,\n battery_power_net: battNet\n};\n\nfor (const [k, v] of Object.entries(vals)) {\n node.send({ topic: 'solarwatt/' + k, payload: String(v), retain: true, qos: 0 });\n}\nreturn null;", "outputs": 1, "noerr": 0, "x": 650, "y": 1100, "wires": [ [ "mqtt_energy_out" ] ] }, { "id": "232a734730b9a103", "type": "inject", "z": "4587847568fd2353", "name": "Poll items 60s", "props": [], "repeat": "60", "crontab": "", "once": true, "onceDelay": "10", "topic": "", "x": 120, "y": 1400, "wires": [ [ "21dcfb1be4476c47" ] ] }, { "id": "21dcfb1be4476c47", "type": "exec", "z": "4587847568fd2353", "command": "curl -s -b /tmp/sw.cookie \"http://192.168.1.110/rest/items?kg_session_extend=false\"", "addpay": false, "append": "", "useSpawn": "false", "timer": "", "winHide": false, "oldrc": false, "name": "GET items", "x": 350, "y": 1400, "wires": [ [ "684586d0793ae559", "62bf7d3832073206" ], [ "1edc91a8e6142d1c" ], [ "696ce5dfaa450e23" ] ] }, { "id": "62bf7d3832073206", "type": "debug", "z": "4587847568fd2353", "name": "DEBUG items JSON", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 600, "y": 1360, "wires": [] }, { "id": "1edc91a8e6142d1c", "type": "debug", "z": "4587847568fd2353", "name": "items stderr", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 350, "y": 1460, "wires": [] }, { "id": "696ce5dfaa450e23", "type": "debug", "z": "4587847568fd2353", "name": "items rc", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "x": 340, "y": 1500, "wires": [] }, { "id": "684586d0793ae559", "type": "function", "z": "4587847568fd2353", "name": "Parse items totals → MQTT", "func": "function findItem(items, name) {\n return items.find(i => i.name === name);\n}\n\nfunction parseNumber(raw) {\n if (raw === null || raw === undefined) return null;\n let s = String(raw).trim();\n if (!s) return null;\n if (s.includes('|')) s = s.split('|')[1].trim();\n s = s.split(' ')[0].replace(',', '.');\n const n = Number(s);\n return Number.isFinite(n) ? n : null;\n}\n\nlet items;\ntry {\n items = JSON.parse(msg.payload);\n} catch (e) {\n node.error('Réponse non JSON sur items', msg);\n return null;\n}\n\nconst map = {\n battery_soc: 'foxesshybrid_battery_2R8H602058HP023_battery_bms_soc',\n produced_total: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_produced_total',\n grid_import_total: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_consumed_from_grid_total',\n grid_export_total: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_out_total',\n home_consumption_total: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_consumed_total',\n self_consumed_total: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_self_consumed_total',\n battery_charged_from_grid_total: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_buffered_from_grid_total',\n battery_out_total_site: 'kiwigrid_location_standard_1823d84e3054_harmonized_work_out_from_storage_total',\n battery_charge_total_raw: 'foxesshybrid_battery_2R8H602058HP023_battery_work_in_total',\n battery_discharge_total_raw: 'foxesshybrid_battery_2R8H602058HP023_battery_work_out_total',\n battery_temperature: 'foxesshybrid_battery_2R8H602058HP023_battery_bms_1_temperature',\n battery_power_raw: 'foxesshybrid_battery_2R8H602058HP023_battery_battery_calculated_power',\n battery_mode: 'foxesshybrid_battery_2R8H602058HP023_battery_mode'\n};\n\nfor (const [key, itemName] of Object.entries(map)) {\n const item = findItem(items, itemName);\n if (!item) continue;\n\n let value;\n if (key === 'battery_mode') {\n value = String(item.state || '');\n } else {\n value = parseNumber(item.state);\n if (value !== null && String(item.state || '').includes(' Wh')) {\n value = value / 1000;\n }\n if (value === null) continue;\n value = String(value);\n }\n\n node.send({ topic: 'solarwatt/' + key, payload: value, retain: true, qos: 0 });\n}\nreturn null;", "outputs": 1, "noerr": 0, "x": 650, "y": 1400, "wires": [ [ "mqtt_items_out" ] ] }, { "id": "inj_avail_online", "type": "inject", "z": "4587847568fd2353", "name": "Availability online", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "2", "topic": "", "payload": "online", "payloadType": "str", "x": 160, "y": 1060, "wires": [ [ "mqtt_avail_out" ] ] }, { "id": "mqtt_avail_out", "type": "mqtt out", "z": "4587847568fd2353", "name": "MQTT availability", "topic": "solarwatt/status", "qos": "1", "retain": "true", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "b2f1d497c83e5a12", "x": 400, "y": 1060, "wires": [] }, { "id": "inj_discovery", "type": "inject", "z": "4587847568fd2353", "name": "MQTT Discovery au démarrage", "props": [], "repeat": "", "crontab": "", "once": true, "onceDelay": "2", "topic": "", "x": 160, "y": 200, "wires": [ [ "disc_consolidated_fn" ] ] }, { "id": "disc_consolidated_fn", "type": "function", "z": "4587847568fd2353", "name": "MQTT Discovery — 20 capteurs", "func": "node.send({ topic: \"homeassistant/sensor/solarwatt_pv_power/config\", payload: JSON.stringify({\"name\": \"Solarwatt PV Power\", \"unique_id\": \"solarwatt_pv_power\", \"state_topic\": \"solarwatt/pv_power\", \"icon\": \"mdi:solar-power\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_pv_power\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_home_power/config\", payload: JSON.stringify({\"name\": \"Solarwatt Home Power\", \"unique_id\": \"solarwatt_home_power\", \"state_topic\": \"solarwatt/home_power\", \"icon\": \"mdi:home-lightning-bolt\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_home_power\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_grid_import_power/config\", payload: JSON.stringify({\"name\": \"Solarwatt Grid Import Power\", \"unique_id\": \"solarwatt_grid_import_power\", \"state_topic\": \"solarwatt/grid_import_power\", \"icon\": \"mdi:transmission-tower-import\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_grid_import_power\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_grid_export_power/config\", payload: JSON.stringify({\"name\": \"Solarwatt Grid Export Power\", \"unique_id\": \"solarwatt_grid_export_power\", \"state_topic\": \"solarwatt/grid_export_power\", \"icon\": \"mdi:transmission-tower-export\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_grid_export_power\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_charge_power/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Charge Power\", \"unique_id\": \"solarwatt_battery_charge_power\", \"state_topic\": \"solarwatt/battery_charge_power\", \"icon\": \"mdi:battery-arrow-up\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_battery_charge_power\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_discharge_power/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Discharge Power\", \"unique_id\": \"solarwatt_battery_discharge_power\", \"state_topic\": \"solarwatt/battery_discharge_power\", \"icon\": \"mdi:battery-arrow-down\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_battery_discharge_power\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_power_net/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Power Net\", \"unique_id\": \"solarwatt_battery_power_net\", \"state_topic\": \"solarwatt/battery_power_net\", \"icon\": \"mdi:battery-high\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_battery_power_net\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_power_raw/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Power Raw\", \"unique_id\": \"solarwatt_battery_power_raw\", \"state_topic\": \"solarwatt/battery_power_raw\", \"icon\": \"mdi:battery-heart-variant\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"W\", \"device_class\": \"power\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_battery_power_raw\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_soc/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery SOC\", \"unique_id\": \"solarwatt_battery_soc\", \"state_topic\": \"solarwatt/battery_soc\", \"icon\": \"mdi:battery\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"%\", \"device_class\": \"battery\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_battery_soc\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_temperature/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Temperature\", \"unique_id\": \"solarwatt_battery_temperature\", \"state_topic\": \"solarwatt/battery_temperature\", \"icon\": \"mdi:thermometer\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"C\", \"device_class\": \"temperature\", \"state_class\": \"measurement\", \"object_id\": \"solarwatt_battery_temperature\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_mode/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Mode\", \"unique_id\": \"solarwatt_battery_mode\", \"state_topic\": \"solarwatt/battery_mode\", \"icon\": \"mdi:home-battery-outline\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"object_id\": \"solarwatt_battery_mode\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_produced_total/config\", payload: JSON.stringify({\"name\": \"Solarwatt Produced Total\", \"unique_id\": \"solarwatt_produced_total\", \"state_topic\": \"solarwatt/produced_total\", \"icon\": \"mdi:solar-power-variant\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_produced_total\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_grid_import_total/config\", payload: JSON.stringify({\"name\": \"Solarwatt Grid Import Total\", \"unique_id\": \"solarwatt_grid_import_total\", \"state_topic\": \"solarwatt/grid_import_total\", \"icon\": \"mdi:transmission-tower-import\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_grid_import_total\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_grid_export_total/config\", payload: JSON.stringify({\"name\": \"Solarwatt Grid Export Total\", \"unique_id\": \"solarwatt_grid_export_total\", \"state_topic\": \"solarwatt/grid_export_total\", \"icon\": \"mdi:transmission-tower-export\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_grid_export_total\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_home_consumption_total/config\", payload: JSON.stringify({\"name\": \"Solarwatt Home Consumption Total\", \"unique_id\": \"solarwatt_home_consumption_total\", \"state_topic\": \"solarwatt/home_consumption_total\", \"icon\": \"mdi:home-lightning-bolt\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_home_consumption_total\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_self_consumed_total/config\", payload: JSON.stringify({\"name\": \"Solarwatt Self Consumed Total\", \"unique_id\": \"solarwatt_self_consumed_total\", \"state_topic\": \"solarwatt/self_consumed_total\", \"icon\": \"mdi:flash\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_self_consumed_total\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_charged_from_grid_total/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Charged From Grid Total\", \"unique_id\": \"solarwatt_battery_charged_from_grid_total\", \"state_topic\": \"solarwatt/battery_charged_from_grid_total\", \"icon\": \"mdi:battery-charging\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_battery_charged_from_grid_total\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_out_total_site/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Out Total Site\", \"unique_id\": \"solarwatt_battery_out_total_site\", \"state_topic\": \"solarwatt/battery_out_total_site\", \"icon\": \"mdi:battery-arrow-up\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_battery_out_total_site\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_charge_total_raw/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Charge Total Raw\", \"unique_id\": \"solarwatt_battery_charge_total_raw\", \"state_topic\": \"solarwatt/battery_charge_total_raw\", \"icon\": \"mdi:battery-plus\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_battery_charge_total_raw\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nnode.send({ topic: \"homeassistant/sensor/solarwatt_battery_discharge_total_raw/config\", payload: JSON.stringify({\"name\": \"Solarwatt Battery Discharge Total Raw\", \"unique_id\": \"solarwatt_battery_discharge_total_raw\", \"state_topic\": \"solarwatt/battery_discharge_total_raw\", \"icon\": \"mdi:battery-minus\", \"device\": {\"identifiers\": [\"solarwatt\"], \"name\": \"PV Solarwatt\", \"manufacturer\": \"Solarwatt / KiwiGrid / FoxESS\", \"model\": \"Solarwatt Energy Manager\", \"hw_version\": \"Battery Vision One\", \"sw_version\": \"mqtt-v1\"}, \"unit_of_measurement\": \"kWh\", \"device_class\": \"energy\", \"state_class\": \"total_increasing\", \"object_id\": \"solarwatt_battery_discharge_total_raw\", \"availability_topic\": \"solarwatt/status\", \"payload_available\": \"online\", \"payload_not_available\": \"offline\"}), retain: true, qos: 1 });\nreturn null;", "outputs": 1, "noerr": 0, "x": 450, "y": 200, "wires": [ [ "disc_consolidated_out" ] ] }, { "id": "disc_consolidated_out", "type": "mqtt out", "z": "4587847568fd2353", "name": "MQTT Discovery out", "topic": "", "qos": "1", "retain": "true", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "b2f1d497c83e5a12", "x": 730, "y": 200, "wires": [] }, { "id": "mqtt_energy_out", "type": "mqtt out", "z": "4587847568fd2353", "name": "MQTT energy values", "topic": "", "qos": "0", "retain": "true", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "b2f1d497c83e5a12", "x": 950, "y": 1100, "wires": [] }, { "id": "mqtt_items_out", "type": "mqtt out", "z": "4587847568fd2353", "name": "MQTT items values", "topic": "", "qos": "0", "retain": "true", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "b2f1d497c83e5a12", "x": 950, "y": 1400, "wires": [] } ]