Closed btgh closed 2 years ago
Hi @btgh, it sounds like a network connectivity issue between homebridge and the MQTT broker Could you please start a Terminal session from the Homebridge UI menu and type the following:
nc -vz 192.168.10.9 1883
If its able to connect you should see a message like:
192.168.10.9 (192.168.10.9:1883) open
If there's no message or some other message its likely a network issue
Why that ip adress? My ip adress of the Omni link controller is 10.0.0.252
Get Outlook for iOShttps://aka.ms/o0ukef
From: mantorok1 @.> Sent: Thursday, June 16, 2022 8:42:36 PM To: mantorok1/homebridge-omnilink-platform @.> Cc: Subscribed @.***> Subject: Re: [mantorok1/homebridge-omnilink-platform] MQTT ECONNREFUSED (Issue #17)
Hi @btghhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fbtgh&data=05%7C01%7C%7C877cc5564b134bb1724c08da50136c4a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637910341603402836%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=kGP0zSEbO0eH0RvRLD9bHOGXaBkjJlfVbkG7uhNrFSE%3D&reserved=0, it sounds like a network connectivity issue between homebridge and the MQTT broker Could you please start a Terminal session from the Homebridge UI menu and type the following:
nc -vz 192.168.10.9 1883
If its able to connect you should see a message like:
192.168.10.9 (192.168.10.9:1883) open
If there's no message or some other message its likely a network issue
— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmantorok1%2Fhomebridge-omnilink-platform%2Fissues%2F17%23issuecomment-1158458566&data=05%7C01%7C%7C877cc5564b134bb1724c08da50136c4a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637910341603402836%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=4mWPCR5nNb0aYMc%2BO2%2BmJNacn599QUk52zzjx%2Bz%2BXQ8%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAQHZNG5APK2FBPS5L2XZEXLVPPX2ZANCNFSM5Y7I6FJA&data=05%7C01%7C%7C877cc5564b134bb1724c08da50136c4a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637910341603402836%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=W2OIeUVgfSqxukQmO8bCTG5CbQ14CdMqkf1JlwhiAxM%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Its not a connectivity issue with the Omni, it looks like its with the MQTT broker. Based on the config the broker's ip address is 192.168.10.9
I should have mentioned that both homebridge and mosquito are on the same Ubuntu machine - localhost gives the same result. From the terminal I get a failed connection using nc but isn't that the correct behavior since I'm not authenticating with mqtt server? I can connect using the mosquito tools running in the homebrindge terminal window (via browser on my Mac).
Homebridge Terminal
Node.js Version: v16.15.1 Node.js Path: /opt/homebridge/bin/node Plugin Path: /var/lib/homebridge/node_modules
Update Node.js: hb-service update-node
Install Plugin: hb-service add homebridge-plugin-name Remove Plugin: hb-service remove homebridge-plugin-name
homebridge@homebridge-PC:/var/lib/homebridge $ nc -vz 192.168.10.9 1883 nc: connect to 192.168.10.9 port 1883 (tcp) failed: Connection refused homebridge@homebridge-PC:/var/lib/homebridge $ mosquitto_sub -u omni -P 047b85 -t "sandwich_omni" -p 1883 hello hombridge homebridge@homebridge-PC:/var/lib/homebridge $ mosquitto_pub -u omni -P 047b85 -t "sandwich_omni" -p 1883 -m "hello from homebridge" homebridge@homebridge-PC:/var/lib/homebridge $
terminal season on same machine: homebridge-PC:~$ mosquitto_pub -u omni -P 047b85 -t "sandwich_omni" -p 1883 -m "hello hombridge" homebridge-PC:~$ mosquitto_sub -u omni -P 047b85 -t "sandwich_omni" -p 1883 hello from homebridge:
Before any authentication can occur the plugin needs to be able to connect to the port. As its saying "connection refused" there is something blocking it.
It's odd that mosquitto_sub
can connect ok though. Perhaps a firewall rule is blocking Homebridge from connecting to the mosquitto broker but allowing mosquitto_sub
?
What happens if you run the above nc
command on the normal Ubuntu terminal?
looks like a security feature was added to mosquito requiring explicit access to the LAN IP. Once I added the following to the default.conf file mqtt now works fine.
listener 1883 127.0.0.1 listener 1883 192.168.10.9
Hi @btgh, interesting find. I checked my own config file which has:
listener 1883
Maybe that allows access from any IP address. I haven't upgraded mosquitto in a while though so its possible that may not work anymore. BTW, you're the first person I know that is using MQTT on my omnilink plugin (I don't use it myself). Let me know how it goes or if there's any issues with it.
Describe Your Problem: I'm having a problem authenticating with MQTT from home bridge but it works find from the mosquito client
Logs:
Plugin Config:
Screenshots:
Environment: