I have a simple lamps controller (on a raspberry) that subscribes MQTT messages '/floor1/terrace/lamps', turns on up-to 9 lamps and publishes the newly set pattern via '/floor1/terrace/lamps_r'. Additionally a local switch may also change this pattern and will therefore publish it on '/floor1/terrace/lamps_r'. The pattern is a number to hold a bit-pattern that corresponds to the lamp outputs.
I'd wanted to control these lamps using a node-red-dashboard and have them updated according to their current state, so I created an ui-dropdown with the corresponding patterns (moon symbols)
The flow receives 'lamps_r' to show it on ui-dropdown (pass msg through selected) and sends the message if it changes to 'lamps'
This works flawlessly, however after a mqtt disconnection (broker down or network disconnect) this rapidly cycles through the patterns defined in the ui-dropdown forever.
Here's the flow
[
{
"id": "4ec0402f.174028",
"type": "mqtt out",
"z": "f6f2187d.f17ca8",
"name": "",
"topic": "floor1/terrace/lamps",
"qos": "0",
"retain": "false",
"broker": "26e8c216.d6cd06",
"x": 900,
"y": 200,
"wires": []
},
{
"id": "a6324306.af9eb8",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "incoming",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 580,
"y": 320,
"wires": []
},
{
"id": "4097bb88.a6b6fc",
"type": "ui_dropdown",
"z": "f6f2187d.f17ca8",
"name": "",
"label": "Lamps",
"tooltip": "",
"place": "Select option",
"group": "83e0c62c.0828d8",
"order": 1,
"width": 0,
"height": 0,
"passthru": false,
"multiple": false,
"options": [
{
"label": "????????????????????????????????????",
"value": 0,
"type": "num"
},
{
"label": "????????????????????????????????????",
"value": 1,
"type": "num"
},
{
"label": "????????????????????????????????????",
"value": 56,
"type": "num"
},
{
"label": "????????????????????????????????????",
"value": 17,
"type": "num"
},
{
"label": "????????????????????????????????????",
"value": 170,
"type": "num"
},
{
"label": "????????????????????????????????????",
"value": 85,
"type": "num"
},
{
"label": "????????????????????????????????????",
"value": 255,
"type": "num"
}
],
"payload": "",
"topic": "",
"x": 510,
"y": 200,
"wires": [
[
"29bfc4ae.3bfd64"
]
]
},
{
"id": "1592291a.25645f",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "",
"topic": "floor1/terrace/lamps_r",
"qos": "2",
"datatype": "json",
"broker": "26e8c216.d6cd06",
"x": 320,
"y": 200,
"wires": [
[
"4097bb88.a6b6fc",
"a6324306.af9eb8"
]
]
},
{
"id": "123f5abc.e6551d",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "MQTT message propagation",
"info": "the dropdown element only shows the received state if the message is passed through!\nTo avoid an endless cycle 'only_if_changed' filters the message propagation if the current state was changed already.",
"x": 640,
"y": 260,
"wires": []
},
{
"id": "7776ebb4.fafda4",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "outgoing",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 930,
"y": 320,
"wires": []
},
{
"id": "29bfc4ae.3bfd64",
"type": "rbe",
"z": "f6f2187d.f17ca8",
"name": "",
"func": "rbe",
"gap": "",
"start": "",
"inout": "out",
"property": "payload",
"x": 670,
"y": 200,
"wires": [
[
"4ec0402f.174028",
"7776ebb4.fafda4"
]
]
},
{
"id": "26e8c216.d6cd06",
"type": "mqtt-broker",
"name": "Morpheus",
"broker": "morpheus.lan",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": false,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "83e0c62c.0828d8",
"type": "ui_group",
"name": "Default",
"tab": "c3af9807.77191",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "c3af9807.77191",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
I'm a complete newbie on node-red and pretty clueless about what might be going on.


