Homebridge synology setup and usage

I had home bridge plug-in for hubitat on a Pi and that seemed to work but then I moved it to a Docker on my Synology once I realized it was available there and have this issue (note that I reinstalled everything on HE when I did that).

My virtual switches show up in Homekit after I add them with the HE app.
For my August lock I have a virtual lock in HE and an automation in Homekit that changes the lock's state when Homekit sees the door locked/unlocked.

First question: Is that the right way to map a lock in HE to a Homekit lock?

Second thing is I'm getting this 'Connection refused' whenever the lock state changes in Homekit:
(app 164=homebridge device 67 is my virtual lock)

[app:164]2019-02-08 02:30:08.311 pm warnConnection refused (Connection refused)

[app:164]2019-02-08 02:30:08.285 pm debugSending DEVICE Event (Front Door Locked | LOCK: locked) to Homebridge at (192.168.7.127:8005)

[app:164]2019-02-08 02:30:08.212 pm infoCommand Successful for Device Front Door Locked | Command lock()

[dev:67]2019-02-08 02:30:08.208 pm infoFront Door Locked was locked

[app:164]2019-02-08 02:30:08.175 pm infoProcess Command | DeviceId: 67 | Command: (lock)

So the HE home bridge got the message and change the virtual lock but then failed to communicate that back to Homekit. HE is on *.127, I don't know why it's trying to send the message there. On the phone the virtual switch sits with the spinning communication icon for a long time.

I don't see anywhere to tell the HE plugin where the Homebridge server is running.

I have searched the forums but with no luck.
Thank you!
Scott

It's "a" way to do a lock.
I do virtual presence using Homekit that way, so I don't see a problem with it.

The Config file that's generated by the Homebridge App in HE is what tells Homebridge where to look for HE.
You have to copy that config into Homebridge's config.json file.

This docker image comes with a really nice Homebridge UI that lets you paste the config in:

Also lets you update right through the UI and displays the barcode for you.

Thank you. I did use that Docker instance:) I also have virtual switches for presence detection and that seems to work.

I have that in the config so the Hombridge is communicating with the HE but then the HE is responding "Sending DEVICE event" and that's where I see the Connection refused message.

1 Like

Is there a way to prove communications from the nas to Hubitat?
Does it have a ping utility?

Go to the Terminal tab in Docker (open a new session if necessary) and see what the messages are when executing a Home action from iOS.

Make sure that the Network, Environment, Timezone settings are all set correctly per the instructions at Homebridge on Synology · oznu/docker-homebridge Wiki · GitHub

I can Ping HE from the synology and the HE variables are triggering when a Homekit event occurs.
I didn't now about the Terminal window so I looked at that and looks OK. (pasting that below).

The synology/homebridge machine IS communicating with HE, it's just that the HE is trying to send a response BACK to the synology and failing. For instance the variables and rules ARE getting triggered in HE when a door-lock event occurs. The HE log indicates that failure.
On the Home app on iOS I see the Lock itself changing to locked (for instance) then the HE gets the signal that the HE vir. lock is set, then on the Home app I see the HE vir. lock say 'Locking...' and the network spinning circle shows and never goes away (or only have some long timeout).

Seems like there should be some way for the HE homebridge plugin to know the IP of the Homebridge machine (synology).

How does HE know where to send the homebridge commands?

Thanks for the help @keithcroshaw and @bill.d

Here's the paste of the synology/homebridge terminal window
[Hubitat Plugin Action] Command: lock | Value: Nothing | DeviceID: (67) | local_cmd: false
[Hubitat Plugin Action] Command: unlock | Value: Nothing | DeviceID: (67) | local_cmd: false

I just set up a virtual lock and didn't get any errors. I've got version 1.5.2 of the app on the HE and on the Docker container 0.4.46 of Hombebridge and version 1.5.6 of the homebridge-hubitat-tonesto7 plugin

So, I think that probably means there is an issue in either Synology or Docker.

A few things to try:
a) verify the dates and times are set correctly on the Synology NAS.
b) verify the DSM_HOSTNAME is set correctly in the container
c) verify the NAS directory that the container is attempting to write to is not set to read only in Docker
d) try backing up and deleting the "settings" and "persist" directories from the NAS file system. Note that this can cause you to have to delete/repair the bridge from iOS and/or cause room names to be reset.

The IP of the Homebridge server is known by HE when it gets the initial message.

Homebridge Server starts, sends a "I'm awake, what needs registering?" and HE responds with the list you've picked. HE can respond because it's replying to a message, the IP of the Homebridge server is in that message. (Source address)

[2/8/2019, 5:06:42 PM] Loaded plugin: homebridge-hubitat-tonesto7
Homebridge Version: 2.2
[2/8/2019, 5:06:42 PM] Registering platform 'homebridge-hubitat.Hubitat'
[2/8/2019, 5:06:42 PM] ---
[2/8/2019, 5:06:42 PM] Loaded plugin: homebridge-tcc
[2/8/2019, 5:06:43 PM] Registering platform 'homebridge-tcc.tcc'
[2/8/2019, 5:06:43 PM] ---
[2/8/2019, 5:06:43 PM] Loading 1 platforms...
[2/8/2019, 5:06:43 PM] [Hubitat3] Initializing Hubitat platform...
[2/8/2019, 5:06:43 PM] [Hubitat3] Fetching Hubitat devices.
[2/8/2019, 5:06:43 PM] [Hubitat3] Unknown Capabilities: ["ColorMode"]
[2/8/2019, 5:06:43 PM] [Hubitat3] Initializing platform accessory 'Yale DoorLock'...

All that "Hubitat3" is messages FROM my third Hubitat hub. Clear evidence they are communicating.

That makes sense. The HE did register the switches to the homebridge so I know it's communicating (or was). But it's not anymore. I just tried to add a new device using the HE homebridge app and it did not register in Homekit, similar error. I guess something broke along the way. Should I reinstall the HE plug-in or the homebridge plug-in? Suggestions welcome. Here's the log when I tried to add a new device:

app:1642019-02-11 07:59:04.126 pm warnConnection refused (Connection refused)

app:1642019-02-11 07:59:04.081 pm debugupdateServicePrefs: 192.168.7.127:8005

app:1642019-02-11 07:59:00.093 pm debugRegistered (5 Devices)

app:1642019-02-11 07:59:00.092 pm debugRegistering (0) Window Shades

app:1642019-02-11 07:59:00.091 pm debugRegistering (0) Lights

app:1642019-02-11 07:59:00.054 pm debugRegistering (4) Switches

app:1642019-02-11 07:58:58.062 pm debugRegistering (0) Speakers

app:1642019-02-11 07:58:58.061 pm debugRegistering (0) Sensors

app:1642019-02-11 07:58:56.050 pm debugRegistering (1) Other Devices

app:1642019-02-11 07:58:56.047 pm debugRegistering (0) Fans

app:1642019-02-11 07:58:54.008 pm debugUpdated with settings: [showLogs:true, addSecurityDevice:false, deviceList:[Front Door Locked], switchList:[HomeOccupied, HomeFirst, HomeArrival, DiningRoomPlug], noTemp:false, restartService:false]

app:1642019-02-11 07:56:37.809 pm warnConnection refused (Connection refused)

app:1642019-02-11 07:56:37.794 pm debugupdateServicePrefs: 192.168.7.127:8005

Mine looks like:

app:19 2019-02-11 05:01:14.488 pm debug Sending DEVICE Event (Office WallSwitch | SWITCH: on) to Homebridge at (192.168.37.129:8005)
app:19 2019-02-11 04:22:12.156 pm debug Sending DEVICE Event (KitchenLights | SWITCH: off) to Homebridge at (192.168.37.129:8005)
app:19 2019-02-11 04:21:54.340 pm debug activateDirectUpdates: 192.168.37.129:8005
app:19 2019-02-11 04:21:24.922 pm warn Connection refused (Connection refused)
app:19 2019-02-11 04:21:24.901 pm debug updateServicePrefs: 192.168.37.129:8005
app:19 2019-02-11 04:20:31.183 pm debug Registered (42 Devices)
app:19 2019-02-11 04:20:31.181 pm debug Registering (0) Window Shades
app:19 2019-02-11 04:20:30.982 pm debug Registering (24) Lights
app:19 2019-02-11 04:20:30.877 pm debug Registering (13) Switches
app:19 2019-02-11 04:20:28.867 pm debug Registering (0) Speakers
app:19 2019-02-11 04:20:28.866 pm debug Registering (0) Sensors
app:19 2019-02-11 04:20:26.880 pm debug Registering (1) Other Devices
app:19 2019-02-11 04:20:26.854 pm debug Registering (4) Fans
app:19 2019-02-11 04:20:24.863 pm debug attemptServiceRestart: 192.168.37.129:8005
app:19 2019-02-11 04:20:24.862 pm warnSent Request to Homebridge Service to Stop... Service should restart automatically

I got the Connection refused that time too. I believe it's because I asked it to restart:
07%20PM

I'm thinking maybe the Homebridge server isn't fully restarted at that moment, but 18 seconds later it got the Sending DEVICE event.

Ok I just figured it out, thanks for the help @csteele.
The IP on my 'sending DEVICE' message was my HE not my hubitat, which I knew but didn't know how to fix. I had requested a restart of homebridge when I update the HE plug in (like you just did) and that didn't fix it. But taking a close look I realized that the homebridge server did not restart (the Docker container doesn't respect the restart command). So I restarted it manually and it worked, the IP changed to my docker's IP.

I think the problem goes back to the HE plug in config setting:
"direct_ip": ".....",
which I had set to HE's IP, I don't know why. But when I got this error a few days ago I removed the line. I'm sure I restarted at the time but maybe there was some reason that didn't take.

Thanks again.
Hopefully this thread will help someone in the future!

The Homebridge (Hubitat) app will tell you what to put into the config.json

14%20PM
Click on that and you'll see the COMPLETE text you need to paste into the 'base' config.json

Following the instructions for Homebridge itself, before plugin's, you'll have the 'base config' similar to:

{
"bridge": {
"name": "Homebridge",
"username": "AB:AB:AB:AB:AB:AB",
"port": 51827,
"pin": "123-45-678"
},

To THAT you add what's in the Hubitat App's text. That will give you the minimum you need. No need for Direct_IP or Direct_Port because "direct" is now the default. ("now" as in: for the past year or more.)

The data on the Hubitat page is lovely to look at but is one character wrong. The 'base' portion ends with },

The next element should be the Line: "platforms": [

That means the initial { of the Plug-In Configuration Data is wrong/extra.

Use https://jsonlint.com to validate your config. It will find any punctuation that is wrong. :smiley:

If you copy paste the 'base' I inserted here into jsonlint validator, then paste in your Plug-In Configuration Data and click Validate Json, it will show line 7 is in error.. delete line 8 and then validate again, it passes. it needs that comma on line 7

But remember, my 'base' is bogus.. username and pin need to be your custom values.

1 Like

Thanks!
My solution was to remove the "Direct" entries as those were wrong, then restart the server. As I said, I tried that earlier but the restart was failing w/o me realizing it.

I use this homebridge console UI that has a restart option but the Docker container was not respecting that.

Thanks again!