Hi,
I have run out of ideas and places to search, so I'm hoping someone may have an idea on what to try with regards to the following:
I have migrated my system to a Raspberry Pi 4 from a 3 and are now facing issues with my node-re-contrib-homekit+bridged nodes. All the items (openhab home automation) I expose to homekit via node red keeps dropping of from the native homekit app when I move from one mesh router to the other. I have google Wifi (mesh - 3 pucks) in my home and the homekit app and automations made in node-red function perfectly when my phone is connected to the same google access point as the raspberry. But when I move to another access point homekit nodes go "no response" immediately when I see my phone jumping from the "office" puck the "kitchen" one for example. I am thinking it is some kind of mDNS issue, but I am honestly not skilled enough to figure out how to troubleshoot it?
Things to note:
Native homekit things like door sensors work fine - all the time.
An Apple TV is the homekit hub.
I realize there is an mDNS config in the homekit-bridged setup, but I don't know what goes where?
If you get the "no response", it is most likely due to the home-kit-hub not actually being the hub. It looks like it works, but in reality it doesn't. I gave up on these homekit-bridged nodes for the same reason. Every time you change something in your network (or even restart NR), these nodes will not communicate properly with the hub.
What could help in the short term: rename your "Home" on your i-device, logout the ATV, reboot the i-device login the ATV, and with fingers crossed, it works again. For longer term I would recommend homebridge-mqtt, it might be little more convoluted to setup, but is extremely robust and have not failed me since the first setup. Whatever I restart/change in my network, this keeps working.
Adding the accessories can be easily done using node-red. I defined an object with all my accessories and used a function-node to add all them with one click.
Thanks for your quick answers.
I just thought the problem was a mDNS thing, since it keeps working when connected to the same google wifi puck that the raspberry is on, and only fails when I am automatically switched to another one. When moving back to the first wifi puck, accessories in homekit comes back online automatically.
I have however seen many say the same about Homebridge-mqtt as you. Looked into it a while back and thought it sounded like it was complicated to set up and to figure out where to start:-) But I think I will have a look at it again!
So I am fighting a little with getting homeberidge to start...I have checked my config.json in the validator and in visual studio where it seems fine, but I keep getting the error in the log...
3:42:02 openhab homebridge[23046]: at Module.load (internal/modules/cjs/loader.js:653:32)
Nov 07 13:42:02 openhab homebridge[23046]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Nov 07 13:42:02 openhab systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Nov 07 13:42:02 openhab systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 07 13:42:05 openhab systemd[1]: homebridge.service: Service RestartSec=3s expired, scheduling restart.
Nov 07 13:42:05 openhab systemd[1]: homebridge.service: Scheduled restart job, restart counter is at 29.
Nov 07 13:42:05 openhab systemd[1]: Stopped Homebridge.
Nov 07 13:42:05 openhab systemd[1]: Started Homebridge.
Nov 07 13:42:06 openhab homebridge[23080]: [11/7/2019, 1:42:06 PM] There was a problem reading your config.json file.
Nov 07 13:42:06 openhab homebridge[23080]: [11/7/2019, 1:42:06 PM] Please try pasting your config.json file here to validate it: http://jsonlint.com
Nov 07 13:42:06 openhab homebridge[23080]: [11/7/2019, 1:42:06 PM]
Nov 07 13:42:06 openhab homebridge[23080]: /usr/lib/node_modules/homebridge/lib/server.js:218
Nov 07 13:42:06 openhab homebridge[23080]: throw err;
Nov 07 13:42:06 openhab homebridge[23080]: ^
Nov 07 13:42:06 openhab homebridge[23080]: Error: EACCES: permission denied, open '/var/lib/homebridge/config.json'
Nov 07 13:42:06 openhab homebridge[23080]: at Object.openSync (fs.js:443:3)
Nov 07 13:42:06 openhab homebridge[23080]: at Object.readFileSync (fs.js:343:35)
Nov 07 13:42:06 openhab homebridge[23080]: at Server._loadConfig (/usr/lib/node_modules/homebridge/lib/server.js:212:28)
Nov 07 13:42:06 openhab homebridge[23080]: at new Server (/usr/lib/node_modules/homebridge/lib/server.js:56:38)
Nov 07 13:42:06 openhab homebridge[23080]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:32:16)
Nov 07 13:42:06 openhab homebridge[23080]: at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
Nov 07 13:42:06 openhab homebridge[23080]: at Module._compile (internal/modules/cjs/loader.js:778:30)
Nov 07 13:42:06 openhab homebridge[23080]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
Nov 07 13:42:06 openhab homebridge[23080]: at Module.load (internal/modules/cjs/loader.js:653:32)
Nov 07 13:42:06 openhab homebridge[23080]: at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Nov 07 13:42:06 openhab systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Nov 07 13:42:06 openhab systemd[1]: homebridge.service: Failed with result 'exit-code'.
^C
[13:42:08] openhabian@openhab:/var/lib/homebridge$ ls
accessories config.json persist
[13:42:18] openhabian@openhab:/var/lib/homebridge$
Nov 07 13:51:45 openhab homebridge[26925]: [11/7/2019, 1:51:45 PM] Loaded config.json with 0 accessories and 0 platforms.
Nov 07 13:51:45 openhab homebridge[26925]: [11/7/2019, 1:51:45 PM] ---
Nov 07 13:51:46 openhab homebridge[26925]: [11/7/2019, 1:51:46 PM] Loaded plugin: homebridge-mqtt
Nov 07 13:51:46 openhab homebridge[26925]: homebridge API version: 2.4
Nov 07 13:51:46 openhab homebridge[26925]: [11/7/2019, 1:51:46 PM] Registering platform 'homebridge-mqtt.mqtt'
Nov 07 13:51:46 openhab homebridge[26925]: [11/7/2019, 1:51:46 PM] ---
Nov 07 13:51:46 openhab homebridge[26925]: Load homebridge-mqtt.mqtt
Nov 07 13:51:46 openhab homebridge[26925]: [11/7/2019, 1:51:46 PM] [homebridge-mqtt.mqtt] config undefined in '/var/lib/homebridge', irrelevant by multiple homebridge instances.
Nov 07 13:51:46 openhab homebridge[26925]: Setup Payload:
Nov 07 13:51:46 openhab homebridge[26925]: X-HM://0023ISZJ6LEMD
Nov 07 13:51:46 openhab homebridge[26925]: Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]: โโโโโโโโโโโโโโ
Nov 07 13:51:46 openhab homebridge[26925]: โ 031-45-954 โ
Nov 07 13:51:46 openhab homebridge[26925]: โโโโโโโโโโโโโโ
Nov 07 13:51:46 openhab homebridge[26925]:
Nov 07 13:51:46 openhab homebridge[26925]: [11/7/2019, 1:51:46 PM] Homebridge is running on port 51827.
Seems to run now and I can pair with it in homekit.
I got mosquitto MQTT running on localhost, but it still seems to complain about this:
[homebridge-mqtt.mqtt] config undefined in '/var/lib/homebridge', irrelevant by multiple homebridge instances.
Don't know if it matters...but I got the example running in node-red looking like this:
and I can inject commands to the MQTT topics. Is it correctly understood that my "add office lamp" node with this payload
{"name":"office_lamp","service":"Switch"}
Should then be adequate to have that lamp appear in homekit? I am asking because it doesn't:-) Or must it also be defined in the config.json somehow?
Sorry for possible misunderstandings - I am trying to wrap my head around this:-)
I see, I'd use .homebridge (this is also the folder I use)
It seems that var/lib/homebridge is only used for the Systemd Service.
Edit:
*NOTE: Your config.json file MUST be inside of .homebridge, which is inside of your home folder. On macOS and Linux, the full path for your config.json would be ~/.homebridge/config.json. Any error messages will contain the exact path where your config is expected to be found.*
Ok - just tried that.
It does however seems to be looking in /var/lib/homebridge for the file.
Nov 07 15:21:56 openhab homebridge[28662]: [11/7/2019, 3:21:56 PM] config.json (/var/lib/homebridge/config.json) not found.
Nov 07 15:21:57 openhab homebridge[28662]: [11/7/2019, 3:21:57 PM] Loaded plugin: homebridge-mqtt
Nov 07 15:21:57 openhab homebridge[28662]: homebridge API version: 2.4
Nov 07 15:21:57 openhab homebridge[28662]: [11/7/2019, 3:21:57 PM] Registering platform 'homebridge-mqtt.mqtt'
Nov 07 15:21:57 openhab homebridge[28662]: [11/7/2019, 3:21:57 PM] ---
Nov 07 15:21:57 openhab homebridge[28662]: Load homebridge-mqtt.mqtt
Nov 07 15:21:57 openhab homebridge[28662]: [11/7/2019, 3:21:57 PM] [homebridge-mqtt.mqtt] config undefined in '/var/lib/homebridge', irrelevant by multiple homebridge instances.
Nov 07 15:21:57 openhab homebridge[28662]: Setup Payload:
Nov 07 15:21:57 openhab homebridge[28662]: X-HM://0023ISYWYLEMD
Nov 07 15:21:57 openhab homebridge[28662]: Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]: โโโโโโโโโโโโโโ
Nov 07 15:21:57 openhab homebridge[28662]: โ 031-45-154 โ
Nov 07 15:21:57 openhab homebridge[28662]: โโโโโโโโโโโโโโ
Nov 07 15:21:57 openhab homebridge[28662]:
Nov 07 15:21:57 openhab homebridge[28662]: [11/7/2019, 3:21:57 PM] Homebridge is running on port 43735.
^C
Can you confirm that the rest of the configuration is done within node-red and not in the config.json?
I already tried adding a lamp (as per your example) and it shows in the log, but not within the homekit app...?
I have been using Homebridge-MQTT for years but I am wondering about this. As I understand it you canโt create a mega message to add all devices directly? What is the gist of your function node?
So much good info here:-)
I have got homebridge/MQTT running flawlessly now with 40-50 items for a few weeks with great stability.
Got one thing I can't figure out - maybe you guys have an idea...
I have a few "real" Apple HomeKit items as well that I would like use in the flows. Is that in some way possible?
Specifically I have a door sensor and a temp sensor, whose data I would like to get into homebridge and then send out via homebridge/from/# topic . In my case it is sent to OpenHab, but I guess that's irrelevant.