marcoraddatz / homebridge-docker

Dockerized Homebridge. No plugins pre-defined, hassle-free setup. Read instructions!
Apache License 2.0
127 stars 47 forks source link

Can't connect to Homebridge #7

Closed jerrys1010 closed 6 years ago

jerrys1010 commented 7 years ago

Hello,

I have been trying to the last few days to get your latest Homebridge image 2.1 running within Docker on my Synology 1512+ running latest DSM 6.0.2-8451 Update 9.

I can't connect to homebridge although I get no errors building the container. I do get the final message that homebridge is running and to scan this code on your IOS device.

It will not show up in the IOS home app so I downloaded a bonjour browser and don't see the advertisement, so I assume something on the synology is preventing it. I walked through your instructions and made sure to tick off use same network as docker host. I have Synology VPN off, I turned off IPv6 on synology IP interface as I read this could cause issues. The only warning messages I see in the log are the "the program 'node.js' uses the Apple Bonjour... " messages which I have read are ok.

I did get homebridge working on my windows machine in Hyper-V and Ubunto so as to rule out my network being the cause. Is there anywhere else I can look for clues as to why its not broadcasting what its supposed to?

any thoughts are welcome

My configs are very simple just trying to control my garage door for now.

install.sh:

npm install -g git+https://github.com/luisiam/homebridge-liftmaster2.git

config.json:

{ "bridge": { "name": "Homebridge_OnSynology", "username": "CC:22:33:11:EE:39", "port": "51826", "pin": "121-34-999" },

"description": "Homebridge On Synology",

"platforms": [

{
"platform": "LiftMaster2",
"name": "Chamberlin MyQ",
"username": "xxx@gmail.com",
"password": "xxxxxx",
"openDuration": 20,
"closeDuration": 25,
"polling": true,
"longPoll": 300,
"shortPoll": 5,
"shortPollDuration": 120
}

] }

marcoraddatz commented 7 years ago

Hi,

where does this username come from? What happens, if you use CC:22:3D:E3:CE:31?

jerrys1010 commented 7 years ago

I changed the username to what you have specified and recreated the container - still this same issue.
I was changing the username along with deleting what is in the persist and accessories folders when trying to get this to work as I read this causes connections issues . Enclosed is a pic of the bonjour list from my synlogy. Used an IOS app called flame to get this. Expecting I would see a _hap_tcp entry. img_7666

deadbone commented 7 years ago

hi, something to try : Change pin code AND username in config file delete your home in the home app (but keep in mind that you'll need to recreate it after if you have another devices compatible with homekit

retry

if nothing, use the free app Eve to discover home bridge (this app is far better than the native app)

hope it helps

deadbone commented 7 years ago

by the way, no firewall on your NAS ?

sephrioth commented 7 years ago

same issue here, no clue at all. Looks synology didn't get any pair request from iOS. Tried re-install home/homebridge, reboot home/homebridge, change username & pin, remove accessories & persist folder, log out iCloud ...etc

jerrys1010 commented 7 years ago

I found a solution somewhere stating that you need to shut off the Synology Bonjour Service. Once I did that it worked like a champ.

sephrioth commented 7 years ago

Will give a try later, Synology Bonjour Service occupied 5353 port, is this the problem?

sephrioth commented 7 years ago

@jerrys1010 It works like a charm, thanks!... so is it possible to use both?

marcoraddatz commented 7 years ago

I removed port 5353 settings some time ago and re-added them, because I had some connection issues when accessing Homebridge from outside the wifi network. @sephrioth Does this work for you?

sephrioth commented 7 years ago

@marcoraddatz Once i turned off synology bonjour discovery service, then it connected. But i am wondering is it possible to use bonjour & homebridge at the same time?

marcoraddatz commented 7 years ago

I use them parallely all the time — that's also the reason I couldn't debug this issue.

sephrioth commented 7 years ago

Ok then.. just weird. If i start bonjour first, homebridge won't connect to iOS; or i start homebridge first, my DSM is undiscoverable...

sephrioth commented 7 years ago

Found two interest posts here, helpful? https://github.com/nfarina/homebridge/issues/607 https://github.com/olivierguerriat/hassio-addons/pull/4

marcoraddatz commented 7 years ago

I just disabled IPv6. Does the develop branch fixes the connection?

sephrioth commented 7 years ago

Just remotely installed, but can't test outside... then i ssh to DSM, here is some output. (i have disabled ipv6 in DSM)

ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:FE:A3:96:B8
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::1/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:11:32:6F:B2:16
          inet addr:192.168.199.78  Bcast:192.168.199.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:90469 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39540 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:69716785 (66.4 MiB)  TX bytes:10545682 (10.0 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:12609 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12609 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3002940 (2.8 MiB)  TX bytes:3002940 (2.8 MiB)
netstat -na | grep 51826
tcp6       0      0 :::51826                :::*                    LISTEN
sephrioth commented 7 years ago

looks we can't just disable ipv6 in docker? https://github.com/moby/moby/issues/20569 https://forum.synology.com/enu/viewtopic.php?t=133443

jonathonwalz commented 7 years ago

I don't use Synology so I'm not sure if this is any help, but based on the README the recommended setup is using the docker host's network. If you configure the homebridge container to be a bridge network (so it get's it's own ip) that would theoretically remove the port conflict.

sephrioth commented 7 years ago

@jonathonwalz Tried, but failed... i am not sure if my network-config right.

sephrioth commented 7 years ago

@marcoraddatz another post related? https://github.com/nfarina/homebridge/issues/1277

MAM78 commented 6 years ago

Hello,

Do you have found a solution to this problem ?

MAM78 commented 6 years ago

I need the Bonjour services on my MAC to access the Synology NAS and my Time Machine backup

sephrioth commented 6 years ago

No.. i run my homebridge on a pi at last...

marcoraddatz commented 6 years ago

@sephrioth @MAM78 Have you made sure, your host system is only running with IPv4? For the PI, there might be a solution: https://github.com/nfarina/homebridge/issues/607#issuecomment-210268844

tenkeyless commented 6 years ago

This problem is occur because Synology’s Docker doesn’t support the --net-host command from the GUI. If you possible, access your synology via ssh, then execute next command with port, then you can use homebridge.

docker run -d --name HomeBridge --restart=always --net=host -p 51826:51826 -v /volume1/docker/homebridge:/root/.homebridge marcoraddatz/homebridge:latest

https://www.marcoraddatz.com/en/2016/07/13/run-homebridge-on-a-synology/

sylarevan commented 6 years ago

Well, I just had the same issue: after DSM + Docker updates on my Synology NAS, my iDevices do not see homebridge devices anymore. It appears that it is related to my Bonjour setting, which was ON previously since I use my NAS as a disk for Time Machine on my Mac. But both Bonjour and homebridge were working fine so far!

Since the update, it seems I really have to turn Bonjour entirely off to make homebridge work again. But I really can't, I have to use Time Machine to backup my data (I've double checked, turning Bonjour off makes my backup disk unavailable to Time Machine).

So what has been changed recently? Is it a DSM/Docker issue, an homebridge issue? FYI I'm using Docker package v17.05.0-0349 with DSM 6.1.4-15217 Update 1.

yubiao commented 6 years ago

@sylarevan Try changing your homebridge port in the config.json file and delete persist folder and add your device again see if it works.

sylarevan commented 6 years ago

@yubiao No success so far, with an all fresh homebridge installation (new container, all folders deleted, etc.). I've also changed homebridge port from 51825 to 51830 in the config.json file. Again, if I turn Bonjour off in DSM settings, homebridge devices show up immediately.

If I turn Bonjour on again, homebridge still works fine ... but Time Machine not. I have to turn homebridge off to get back a working Time Machine backup.

My obvious conclusion is that there is now a conflict between the Bonjour service in DSM and homebridge. I never had this issue before the combo update (DMS+Docker+this container in v4.0).

My config.json file is the following, if it can help:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:21:3E:E4:DE:33",
        "port": 51830,
        "pin": "012-34-567"
    },

    "description": "My configuration file",

    "platforms": [
        {
            "platform": "eDomoticz",
            "name": "eDomoticz",
            "server": "user:password@192.168.1.2",
            "port": "8084",
            "ssl": 0,
            "roomid": 2,
            "mqtt": 1
        },
        {
            "platform": "Camera-ffmpeg",
            "cameras": [
            {
                "name": "Garage",
                "videoConfig": {
                    "source": "-re -i rtsp://user:password@ipgarage.home/play1.sdp",
                    "stillImageSource": "-i http://user:password@192.168.1.10/image/jpeg.cgi",
                    "maxStreams": 2,
                    "maxWidth": 640,
                    "maxHeight": 480,
                    "maxFPS": 10
                }
            },{
                "name": "Cuisine",
                "videoConfig": {
                    "source": "-re -i rtsp://user:password@ipcuisine.home:88/videoSub",
                    "stillImageSource": "-i http://192.168.1.11:88/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=user&pwd=password",
                    "maxStreams": 2,
                    "maxWidth": 640,
                    "maxHeight": 480,
                    "maxFPS": 10
                }
            }
            ]
        }
    ],

    "accessories": [

    ]
}
yubiao commented 6 years ago

My setting is using port 51827, DSM and docker up to date, docker running 17.05.0-0349. Bonjour only enable for SMB. I also have an Apple TV running as a hub.

sylarevan commented 6 years ago

Still not working for me, as long as Bonjour is enabled in the settings: bonjour

Again, if I turn off Bonjour, homebridge works perfectly fine.

My setup :

I'm quite sure this is related to DSM and/or Docker last updates, since v3.1 of this image was working fine before these updates, and I'm no longer able to make it work now.

So far, I'm not able to use homebridge anymore...

smoochy commented 6 years ago

Hi, I am stuck with the same issue. As long as Bonjour is activated on the DSM (I need to have this to be able to use TimeMachine Backup on my DS), before the docker image has been started, Homekit devices are not responding anymore. The docker image starts normally, with no error message (at least from what I can see in the protocol details of the docker image). I need to shutdown the docker image, disable Bonjour in DSM, start the docker image. Homekit devices are working fine. Afterwards I can activate Bonjour again and it keeps working. But as soon as the Docker image is restarted, it stops working and I need to repeat the process.

DS415+, DSM 6.1.4-15217 Update 2, Docker 17.05..0-0349, Homebridge Container 4.0

I updated homebridge to version 0.4.33 within the docker image (was 0.4.27), but issue is still the same

I am not running any firewall on the DSM.

Is this something which can be addressed by you, @marcoraddatz , or the homebridge creator, or does Docker and/or Synology needs to get active?

Cheers

sylarevan commented 6 years ago

Hi all,

FYI, I am now using oznu/docker-homebridge image on my Diskstation. While I had initially the same kind of strange behavior with Bonjour and this image, everything is now working well since the developer added a "patch" regarding avahi and some DSM_HOSTNAME variable. Maybe this could help in finding a solution to this bug with @marcoraddatz image.

marcoraddatz commented 6 years ago

@sylarevan Will have a look at that. Thanks for the info!

moellerherm commented 6 years ago

Hi @marcoraddatz, do you have any news on @sylarevan advice? I do have the same problem regarding bonjour and would be more than happy to get a solution.....

marcoraddatz commented 6 years ago

I implemented his solution, but unfortunately I cannot test it — simply because I don't have any problems with Homebridge, so I must rely on feedback. Docs haven't been updated yet. All changes have been pushed to the develop branch and should be available soon.

A sample is in the .env file. Uncomment and set the DiskStation hostname (DS_HOSTNAME) exactly like you did under "Synology DSM Control Panel" -> "Info Centre" -> "Server name".

Sweetgenius19 commented 6 years ago

I tried v4.2 with Bonjour running and it would not show up in HomeKit. I then added the DS_HOSTNAME= variable to the .env file and it is now showing up in HomeKit with Bonjour running!

I then commented out the DS_HOSTNAME line in the .env file and restarted the container. It still shows up with Bonjour running. Not sure if that is correct.

pagocs commented 6 years ago

I can confirm, the devel version is solved the bonjour issue.

sephrioth commented 6 years ago

Confirmed too. Bonjour works great in dev!

smoochy commented 6 years ago

I can confirm the Bonjour issue with the develop version being fixed.

I had to delete the container, deleted the image, redownloaded the development image and recreated the container. Created an .env file with only hostname and timezone variables set. Enabled the Bonjour service again and then launched the container.

BAM! Working!

Thank you very much Marco!

marcoraddatz commented 6 years ago

Glad to hear that! Will push it to the master soon.

comtronicgmbh commented 6 years ago

Running into the same problem on my Synology DS1515+. As soon as I turn off Apple Bonjour, it works like a charm. Unfortunately I'm not familiar with that .env file setup. Can anybody help me out here ? How does that file have to be named exactly and where do I have to place it on my NAS ? I found the content for it on the web (see attachement) pasted it in notepad++ and named the file homebridge.env. Then I placed it in the hombridge subdirectory under the docker folder in my NAS but It seems not to work. homebridge.txt Every hint is greatly appreciated ;-)

pagocs commented 6 years ago

If I understand your question correctly you can use the Synology docker UI to add the necessary environment settings. Select your HB container then Edit (must be in stopped state) then select the Environment tab and add the variable (name and value).

marcoraddatz commented 6 years ago

Must be next to the config.json and not being renamed (.env). Just saw, that I didn't update the readme with the DS_HOSTNAME.

https://github.com/marcoraddatz/homebridge-docker#plugin-development https://github.com/marcoraddatz/homebridge-docker/blob/develop/samples/.env

comtronicgmbh commented 6 years ago

omg..... It's that easy ??? Thanks a lot pagocs. Just went to the tab in my synology docker and entered the two variables (HOMEBRIDGE_TIMEZONE=Europe/Zurich) and (DS_HOSTNAME=CubeStation) as the name of my DS1515+. Now I turned on bonjour and everything seems to be working even with bonjour on ;-) Thank you very much for your kind help.