Skip to content
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

Can't connect to local Mosquitto server #17

Closed
jelimoore opened this issue Oct 21, 2016 · 11 comments
Closed

Can't connect to local Mosquitto server #17

jelimoore opened this issue Oct 21, 2016 · 11 comments

Comments

@jelimoore
Copy link

Hello,

The Homekit2MQTT bridge will not connect to my local Mosquitto instance. I can sub and pub using the built-in mosquitto commands, but I cannot see anything coming from the homekit2mqtt bridge. Specified URL is "tcp://localhost:1883" but I have also tried "mqtt://127.0.0.1". Any help would be appreciated. Thanks.

@hobbyquaker
Copy link
Owner

Please start homekit2mqtt with the -v debug option and paste your command line and the log output here.

@jelimoore
Copy link
Author

jelimoore commented Oct 21, 2016

jelimoore@Misc:~$ homekit2mqtt -v debug -m /usr/lib/node_modules/homekit2mqtt/homekit2mqtt.json -u "tcp://127.0.0.1:1883"
2016-10-21 09:07:12.468 <info> homekit2mqtt 0.4.7 starting
2016-10-21 09:07:12.682 <info> loading HomeKit to MQTT mapping file /usr/lib/node_modules/homekit2mqtt/homekit2mqtt.json
2016-10-21 09:07:12.683 <info> mqtt trying to connect tcp://127.0.0.1:1883
2016-10-21 09:07:12.698 <info> using hap-nodejs version 0.4.11
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs>
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister>
2016-10-21 09:07:12.857 <debug> addBridgedAccessory Lightbulb Licht Garten
2016-10-21 09:07:12.861 <debug> mqtt subscribe Lightbulb1/status
2016-10-21 09:07:12.864 <debug> addBridgedAccessory Lightbulb Lightbulb2
2016-10-21 09:07:12.865 <debug> mqtt subscribe Lightbulb2/status
2016-10-21 09:07:12.865 <debug> mqtt subscribe Lightbulb2/status/Brightness
2016-10-21 09:07:12.866 <debug> addBridgedAccessory Lightbulb Lightbulb3
2016-10-21 09:07:12.867 <debug> mqtt subscribe Lightbulb3/status
2016-10-21 09:07:12.867 <debug> mqtt subscribe Lightbulb3/status/Brightness
2016-10-21 09:07:12.867 <debug> mqtt subscribe Lightbulb3/status/Hue
2016-10-21 09:07:12.868 <debug> mqtt subscribe Lightbulb3/status/Saturation
2016-10-21 09:07:12.868 <debug> addBridgedAccessory Switch Steckdose Fernseher
2016-10-21 09:07:12.869 <debug> mqtt subscribe Switch/status

And when I change a value:

2016-10-21 09:08:25.064 <debug> < hap set Steckdose Fernseher On 0
2016-10-21 09:08:25.064 <debug> > mqtt Switch/set 0

@hobbyquaker
Copy link
Owner

hmm strange. and you double checked that your broker is really listening on loopback and port 1883? Can you do a test with telnet 127.0.0.1 1883 and see if this gets a connection? Must admit that I have no clue whats going wrong atm...

@jelimoore
Copy link
Author

jelimoore@Misc:~$ telnet localhost 1883
Trying ::1...
Connected to localhost.
Escape character is '^]'.

@hobbyquaker
Copy link
Owner

this shows a successful connect via IPv6 Loopback (::1). Did you also test telnet 127.0.0.1 1883 (IPv4)?

@jelimoore
Copy link
Author

Yes. Same thing.

@hobbyquaker
Copy link
Owner

hobbyquaker commented Oct 21, 2016

hmmhmm. That's really strange, I have no idea why it doesn't connect to the MQTT broker. Perhaps it's worth a try to use the IP of an external interface with the -u option. Otherwise I guess we would have to check with tcpdump what's happening while the connection attempt tcpdump -i lo -q '(tcp port 1883)' -x

@jelimoore
Copy link
Author

jelimoore commented Oct 21, 2016

I set the homekit MQTT to external IP. Didn't work. Turned on tcpdump on eth0, only came up with MQTT data exchanged between my test device and the server. No server-server communication was shown. Homekit bridge was set to external interface too.

@jelimoore
Copy link
Author

Jelimoore@Misc:~$ telnet 127.0.0.1 1883
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

On Oct 21, 2016, at 10:06 AM, Sebastian Raff notifications@github.com wrote:

hmm strange. and you double checked that your broker is really listening on loopback and port 1883? Can you do a test with telnet 127.0.0.1 1883 and see if this gets a connection? Must admit that I have no clue whats going wrong atm...


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@hobbyquaker
Copy link
Owner

I still must admit - I have no clue why it doesn't connect to the broker. I guess my next try would be to create a simple javascript that requires the mqtt.js module and does nothing more then calling connect and console.log on connect error and close event to track down if this is a general or a homekit2mqtt related issue. I never had any problems with mqtt.js connecting to the broker...

@hobbyquaker
Copy link
Owner

feel free to reopen if you want further assistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants