Problem
Es kommt - vor allem beim Miniserver Gen 2 - häufig vor, dass nach dem Speichern der Config in den Miniserver die Loxone Nodes keine Verbindung mehr zum MS aufbauen.
Siehe Reconnect to Miniserver fails sometimes after new Config File is stored to Miniserver · Issue #73 · codmpm/node-red-contrib-loxone
Workaround
Solange es keine Lösung für das Problem gibt, kann folgender Workaround verwendet werden.
[
{
"id": "a70a29c9f76e0c2a",
"type": "tab",
"label": "Restart Node Red",
"disabled": false,
"info": "",
"env": []
},
{
"id": "e7eacba0deac7bf5",
"type": "exec",
"z": "a70a29c9f76e0c2a",
"command": "node-red-restart",
"addpay": false,
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "Restart Node-RED",
"x": 970,
"y": 240,
"wires": [
[],
[],
[]
]
},
{
"id": "36da930ca9816800",
"type": "loxone-online",
"z": "a70a29c9f76e0c2a",
"name": "MS connection ",
"miniserver": "bda880d5.2d4e98",
"x": 140,
"y": 360,
"wires": [
[
"31cfba81baee508a"
]
]
},
{
"id": "da2756de.d5664",
"type": "debug",
"z": "a70a29c9f76e0c2a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 300,
"wires": []
},
{
"id": "63503f14.9acb28",
"type": "trigger",
"z": "a70a29c9f76e0c2a",
"name": "",
"op1": "",
"op2": "node-red-restart",
"op1type": "nul",
"op2type": "str",
"duration": "1",
"extend": false,
"overrideDelay": false,
"units": "min",
"reset": "true",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 710,
"y": 280,
"wires": [
[
"da2756de.d5664",
"e7eacba0deac7bf5"
]
]
},
{
"id": "31cfba81baee508a",
"type": "switch",
"z": "a70a29c9f76e0c2a",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 350,
"y": 360,
"wires": [
[
"63503f14.9acb28"
],
[
"ed8648516cc523d1"
]
]
},
{
"id": "82d5e91aa08ff31b",
"type": "comment",
"z": "a70a29c9f76e0c2a",
"name": "limit not connected messages, there are a lot!",
"info": "",
"x": 530,
"y": 420,
"wires": []
},
{
"id": "ec0cb9b2c261d43d",
"type": "comment",
"z": "a70a29c9f76e0c2a",
"name": "Restart Node Red if no connection to MS for > 1 min",
"info": "",
"x": 510,
"y": 160,
"wires": []
},
{
"id": "645d44bd666f126b",
"type": "inject",
"z": "a70a29c9f76e0c2a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": "0.0",
"topic": "",
"payload": "false",
"payloadType": "bool",
"x": 130,
"y": 280,
"wires": [
[
"63503f14.9acb28"
]
]
},
{
"id": "75266b9039c5f86d",
"type": "comment",
"z": "a70a29c9f76e0c2a",
"name": "initialize trigger",
"info": "",
"x": 140,
"y": 240,
"wires": []
},
{
"id": "ed8648516cc523d1",
"type": "delay",
"z": "a70a29c9f76e0c2a",
"name": "",
"pauseType": "rate",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "30",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": true,
"allowrate": false,
"outputs": 1,
"x": 540,
"y": 380,
"wires": [
[
"63503f14.9acb28",
"aedd95a05a3c85f5"
]
]
},
{
"id": "aedd95a05a3c85f5",
"type": "debug",
"z": "a70a29c9f76e0c2a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 790,
"y": 380,
"wires": []
},
{
"id": "bda880d5.2d4e98",
"type": "loxone-miniserver",
"host": "192.168.178.230",
"port": "80",
"enctype": "0",
"active": true,
"keepalive": "30000"
}
]
Wie funktioniert es?
Geht die Verbindung verloren, so sendet der Node MS connection eine false Message.
Diese false Message startet den 1 Minuten Trigger.
Kommt innerhalb dieser einen Minute keine true Message (diese setzt den Trigger zurück), so wird nach einer Minute ein Node Red restart ausgeführt.
Die Initialisierung des Triggers ist notwendig, damit er in einem definierten Zustand ist.
Hinweis: Es kann (zumindest bei mir) deutlich länger als eine Minute dauern, bis der Trigger feuert und ein Restart gemacht wird. Das dürfte daran liegen, dass die not-connectet Messages mit fulls speed kommen und anscheinend das ganze Node Red überlasten. Siehe Node online sends a lot of messages on disconnect · Issue #72 · codmpm/node-red-contrib-loxone