Closed viictor924 closed 6 years ago
Your config.json (url) does not correspond to the documentation. Have a look here: https://github.com/cflurin/homebridge-mqtt#configuration
How did you define the mqtt-broker in node-red?
Hey,
Thanks for your quick response!
The config says to replace 127.0.0.1 with the ip-address of my mqtt broker. I'm using a cloud mqtt broker (from https://www.cloudmqtt.com) so I think my url should be "m12.cloudmqtt.com" (this is what I used in node-red and my esp8266's). I assume you and others are using a local broker hosted on a pi or similar, which is why you're using the direct ip address for it.
Node-RED required four things to connect to my cloud broker:
Here's my node-RED configuration for the mqtt-broker. The user/passwords were registered in the "Security" tab.
Add "port" to config.json:
{ "platform": "mqtt", "name": "mqtt", "url": "m12.cloudmqtt.com", "port": "10149", "topic_type": "multiple", "topic_prefix": "homebridge", "username": "username", "password": "password" }
Thanks! that solved it! I didn't see a "port" option in your example config so I wrongly assumed I couldn't add it as a separate variable.
You are right, I've to update README. The port default is 1883
so for almost all users it works.
HI,
I'm getting the following connection error when I try run homebridge-mqtt
[1/3/2018, 7:42:25 PM] [mqtt] connect error! (url = wss://m12.cloudmqtt.com:30149) [1/3/2018, 7:42:50 PM] [mqtt] on.offline
[1/3/2018, 7:42:50 PM] [mqtt] on.close
[1/3/2018, 7:42:51 PM] [mqtt] on.reconnect
[1/3/2018, 7:43:21 PM] [mqtt] on.close
[1/3/2018, 7:43:22 PM] [mqtt] on.reconnect
This is how my config.json looks: { "platform": "mqtt", "name": "mqtt", "url": "wss://m12.cloudmqtt.com:30149", "topic_type": "multiple", "topic_prefix": "homebridge", "username": "username", "password": "password" },
I've tried changing the url protocol to mqtt, mqtts, etc. I've also tried removing the port (mqtt://m12.cloudmqtt.com) but everything gives the same "Connect error!" message. This seems like it could have a simple fix but I'm not sure where to focus my debugging anymore. I've got an ESP8266 and a node-red successfully connecting to the same cloudmqtt broker so I think the broker is configured correctly.
Any ideas?