Comments (3)
Seems like there is one issue, which I have not found a resolution for, but you might be able to understand this.
With the above patch, I can successfully connect to my broker using mqtts and client certificates. homebridge-mqtt publish several messages and subscribe to some topics. Then it disconnects and reconnects every few seconds. There's no extra output from homebridge, so it looks like the homebridge-mqtt is unaware that the client is disconnecting.
From the logs it looks like the client tries to connect a second time, which causes the disconnect.
I've tried both mosquitto v1.4.8 and mosquitto v1.4.11 with the same result.
1494113633: mosquitto version 1.4.11 (build date Mon, 20 Feb 2017 22:47:27 +0000) starting
1494113633: Config loaded from /etc/mosquitto/mosquitto.conf.
1494113633: Opening ipv4 listen socket on port 8883.
1494113633: Opening ipv6 listen socket on port 8883.
1494113634: New connection from 10.1.50.120 on port 8883.
1494113634: New client connected from 10.1.50.120 as mqttjs_470dec79 (c1, k60, u'username').
1494113634: Sending CONNACK to mqttjs_470dec79 (0, 0)
1494113634: Received SUBSCRIBE from mqttjs_470dec79
1494113634: homebridge/to/# (QoS 0)
1494113634: mqttjs_470dec79 0 homebridge/to/#
1494113634: Sending SUBACK to mqttjs_470dec79
1494113634: Received SUBSCRIBE from mqttjs_470dec79
1494113634: homebridge/to/# (QoS 0)
1494113634: mqttjs_470dec79 0 homebridge/to/#
1494113634: Sending SUBACK to mqttjs_470dec79
1494113634: Received SUBSCRIBE from mqttjs_470dec79
1494113634: homebridge/to/# (QoS 0)
1494113634: mqttjs_470dec79 0 homebridge/to/#
1494113634: Sending SUBACK to mqttjs_470dec79
1494113634: Received SUBSCRIBE from mqttjs_470dec79
1494113634: homebridge/to/# (QoS 0)
1494113634: mqttjs_470dec79 0 homebridge/to/#
1494113634: Sending SUBACK to mqttjs_470dec79
1494113634: Received SUBSCRIBE from mqttjs_470dec79
1494113634: homebridge/to/# (QoS 0)
1494113634: mqttjs_470dec79 0 homebridge/to/#
1494113634: Sending SUBACK to mqttjs_470dec79
1494113634: Received PUBLISH from mqttjs_470dec79 (d0, q0, r0, m0, 'homebridge/from/connected', ... (30 bytes))
1494113634: New connection from 10.1.50.33 on port 8883.
1494113634: Sending CONNACK to 10.1.50.33 (0, 5)
1494113634: Socket error on client , disconnecting.
1494113635: New connection from 10.1.50.33 on port 8883.
1494113635: Sending CONNACK to 10.1.50.33 (0, 5)
1494113635: Socket error on client , disconnecting.
from homebridge-mqtt.
Doing some further debugging on my patch, I found that the disconnects happens because another python client is misbehaving. Disabling the python client makes everything work as expected.
from homebridge-mqtt.
And to close this from my side....
You need to pass the options when connecting anonymously as well, to enable certificates with anonymous connections. (This is probably very relevant as the username/password is likely to be dropped when you authenticate with certificates).
It looks like these lines could be simplified to allow this:
if(options.username === null || options.password === null) {
this.log("connect Anonymous");
client = mqtt.connect(url);
} else {
this.log("connect Authentication with username/password");
client = mqtt.connect(url, options);
}
Changing the above lines to:
this.log("connecting");
client = mqtt.connect(url, options);
Would work for both anonymous connections and when using username/password.
from homebridge-mqtt.
Related Issues (20)
- Temperature limit 100.0° ? HOT 9
- Implementing Television HOT 7
- how to read AccessoryInformation
- I don't understand where topic/payload go in homebridge config.json HOT 2
- MQTT broker not starting HOT 2
- pulling sensors from adafruit.io to homekit through homebridge and mqtt HOT 7
- mqtt Broker in the Internet
- error on adding new accessories HOT 12
- Missing Protocol on URL
- Television Service HOT 3
- Problem with Hoobs V4 HOT 1
- Restart Causes Old MQTT Commands to Execute
- homebridge/from/set missing service_type HOT 13
- Tasmota - Home bridge
- to/get Empty Responses? HOT 1
- Controlling dummy switches
- color lights not supported HOT 1
- 如何通过mqtt 使用 Lightbulb 创建一个 有亮度 和冷暖色的灯泡
- Topic: homebridge/to/add does not work for characteristics HOT 1
- How to install on Hassio / Home Assistant? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-mqtt.