-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Connection refused: Not authorized #50
Comments
So you have to edit the client.js file (for me it is here: /usr/local/lib/node_modules/homebridge-dafang/node_modules/mqtt/lib/client.js). Find the Section: var defaultConnectOptions = { And add the authentication stuff like this: Hope this helps! Best se_dony |
Hi thanks for your help. Meanwhile I have sorted it in kind of different way. Well, kind of. |
Same issue here. There's nowhere in the homebridge-dafang configuration for adding the username/password for the mosquitto server. This should presumably be in the "mqtt:" section of the plugin configuration. I tried adding it to client.js as sedony23 suggested, but that didn't work. I switched to homebridge-dafang-mqtt-republish in conjunction with homebridge-camera-ffmpeg, and that is working perfectly. So it's not a problem with my MQTT server. |
The easiest solution is to leave "allow_anonymous true" in the mosquitto config, and also create a password file, so that both authenticated and anonymous connections are handled. |
Hello,
I am getting stuck with error message as follows:
Error: Connection refused: Not authorized
at MqttClient._handleConnack (/usr/lib/node_modules/mqtt/lib/client.js:920:15)
at MqttClient._handlePacket (/usr/lib/node_modules/mqtt/lib/client.js:350:12)
at work (/usr/lib/node_modules/mqtt/lib/client.js:292:12)
at Writable.writable._write (/usr/lib/node_modules/mqtt/lib/client.js:302:5)
at doWrite (/usr/lib/node_modules/readable-stream/lib/_stream_writable.js:428:64)
at writeOrBuffer (/usr/lib/node_modules/readable-stream/lib/_stream_writable.js:417:5)
at Writable.write (/usr/lib/node_modules/readable-stream/lib/_stream_writable.js:334:11)
at Socket.ondata (_stream_readable.js:693:20)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:145:17)
Tried already with two different mqtt servers, and the outcome is still the same. Would you have any idea, what do I do wrong?
Xiaomi Xiaofang cam, tried mqtt in Homebridge (RPi) and on Synology NAS,
mqtt.conf:
Options for mosquitto_sub & mosquitto_pub
USER="homebridge"
PASS="homebridge"
HOST=10.10.0.10
PORT=1883
config.json:
{
"platform": "Dafang",
"mqtt": {
"hostBroker": false,
"port": 1883,
"host": "10.10.0.10",
"debug": true
},
"cameras":
The text was updated successfully, but these errors were encountered: