[SOLVED] Frequent MQTT disconnections; "Device Already Connected"


You’ll want to double-click the mqtt node to bring up its configuration. Then edit the broker details and use the following information:

Broker: broker.losant.com
Port: 1883
Client ID: your gateway’s device ID
Username: your access key
Password: your access secret

You are correct on the topic to publish to, which is losant/your-peripheral-id/state. The payload is required to be JSON and look like the following:

  "data" : {
    "attribute-name" : Number | String | Boolean,
    "attribute-name-2" : Number | String | Boolean

You can use the Application Communication Log to help debug possible issues.


I wrote a full article describing how to use Node-RED as a Losant gateway. Check it out here: https://www.losant.com/blog/how-to-use-node-red-as-losant-gateway