hobbyquaker / homekit2mqtt

HomeKit to MQTT bridge 🏡📱
MIT License
349 stars 71 forks source link

Perpetual "mqtt reconnect" message #135

Closed abrownsword closed 3 years ago

abrownsword commented 5 years ago

I have my accessories talking to the mqtt broker and the homekit2mqtt bridge -- that seems to be working correctly, based on the debug output from homekit2mqtt and using an mqtt traffic monitor.

My program launches homekit2mqtt like this:

[2018-10-01 17:55:39.373] [console] [info] Launching homekit bridge: homekit2mqtt --url=mqtt://192.168.0.102:1883 --verbosity=debug --mapfile=/home/andrew/mcp/config/homekit.json --name=homekit-v0.4@wandboard --storagedir=/home/andrew/mcp/config/homekit --port=51826 --web-port=51888 --username=de:ad:be:ef:ab:ba --pincode=999-00-666 --bridgename=homekit2mqtt

Which then prints this:

2018-10-01 17:55:41.544 <info> homekit2mqtt 1.1.2 starting 2018-10-01 17:55:41.553 <info> mqtt trying to connect mqtt://127.0.0.1 2018-10-01 17:55:41.793 <info> using hap-nodejs version 0.4.47 2018-10-01 17:55:41.793 <info> using directory /home/andrew/mcp/config/homekit for persistent storage 2018-10-01 17:55:41.825 <debug> mqtt subscribe # 2018-10-01 17:55:41.913 <info> http server listening on port 51888 2018-10-01 17:55:42.096 <info> mqtt offline 2018-10-01 17:55:42.836 <debug> mqtt unsubscribe # 2018-10-01 17:55:42.845 <info> loading HomeKit to MQTT mapping file /home/andrew/mcp/config/homekit.json 2018-10-01 17:55:42.860 <debug> creating new accessory "alcove" "alcove" b19dd55f-ff22-4153-b6ca-5964f0e5bc00 2018-10-01 17:55:42.866 <debug> loading services/Lightbulb.js

A bunch of output where all the expected accessories appear to be added and subscribed to correctly, and then these lines are printed just before the QR code:

2018-10-01 17:55:43.183 <info> hap created 0 Camera Accessories and 23 Bridged Accessories. 2018-10-01 17:55:43.274 <debug> hap publishing bridge "homekit2mqtt" username=de:ad:be:ef:ab:ba port=51826 pincode=999-00-666 setupURI=X-HM://0015LUQYILN8C 2018-10-01 17:55:43.302 <debug> > mqtt homekit-v0.4@wandboard/connected 2 2018-10-01 17:55:43.304 <info> hap Bridge listening on port 51826

Right after that, however, homekit2mqtt starts printing this endlessly:

2018-10-01 17:55:43.478 <info> mqtt reconnect 2018-10-01 17:55:44.534 <info> mqtt reconnect 2018-10-01 17:55:45.797 <info> mqtt reconnect 2018-10-01 17:55:46.804 <info> mqtt reconnect . . .

While in Home.app I have added and configured all the accessories, but none of them are updating. The broker seems stable, and my accessory and mqtt traffic monitor remain connected continuously.

Any idea what I've done wrong?

abrownsword commented 5 years ago

I moved my broker to the same host as homekit2mqtt and now it seems to be staying connected and some of my services are working correctly (sensor readings). I assume the other services just require some debugging as opposed to the continual reconnect problem I was seeing.

Anyone know why cross-host connections would be a problem? My long term plan is to have broker and homekit2mqtt co-located like this, but it seems strange that this would be a problem. The other mqtt clients aren’t having any issues.

hobbyquaker commented 5 years ago

Normally it's no problem to have the MQTT broker on another host, in my setup homekit2mqtt and the broker are on different hosts too. Can you see smth in the brokers log?

abrownsword commented 5 years ago

Nothing in the broker log except that the connection closed.

On Oct 9, 2018, at 11:05 AM, Sebastian Raff notifications@github.com wrote:

Normally it's no problem to have the MQTT broker on another host, in my setup homekit2mqtt and the broker are on different hosts too. Can you see smth in the brokers log?

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

hobbyquaker commented 5 years ago

hmm... I guess i will have to implement some more debug output to see why the reconnect is happening, no clue what is going wrong there.