Repository navigation
Closed
Copy link
Description
Current Behavior
When issuing a connect action to MQTT nodes, it is possible to get the node into an odd state by entering port 1883 on the static config BUT issuing a connect action with broker.url set to mqtts://host.name
NOTE: If broker.broker: host.name and broker.port: 8883 are used instead of broker.url: mqtts://host.name, this works everytime.
Expected Behavior
Should work like it does when connecing using broker.broker and broker.port (i.e. first time, every time)
Steps To Reproduce
Import flow
Click "connect with force"
Click "connect with force" again
Try other disconnect and connect - same issue.
Example flow
[{"id":"fa2f97490dc579a0","type":"change","z":"83c449fe82df6dbc","name":"action disconnect","rules":[{"t":"set","p":"action","pt":"msg","to":"disconnect","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1610,"y":800,"wires":[["6999d2188a087109","c057ebe8ae700411"]]},{"id":"de0188a63a0d8c62","type":"inject","z":"83c449fe82df6dbc","name":"disconect/pause/connect","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1370,"y":800,"wires":[["fa2f97490dc579a0"]]},{"id":"6999d2188a087109","type":"mqtt out","z":"83c449fe82df6dbc","name":"Subscriber","topic":"","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"20f13f9c318f30d1","x":1870,"y":960,"wires":[]},{"id":"c057ebe8ae700411","type":"delay","z":"83c449fe82df6dbc","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1765,"y":800,"wires":[["324304b1d22c61ad"]],"l":false},{"id":"324304b1d22c61ad","type":"change","z":"83c449fe82df6dbc","name":"Connect","rules":[{"t":"set","p":"action","pt":"msg","to":"connect","tot":"str"},{"t":"set","p":"broker.url","pt":"msg","to":"mqtts://broker.emqx.io","tot":"str"},{"t":"set","p":"broker.usetls","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"broker.protocolVersion","pt":"msg","to":"5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1580,"y":860,"wires":[["6999d2188a087109"]]},{"id":"5a4426cfb353b30c","type":"inject","z":"83c449fe82df6dbc","name":"disconnect action .","props":[{"p":"action","v":"disconnect","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1350,"y":960,"wires":[["6999d2188a087109"]]},{"id":"bf68091ee1e919e9","type":"inject","z":"83c449fe82df6dbc","name":"connect with force","props":[{"p":"payload"},{"p":"broker.force","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1350,"y":860,"wires":[["324304b1d22c61ad"]]},{"id":"8eed58bae560c066","type":"inject","z":"83c449fe82df6dbc","name":"connect no force","props":[{"p":"payload"},{"p":"broker.force","v":"false","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1340,"y":920,"wires":[["324304b1d22c61ad"]]},{"id":"12ae646f234f6aa0","type":"mqtt in","z":"83c449fe82df6dbc","name":"","topic":"nr-test-1/time","qos":"1","datatype":"auto-detect","broker":"20f13f9c318f30d1","nl":false,"rap":true,"rh":0,"inputs":0,"x":1670,"y":1060,"wires":[["be7d2a1974d68b4f"]]},{"id":"be7d2a1974d68b4f","type":"debug","z":"83c449fe82df6dbc","name":"time","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1890,"y":1060,"wires":[]},{"id":"f13051eb200258d8","type":"mqtt out","z":"83c449fe82df6dbc","name":"","topic":"nr-test-1/time","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"20f13f9c318f30d1","x":1510,"y":1060,"wires":[]},{"id":"928caa4022cc83c2","type":"inject","z":"83c449fe82df6dbc","name":"time","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"$moment().format('HH:mm:ss')","payloadType":"jsonata","x":1310,"y":1060,"wires":[["f13051eb200258d8"]]},{"id":"73f8b4789d468e86","type":"comment","z":"83c449fe82df6dbc","name":"NG: Connect to broker.url mqtts://xxxxx","info":"","x":1410,"y":760,"wires":[]},{"id":"20f13f9c318f30d1","type":"mqtt-broker","name":"EMQX","broker":"-","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":""}]
Environment
- Node-RED version: 3.0.2, 4.0.9
- Node.js version:
- npm version:
- Platform/OS:
- Browser:

Activity
Fix MQTT connect action dropping its url when repeated