Hi,
I have over 100 mqtt broker on various places running, they are not allowed to be connected except in case of an emergency. To send them an "stop", I would like to use the mqtt-in node dynamically. For easy testing, I only use the username for now.
msg.connect
msg.username1
msg.payload...
msg.disconnect
repeat for the next username
...
But the MQTT node is not connecting. I tried to google, ChatGPD... Also I tried to input a variable in the credentials inside the node but had no success. When I add the username directly into the node, it connects directly. So the Broker works fine.
Do you have any ideas??
Here´s my code:
[
{
"id": "989ce477843d6ccb",
"type": "inject",
"z": "a07c6f2deb801e7a",
"name": "connect",
"props": [
{
"p": "action",
"v": "connect",
"vt": "str"
},
{
"p": "username",
"v": "fakeusername",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 590,
"y": 800,
"wires": [
[
"a8750ccc1e9f1a78",
"43c3fe97cfaf9f04"
]
]
},
{
"id": "43c3fe97cfaf9f04",
"type": "debug",
"z": "a07c6f2deb801e7a",
"name": "debug 17",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 840,
"y": 880,
"wires": []
},
{
"id": "a8750ccc1e9f1a78",
"type": "mqtt out",
"z": "a07c6f2deb801e7a",
"name": "",
"topic": "",
"qos": "0",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "52ed6cadc9f74173",
"x": 830,
"y": 800,
"wires": []
},
{
"id": "df44c2bae5d48a68",
"type": "inject",
"z": "a07c6f2deb801e7a",
"name": "",
"props": [
{
"p": "action",
"v": "\"disconnect\"",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 590,
"y": 860,
"wires": [
[
"a8750ccc1e9f1a78",
"43c3fe97cfaf9f04"
]
]
},
{
"id": "52ed6cadc9f74173",
"type": "mqtt-broker",
"name": "test connect",
"broker": "192.168.178.12",
"port": "1883",
"clientid": "",
"autoConnect": false,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]