ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
899 stars 91 forks source link

Multiple host configuration #45

Closed pponce closed 7 years ago

pponce commented 7 years ago

I'm attempting to connect multiple bridges using Homebridge-hue. One is an HA-Bridge https://github.com/bwssytems/ha-bridge This emulates a hue bridge and exposes among other things harmony hub activities to homekit as "lights". The other bridge is a real hue bridge 2.0.

The problem is that HA-Bridge does not identify itself to the meethue portal. This means i need to specify the host parameter. But since i have two bridges i'd then need to specify two hosts. This would avoid the need for a second instance of homebridge to be used. I'm sure that perhaps others with multiple real bridges might find it useful to just specify the host ip's as well.

pponce commented 7 years ago

here is my -D output when trying to get HA-bridge working. I created a second user and ran a second instance of homebrige with only the hue plugin configured.

-D ourput WARNING The program 'node' 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=node WARNING The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of $ 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=node&f=DNSServiceRegister [1/13/2017, 12:52:38 PM] Loaded plugin: homebridge-bigAssFans [1/13/2017, 12:52:38 PM] Registering platform 'homebridge-bigAssFans.BigAssFans' [1/13/2017, 12:52:38 PM] Registering accessory 'homebridge-bigAssFan.BigAssFan' [1/13/2017, 12:52:38 PM] --- [1/13/2017, 12:52:38 PM] Loaded plugin: homebridge-gpio-wpi [1/13/2017, 12:52:38 PM] Registering accessory 'homebridge-gpio-wpi.GPIO' [1/13/2017, 12:52:38 PM] --- [1/13/2017, 12:52:39 PM] Loaded plugin: homebridge-hue [1/13/2017, 12:52:39 PM] Registering platform 'homebridge-hue.Hue' [1/13/2017, 12:52:39 PM] --- [1/13/2017, 12:52:39 PM] Loaded plugin: homebridge-liftmaster2 [1/13/2017, 12:52:39 PM] Registering platform 'homebridge-liftmaster2.LiftMaster2' [1/13/2017, 12:52:39 PM] --- [1/13/2017, 12:52:40 PM] Loaded plugin: homebridge-lockitron [1/13/2017, 12:52:40 PM] Registering accessory 'homebridge-lockitron.Lockitron' [1/13/2017, 12:52:40 PM] --- [1/13/2017, 12:52:40 PM] Loaded plugin: homebridge-mpower [1/13/2017, 12:52:40 PM] Registering platform 'homebridge-mpower.mPower' [1/13/2017, 12:52:40 PM] --- [1/13/2017, 12:52:41 PM] Loaded plugin: homebridge-nest [1/13/2017, 12:52:41 PM] Registering platform 'homebridge-nest.Nest' [1/13/2017, 12:52:41 PM] --- [1/13/2017, 12:52:41 PM] Loaded plugin: homebridge-script [1/13/2017, 12:52:41 PM] Registering accessory 'homebridge-script.Script' [1/13/2017, 12:52:41 PM] --- [1/13/2017, 12:52:41 PM] Loaded config.json with 0 accessories and 1 platforms. [1/13/2017, 12:52:41 PM] --- [1/13/2017, 12:52:41 PM] Loading 1 platforms... [1/13/2017, 12:52:41 PM] [Philips Hue 2] Initializing Hue platform... [1/13/2017, 12:52:41 PM] [Philips Hue 2] homebridge-hue v0.1.9, node v6.9.1, homebridge v2.1 [1/13/2017, 12:52:41 PM] [Philips Hue 2] probing bridge at 192.168.1.99 [1/13/2017, 12:52:41 PM] [Philips Hue 2] 192.168.1.99: hue bridge request #1: get /config [1/13/2017, 12:52:41 PM] Loading 0 accessories... Load homebridge-bigAssFans.BigAssFans Load homebridge-liftmaster2.LiftMaster2 [1/13/2017, 12:52:41 PM] [homebridge-liftmaster2.LiftMaster2] Please setup MyQ login information! (node:9045) DeprecationWarning: sys is deprecated. Use util instead. [1/13/2017, 12:52:41 PM] [Philips Hue 2] 192.168.1.99: hue bridge request #1: ok [1/13/2017, 12:52:41 PM] [Philips Hue 2] Philips hue: BSB002 bridge, api v1.15.0 [1/13/2017, 12:52:41 PM] [Philips Hue 2] Philips hue: hue bridge request #2: get / [1/13/2017, 12:52:42 PM] [Philips Hue 2] Philips hue: hue bridge request #2: get / [1/13/2017, 12:52:42 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:52:42 PM] [Philips Hue 2] Philips hue: 1 accessories [1/13/2017, 12:52:42 PM] [Philips Hue 2] Initializing platform accessory 'Philips hue'... Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

┌────────────┐
│ XXX-XX-XXX │
└────────────┘

[1/13/2017, 12:52:42 PM] Homebridge is running on port 51827. [1/13/2017, 12:52:43 PM] [Philips Hue 2] Philips hue: hue bridge request #3: get / [1/13/2017, 12:52:43 PM] [Philips Hue 2] Philips hue: hue bridge request #3: get / [1/13/2017, 12:52:43 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:52:48 PM] [Philips Hue 2] Philips hue: hue bridge request #4: get / [1/13/2017, 12:52:48 PM] [Philips Hue 2] Philips hue: hue bridge request #4: get / [1/13/2017, 12:38:22 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:27 PM] [Philips Hue 2] Philips hue: hue bridge request #5: get / [1/13/2017, 12:38:27 PM] [Philips Hue 2] Philips hue: hue bridge request #5: get / [1/13/2017, 12:38:27 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:32 PM] [Philips Hue 2] Philips hue: hue bridge request #6: get / [1/13/2017, 12:38:32 PM] [Philips Hue 2] Philips hue: hue bridge request #6: get / [1/13/2017, 12:38:32 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:37 PM] [Philips Hue 2] Philips hue: hue bridge request #7: get / [1/13/2017, 12:38:37 PM] [Philips Hue 2] Philips hue: hue bridge request #7: get / [1/13/2017, 12:38:37 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:42 PM] [Philips Hue 2] Philips hue: hue bridge request #8: get / [1/13/2017, 12:38:42 PM] [Philips Hue 2] Philips hue: hue bridge request #8: get / [1/13/2017, 12:38:42 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:47 PM] [Philips Hue 2] Philips hue: hue bridge request #9: get / [1/13/2017, 12:38:47 PM] [Philips Hue 2] Philips hue: hue bridge request #9: get / [1/13/2017, 12:38:47 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:52 PM] [Philips Hue 2] Philips hue: hue bridge request #10: get / [1/13/2017, 12:38:52 PM] [Philips Hue 2] Philips hue: hue bridge request #10: get / [1/13/2017, 12:38:52 PM] [Philips Hue 2] Philips hue: hue bridge status 404 [1/13/2017, 12:38:53 PM] Got SIGINT, shutting down Homebridge...

Config.json

"bridge": { "name": "HomeKitBridge2", "username": "C2:23:3C:E3:CE:18", "port": 51827, "pin": "XXX-XX-XXX" },

"accessories": [ ],

"platforms": [ { "platform": "Hue", "name": "Philips Hue 2", "host": "192.168.1.99", "users": { "B827EBFFFE906FD2": "961f615166664b86a5803b75d0db6de0" }, "heartrate": 5, "timeout": 7, "lights": true, "philipslights": true, "ct": false, "groups": false, "group0": true, "rooms": false, "sensors": false, "clipsensors": false, "schedules": false, "rules": false } ] }

ebaauw commented 7 years ago

Here's the initial, unauthenticated GET /api/config:

[1/13/2017, 12:52:41 PM] [Philips Hue 2] probing bridge at 192.168.1.99 [1/13/2017, 12:52:41 PM] [Philips Hue 2] 192.168.1.99: hue bridge request #1: get /config

Looks like my fear that HA-Bridge wouldn't support this is ungrounded: homebridge-hue has received and understood the response (it found the bridge name, type and api version):

[1/13/2017, 12:52:41 PM] [Philips Hue 2] 192.168.1.99: hue bridge request #1: ok [1/13/2017, 12:52:41 PM] [Philips Hue 2] Philips hue: BSB002 bridge, api v1.15.0

However, when it trying the authenticated GET /api/961f615166664b86a5803b75d0db6de0/, HA-Bridge reports an HTTP status 404, which means: not found:

[1/13/2017, 12:52:42 PM] [Philips Hue 2] Philips hue: hue bridge request #2: get / [1/13/2017, 12:52:42 PM] [Philips Hue 2] Philips hue: hue bridge status 404

Note that homebridge-hue doesn't log the full path with the request, not to reveal the username in the log output. It should be GET /api/961f615166664b86a5803b75d0db6de0/ (note the username from config.json and the trailing slash).

As homebridge-hue doesn't get the bridge state, it cannot find any lights, and only exposes the accessory for the bridge:

[1/13/2017, 12:52:42 PM] [Philips Hue 2] Philips hue: 1 accessories [1/13/2017, 12:52:42 PM] [Philips Hue 2] Initializing platform accessory 'Philips hue'...

Could you try:

curl http://192.168.1.99/api/961f615166664b86a5803b75d0db6de0/

And see if that returns a 404 as well? And without the trailing slash?

ebaauw commented 7 years ago

v0.1.10 supports multiple values for host in config.json, e.g. "host": ["192.168.1.10", "192.168.1.11"].

pponce commented 7 years ago

Tried curl http://192.168.1.99/api/961f615166664b86a5803b75d0db6de0/ Also returns 404 not found

Also tested the multiple host setup. seems to be working! One potential problem is the settings per bridge. For my real bridge i want to expose only non philips lights. For my ha-bridge i probably need to expose all.

pponce commented 7 years ago

http://192.168.1.99/api/961f615166664b86a5803b75d0db6de0/ returned nothing but if i use http://192.168.1.99/api/my-homebridge/ Where my-hombridge was the username i was using when things were working with the homebridge-philipshue plugin.

i get a valid response pi@raspberrypi:/var/homebridge $ curl http://192.168.1.99/api/my-homebridge {"lights":{"1":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"Watch Xfinity TV","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:01-01","swversion":"66012040"},"2":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"Watch Apple TV","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:02-02","swversion":"66012040"},"3":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"Watch PS3","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:03-03","swversion":"66012040"},"4":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"PowerOff","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:04-04","swversion":"66012040"}},"scenes":{},"groups":{},"schedules":{},"sensors":{},"rules":{},"config":{"portalservices":false,"gateway":"192.168.1.99","mac":"B8:27:EB:C5:3A:87","swversion":"01035934","apiversion":"1.15.0","linkbutton":true,"ipaddress":"192.168.1.99","proxyport":0,"swupdate":{"updatestate":0,"checkforupdate":false,"devicetypes":{},"text":"","notify":false,"url":""},"netmask":"255.255.255.0","name":"Philips hue","dhcp":true,"UTC":"2017-01-14T01:22:00","proxyaddress":"none","localtime":"2017-01-13T17:22:00","timezone":"America/Los_Angeles","zigbeechannel":"6","modelid":"BSB002","bridgeid":"B827EBFFFEC53A87","factorynew":false,"whitelist":{"lVNcuyPdzhpbAKXCcZXw2rrFCyeyFMAGgGKnAwVG":{"lastUseDate":"2016-11-19T10:20:43","createDate":"2016-11-19T10:20:43","name":"auto insert user"},"d0211e6345504cd4be8860bffc3e6def":{"lastUseDate":"2017-01-13T17:07:09","createDate":"2017-01-13T17:07:09","name":"auto insert user"},"my-homebridge":{"lastUseDate":"2017-01-13T17:22:00","createDate":"2017-01-13T17:22:00","name":"auto insert user"}}}}

this was my config.json for when i used homebridge-philipshue { "platform": "PhilipsHue", "name": "HA-Bridgee", "ip_address": "192.168.1.99", "username": "my-homebridge" },

ebaauw commented 7 years ago

One potential problem is the settings per bridge. For my real bridge i want to expose only non philips lights. For my ha-bridge i probably need to expose all.

I didn't know this was possible until I read your other post, but in that case, you need to specify two platform objects for homebridge-hue, with different settings. I did a quick check and homebridge seems to like this, but I'm not sure if this is intentional or accidental. For all intents and purposes, the two platform entries act as if they are different plugins. homebridge instantiates two different HuePlatform objects and homebridge-hue keeps the config per HuePlatform object.

Be mindful of the 99 bridges accessories HomeKit limit (see Caveats), as homebridge-hue only checks per HuePlatform object.

but if i use http://192.168.1.99/api/my-homebridge/ [...] i get a valid response pi@raspberrypi:/var/homebridge $ curl http://192.168.1.99/api/my-homebridge

Did you try curl http://192.168.1.99/api/my-homebridge/ as well (with trailing slash /)? What happens when you use this username instead in config.json?

Note that the username you specified in config.json, 961f615166664b86a5803b75d0db6de0, isn't in the HA-Bridge whitelist (my formatting):

  "whitelist": {
    "lVNcuyPdzhpbAKXCcZXw2rrFCyeyFMAGgGKnAwVG": {
      "lastUseDate": "2016-11-19T10:20:43",
      "createDate": "2016-11-19T10:20:43",
      "name": "auto insert user"
    },
    "d0211e6345504cd4be8860bffc3e6def": {
      "lastUseDate": "2017-01-13T17:07:09",
      "createDate": "2017-01-13T17:07:09",
      "name": "auto insert user"
    },
    "my-homebridge": {
      "lastUseDate": "2017-01-13T17:22:00",
      "createDate": "2017-01-13T17:22:00",
      "name": "auto insert user"
    }
  }
pponce commented 7 years ago

just for kicks i started over and deleted the username i had for the ha-bridge. used the multiple host option and this was what homebridge returned. [1/13/2017, 6:41:13 PM] [Philips Hue 1] Philips hue: created user - please edit config.json and restart homebridge

"platforms": [ "platform": "Hue", "name": "Hue", "users": { "B827EBFFFEC53A87": "632db8d6583a4a1da8077dcb9b9f626d" } ]

however when i use curl curl http://192.168.1.99/api/632db8d6583a4a1da8077dcb9b9f626d/ i get 404 when i use http://192.168.1.99/api/632db8d6583a4a1da8077dcb9b9f626d i get a valid response curl http://192.168.1.99/api/632db8d6583a4a1da8077dcb9b9f626d {"lights":{"1":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"Watch Xfinity TV","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:01-01","swversion":"66012040"},"2":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"Watch Apple TV","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:02-02","swversion":"66012040"},"3":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"Watch PS3","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:03-03","swversion":"66012040"},"4":{"state":{"on":false,"bri":0,"hue":0,"sat":0,"effect":"none","ct":0,"alert":"none","reachable":true},"type":"Dimmable light","name":"PowerOff","modelid":"LWB004","manufacturername":"Philips","uniqueid":"00:17:88:5E:D3:04-04","swversion":"66012040"}},"scenes":{},"groups":{},"schedules":{},"sensors":{},"rules":{},"config":{"portalservices":false,"gateway":"192.168.1.99","mac":"B8:27:EB:C5:3A:87","swversion":"01035934","apiversion":"1.15.0","linkbutton":true,"ipaddress":"192.168.1.99","proxyport":0,"swupdate":{"updatestate":0,"checkforupdate":false,"devicetypes":{},"text":"","notify":false,"url":""},"netmask":"255.255.255.0","name":"Philips hue","dhcp":true,"UTC":"2017-01-14T02:43:14","proxyaddress":"none","localtime":"2017-01-13T18:43:14","timezone":"America/Los_Angeles","zigbeechannel":"6","modelid":"BSB002","bridgeid":"B827EBFFFEC53A87","factorynew":false,"whitelist":{"lVNcuyPdzhpbAKXCcZXw2rrFCyeyFMAGgGKnAwVG":{"lastUseDate":"2016-11-19T10:20:43","createDate":"2016-11-19T10:20:43","name":"auto insert user"},"d0211e6345504cd4be8860bffc3e6def":{"lastUseDate":"2017-01-13T17:07:09","createDate":"2017-01-13T17:07:09","name":"auto insert user"},"pedro-homebridge":{"lastUseDate":"2017-01-13T17:22:00","createDate":"2017-01-13T17:22:00","name":"auto insert user"},"69c7b37024f94c4b829c518da664ca32":{"lastUseDate":"2017-01-13T17:24:46","createDate":"2017-01-13T17:24:46","name":"auto insert user"},"9218061c9d0642b5b957416a92e34868":{"lastUseDate":"2017-01-13T18:06:41","createDate":"2017-01-13T18:06:41","name":"auto insert user"},"632db8d6583a4a1da8077dcb9b9f626d":{"lastUseDate":"2017-01-13T18:41:13","createDate":"2017-01-13T18:41:13","name":"auto insert user"}}}}

when i run with this user "B827EBFFFEC53A87": "632db8d6583a4a1da8077dcb9b9f626d" i get the same errors as before. [1/13/2017, 6:45:07 PM] [Philips Hue 1] Philips hue: hue bridge request #4: get / [1/13/2017, 6:45:07 PM] [Philips Hue 1] Philips hue: hue bridge http status 404 [1/13/2017, 6:45:12 PM] [Philips Hue 1] Philips hue: hue bridge request #5: get / [1/13/2017, 6:45:12 PM] [Philips Hue 1] Philips hue: hue bridge http status 404 [1/13/2017, 6:45:17 PM] [Philips Hue 1] Philips hue: hue bridge request #6: get / [1/13/2017, 6:45:17 PM] [Philips Hue 1] Philips hue: hue bridge http status 404 [1/13/2017, 6:45:22 PM] [Philips Hue 1] Philips hue: hue bridge request #7: get / [1/13/2017, 6:45:22 PM] [Philips Hue 1] Philips hue: hue bridge http status 404 [1/13/2017, 6:45:27 PM] [Philips Hue 1] Philips hue: hue bridge request #8: get / [1/13/2017, 6:45:27 PM] [Philips Hue 1] Philips hue: hue bridge http status 404

pponce commented 7 years ago

oh and same thing happens with my-homebridge as username. same results with curl. With trailing slash i get 404 without i get valid response

ebaauw commented 7 years ago

Looks like, unlike the real Hue bridge, HA-Bridge chokes on the the trailing slash / in the URI.

Could you try v0.1.12, that version should issue a GET /api/<username> without trailing slash.

Note that now the username created for homebridge-hue is in the HA-Bridge config whitelist.

pponce commented 7 years ago

nice! I now see the tv activities loading when homebridge is booting up. Somewhere along the line my homekit config with apple got corrupted though. I need to fix my config but i think everything with HA-Bridge and your plugin is working now. I set up my config to have two platform sections in config.json with different names for the bridge value. Once i get my homekit setup back up and running i'll report back to see if there are any issues.

Now i need to remember how to make homebrigde appear again when searching for the accessory from the homekit apps.

pponce commented 7 years ago

Ok confirmed i see all the harmony activities via ha bridge. Setting up two platform sections in the config is nice and makes things very flexible. I noticed that you create a philips hue accessory. any need for that? It shows up a a switch. because i have two hue bridges i see two of them. My real philips hue bridge that appears because the homekit intergration built into the official philips hue app appears also and when i click on it i can see the bridged accessories. it does not show up as a switch though. Has no designation really.

Perhaps give the option of not exposing the "philips hue" bridge?

pponce commented 7 years ago

spoke a little too soon about the harmony activities working via ha-bridge. Initially i thought all was working because i could see the activities initialize on homebridge boot. Then when i fixed my homekit issues i could also see the harmony activities appear in my homekit apps.

However when i try to actually turn on my apple tv activity i get errors. So while the activities do show up as "lights". I'm unable to turn them on or off.

Here are the relevant errors i get.

[1/14/2017, 8:26:04 PM] [Philips Hue 2] Watch Apple TV: homekit power changed from 1 to true [1/14/2017, 8:26:04 PM] [Philips Hue 2] Philips hue: hue bridge request #31: put /lights/2/state {"on":true} [1/14/2017, 8:26:04 PM] [Philips Hue 2] Philips hue: hue bridge request #31: put /lights/2/state {"on":true} [1/14/2017, 8:26:04 PM] [Philips Hue 2] Philips hue: hue bridge error 6: Should not get here, no harmony hub available [1/14/2017, 8:26:05 PM] [Philips Hue 1] Philips hue: hue bridge request #29: get / [1/14/2017, 8:26:06 PM] [Philips Hue 1] Philips hue: hue bridge request #29: ok [1/14/2017, 8:26:06 PM] [Philips Hue 2] Philips hue: hue bridge request #32: get / [1/14/2017, 8:26:06 PM] [Philips Hue 2] Philips hue: hue bridge request #32: ok [1/14/2017, 8:26:06 PM] [Philips Hue 2] Watch Apple TV: set homekit power from true to 1 [1/14/2017, 8:26:07 PM] [Philips Hue 1] Philips hue: hue bridge request #30: get / [1/14/2017, 8:26:08 PM] [Philips Hue 1] Philips hue: hue bridge request #30: ok [1/14/2017, 8:26:08 PM] Current temperature for Upstairs Thermostat is: 75 F [1/14/2017, 8:26:08 PM] [TV Back Lighting] Turning on pin #17 [1/14/2017, 8:26:08 PM] [Philips Hue 2] Watch Apple TV: homekit power changed from 1 to true [1/14/2017, 8:26:08 PM] [Philips Hue 2] Philips hue: hue bridge request #33: put /lights/2/state {"on":true} [1/14/2017, 8:26:08 PM] [Philips Hue 2] Philips hue: hue bridge request #33: put /lights/2/state {"on":true} [1/14/2017, 8:26:08 PM] [Philips Hue 2] Philips hue: hue bridge error 6: Should not get here, no harmony hub available

ebaauw commented 7 years ago

[1/14/2017, 8:26:04 PM] [Philips Hue 2] Watch Apple TV: homekit power changed from 1 to true

You're using a HomeKit app that uses values true and false for the On characteristic, like Matthias' Home app. The iOS built-in Home app and Eve use 1 and 0, as per Apple's specs, but I haven't encountered any issues because of this.

What is weird: apparently, your app allows you to turn on the "light", while it's already on. Did you try any other HomeKit apps?

[1/14/2017, 8:26:04 PM] [Philips Hue 2] Philips hue: hue bridge request #31: put /lights/2/state {"on":true} [1/14/2017, 8:26:04 PM] [Philips Hue 2] Philips hue: hue bridge error 6: Should not get here, no harmony hub available

It looks like homebridge-hue is communicating with the HA-Bridge alright, but the HA-Bridge doesn't accept the command to turn on the Watch Apple TV "light". The error number (6) and corresponding message (Should not get here, no harmony hub available) are returned by HA-Bridge. Maybe this is because the "light" is already on? Otherwise, I'm afraid I cannot help you here.

Can you control the Watch Apple TV "light" from the Hue app, when connected to the HA-Bridge?

[1/14/2017, 8:26:06 PM] [Philips Hue 2] Philips hue: hue bridge request #32: get / [1/14/2017, 8:26:06 PM] [Philips Hue 2] Philips hue: hue bridge request #32: ok [1/14/2017, 8:26:06 PM] [Philips Hue 2] Watch Apple TV: set homekit power from true to 1

On the next heartbeat, homebridge-hue reads the value from the on attribute from the HA-Bridge (which is true) and computes the corresponding HomeKit On value (1), updating the characteristic, because the previous value (true) is different. This is normal and expected behaviour, even though it looks a bit funny in the log.

[1/14/2017, 8:26:08 PM] [Philips Hue 2] Watch Apple TV: homekit power changed from 1 to true

Again, your app allows you to turn the "light" on, while it's already on.

pponce commented 7 years ago

Thanks for your support. I got things working. Once you mentioned that error 6 was a response from HA-Bridge. I took a look at HA-Bridge and reset things there. Not sure how HA_bridge stopped working but some how the activities it was exposing were no longer valid. Once I reset the activities it was exposing all is good in homekit land again!

I use a combination of the Matthias' Home app and the apple built in Home app. As for the strange multiple on triggering. Perhaps its because i was initiating a scene and then running the scene again while testing? Not sure.

But i'm good now with my multiple bridge setup (HA-bridge and Philips Hue bridge). I didn't end up using the multiple host parameter and went with the double platform config in my config.json. Had to because i needed different settings for each hub/bridge. Thanks for all your help on this. I'm still going to be troubleshooting my etimeout errors.

ebaauw commented 7 years ago

As for the strange multiple on triggering. Perhaps its because i was initiating a scene and then running the scene again while testing?

Yeah, that would try and turn the light on while it's already on.

I noticed that you create a philips hue accessory. any need for that? It shows up a a switch.

Today it only supports dumping the bridge state on Identify (see Troubleshooting in the README) and dynamically setting the heartrate (as of v0.1.8). With dynamic platform accessories (see issue #4), it will be used instead of config.json to store the username and configuration parameters per bridge.

I (...) went with the double platform config in my config.json. Had to because i needed different settings for each hub/bridge.

I appreciate that, and I'm glad that it works out for you. I still fear it's accidental rather than intentional, though. It might break when I'll be moving to dynamic platform accessories. However, one of the reasons to use these is being able to store settings persistently in the bridge accessory, dynamically settable from HomeKit, rather than statically from config.json.

pponce commented 7 years ago

Sounds like with dynamic settings configured from homekit i'd be able to go with one platform setup in config.json and change my settings for exposing only non philips hue bulbs, on or off per bridge. If so that would work out just fine. It's also not a huge deal setting up a different instance of homebridge to run.