ich steuere hier eine Gasheizung / Wärmepumpe - Werte werden per MQTT verschickt, aber auch wenn ich woanders umschalte ändert der Victron-Schalter seine Stellung
Ich weiss - was anderes als Dein Problem - aber kopier den Flow doch mal rein, da siehst wie man Schalterstellungen extern beeinflussen kann
[
{
"id": "05538940ac9c397d",
"type": "victron-virtual-switch",
"z": "203330207fd5f20e",
"name": "Steuerung Gasheizung",
"outputs": 2,
"switch_1_type": "6",
"switch_1_initial": 0,
"switch_1_label": "[\"Gasheizung aus\",\"Gasheizung an bei Abtauen\",\"Gasheizung dauernd an\"]",
"switch_1_customname": "Heizen Gas",
"switch_1_group": "Heizung",
"switch_1_include_measurement": false,
"switch_1_rgb_color_wheel": false,
"switch_1_cct_wheel": false,
"switch_1_rgb_white_dimmer": false,
"x": 760,
"y": 880,
"wires": [
[],
[
"0a96f817d3cd6bef"
]
]
},
{
"id": "c487fa4ac3dfdd01",
"type": "mqtt in",
"z": "203330207fd5f20e",
"name": "IN: Wert vom Broker",
"topic": "Heizungssteuerung/HeiztoVictron",
"qos": "0",
"datatype": "auto",
"broker": "5b6f6bd3ef4c8a21",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 170,
"y": 880,
"wires": [
[
"41530a4377a1e71d"
]
]
},
{
"id": "050d12f5f68db50b",
"type": "function",
"z": "203330207fd5f20e",
"name": "function 8",
"func": "// Heizung sendet 1..3\nvar v = msg.payload;\nif (typeof v === \"string\") v = v.trim();\nv = Number(v);\n\nif (v !== 1 && v !== 2 && v !== 3) return null;\n\n// Map 1..3 -> 0..2 für Victron\nvar idx = v - 1;\n\n// merken: Status kam vom Gerät (Gas)\nflow.set(\"lastStatusIdx_gas\", idx);\nflow.set(\"lastStatusTs_gas\", Date.now());\n\n// Switch setzen (Victron erwartet DBus-Pfad -> Wert)\nmsg.payload = { \"/SwitchableOutput/output_1/Dimming\": idx };\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 880,
"wires": [
[
"05538940ac9c397d"
]
]
},
{
"id": "6a2d2eafdf477f32",
"type": "function",
"z": "203330207fd5f20e",
"name": "function 9",
"func": "// Victron Selected liefert 0..2\nvar idx = Number(msg.payload);\nif (idx !== 0 && idx !== 1 && idx !== 2) return null;\n\n// Echo-Schutz (Gas)\nvar lastIdx = flow.get(\"lastStatusIdx_gas\");\nvar lastTs = flow.get(\"lastStatusTs_gas\");\nvar now = Date.now();\nvar WINDOW = 800; // ms\n\nif (lastTs !== undefined && (now - lastTs) < WINDOW && lastIdx === idx) {\n return null;\n}\n\n// Map 0..2 -> 1..3 für Heizung\nmsg.topic = \"Heizungssteuerung/HeizfromVictron\";\nmsg.payload = idx + 1;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 980,
"wires": [
[
"919f578ce6f8a637"
]
]
},
{
"id": "919f578ce6f8a637",
"type": "mqtt out",
"z": "203330207fd5f20e",
"name": "",
"topic": "",
"qos": "",
"retain": "true",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "5b6f6bd3ef4c8a21",
"x": 690,
"y": 980,
"wires": []
},
{
"id": "41530a4377a1e71d",
"type": "rbe",
"z": "203330207fd5f20e",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 350,
"y": 880,
"wires": [
[
"050d12f5f68db50b"
]
]
},
{
"id": "0a96f817d3cd6bef",
"type": "rbe",
"z": "203330207fd5f20e",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"septopics": true,
"property": "payload",
"topi": "topic",
"x": 190,
"y": 980,
"wires": [
[
"6a2d2eafdf477f32"
]
]
},
{
"id": "5b6f6bd3ef4c8a21",
"type": "mqtt-broker",
"name": "Broker (dein anderer)",
"broker": "192.168.178.47",
"port": "1883",
"clientid": "nodered-mqtt-in",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "a11cfeb50cecf9b2",
"type": "global-config",
"env": [],
"modules": {
"@victronenergy/node-red-contrib-victron": "1.7.8"
}
}
]