diyhue / diyHue

Main diyHue software repo
https://diyhue.org/
Other
1.55k stars 277 forks source link

Test with Harmony Hub #85

Closed gbrooker closed 5 years ago

gbrooker commented 5 years ago

Hi, I've tried running diyhue on macOS using docker, to test out how the Logitech Harmony Hub interacts with Hue.

I set up a virtual light following the instructions here, https://github.com/mariusmotea/diyHue/issues/20 I ran a simple server to emulate a light, and manually added the light to config.json.

diyhue was able to talk to the virtual light, but the light was not listed in the diyhue web interface. I was unable to get either the Harmony Hub, nor the Phillips Hue app to connect to diyhue.

I'm struggling on what if anything I can do to get this setup working.

Here is the extract of the virtual light setup from config.json

    "lights": {
        "1": {
            "manufacturername": "OSRAM",
            "modelid": "Plug - LIGHTIFY",
            "name": "Bedroom 4",
            "state": {
                "alert": "select",
                "bri": 0,
                "colormode": "ct",
                "ct": 153,
                "hue": 0,
                "on": true,
                "reachable": true,
                "sat": 0,
                "xy": [
                    0.0,
                    0.0
                ]
            },
            "swversion": "V1.03.21",
            "type": "On/Off plug-in unit",
            "uniqueid": "00:17:88:01:00:f:be:45-0b"
        }
    },
    "lights_address": {
        "1": {
            "ip": "10.0.8.8:81",
            "light_nr": 1,
            "mac": "xx:xx:xx:00:00:xx",
            "protocol": "native"
        }
    },
ghost commented 5 years ago

Lights won't appear in the diyHue GUI until they have been found and added by the hue app. So the first step is to get the hue app working. What happens exactly when you try to pair the hue app with diyHue?

gbrooker commented 5 years ago

The Hue app detects that there is a Hue Hub, it asks for the link button to be pressed. I select link button in the web interface, which tells me I have 30 seconds to link, and the Hue app progress bar ticks down to the end and just times out, unable to find the hub.

ghost commented 5 years ago

Ok, have you passed the Mac address and IP as environment variables when running the docker container?

gbrooker commented 5 years ago

Yes I did, though I’m not sure if I have the config.json correct for the virtual light. Do I need the correct MAC address of the local host in there too ? I just have that dummy address I listed above at the moment. What is required for the uniqueid field ?

ghost commented 5 years ago

I'm not sure what the requirements are for the uniqueid field. @marius can help with that. That being wrong shouldn't affect the hue app pairing though. Can you run this comand: curl https://127.0.0.1/api/nouser/config -v -k either from your diyHue host or a remote host and change the IP to that of your diyHue host. Post the output here.

gbrooker commented 5 years ago

I corrected the mac address for the virtual light in config.json (it is the same as the machine diyHue is running on), but still no luck. I note I only have cert.pem and config.json in the shared directory. I saw mention of a third file lights.json in one of the issues threads, I wonder if I need to create something else, or whether that was a typo.

When I search for hubs in the Hue app, I see the diyHue gets a /api/nouser/config request, after which it says it has found a hub and asks for the link button to be pressed. I hit the Activate button with the default username and password, but the Hue app sends no more requests to diyHue, and it eventually times out searching. Here is the output of the curl command, it seems that there are no lights listed, is that normal ?

$ curl https://10.0.8.8/api/nouser/config -v -k
*   Trying 10.0.8.8...
* TCP_NODELAY set
* Connected to 10.0.8.8 (10.0.8.8) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=NL; O=Philips Hue; CN=025000fffe000001
*  start date: Feb  9 07:39:32 2019 GMT
*  expire date: Feb  6 07:39:32 2029 GMT
*  issuer: C=NL; O=Philips Hue; CN=025000fffe000001
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> GET /api/nouser/config HTTP/1.1
> Host: 10.0.8.8
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx 
< Date: Sun, 10 Feb 2019 10:53:48 GMT
< Content-type: application/json
< Content-Length: 227
< 
* Connection #0 to host 10.0.8.8 left intact
{"name":"Philips hue","swversion":"1810251352","modelid":"BSB002","datastoreversion":70,"bridgeid":"A82066FFFE10F958","starterkitid":"","mac":"a8:20:66:10:f9:58","apiversion":"1.24.0","factorynew":false,"replacesbridgeid":null}
gbrooker commented 5 years ago

And here is the last section of the config file

    "config": {
        "UTC": "2019-02-09T08:28:11",
        "apiversion": "1.24.0",
        "backup": {
            "errorcode": 0,
            "status": "idle"
        },
        "bridgeid": "A82066FFFE10F958",
        "datastoreversion": "70",
        "dhcp": true,
        "factorynew": false,
        "gateway": "10.0.8.1",
        "internetservices": {
            "internet": "connected",
            "remoteaccess": "connected",
            "swupdate": "connected",
            "time": "connected"
        },
        "ipaddress": "10.0.8.8",
        "linkbutton": false,
        "localtime": "2019-02-09T08:28:11",
        "mac": "a8:20:66:10:f9:58",
        "modelid": "BSB002",
        "name": "Philips hue",
        "netmask": "255.255.255.0",
        "portalconnection": "connected",
        "portalservices": true,
        "portalstate": {
            "communication": "disconnected",
            "incoming": false,
            "outgoing": true,
            "signedon": true
        },
        "proxyaddress": "none",
        "proxyport": 0,
        "replacesbridgeid": null,
        "starterkitid": "",
        "swupdate": {
            "checkforupdate": false,
            "devicetypes": {
                "bridge": false,
                "lights": [],
                "sensors": []
            },
            "notify": true,
            "text": "",
            "updatestate": 0,
            "url": ""
        },
        "swupdate2": {
            "autoinstall": {
                "on": false,
                "updatetime": "T14:00:00"
            },
            "bridge": {
                "lastinstall": "2018-06-08T19:09:45",
                "state": "noupdates"
            },
            "checkforupdate": false,
            "lastchange": "2018-06-09T10:11:08",
            "state": "noupdates"
        },
        "swversion": "1810251352",
        "timezone": "Europe/Bucharest",
        "whitelist": {
            "a7161538be80d40b3de98dece6e91f90": {
                "create date": "2019-02-09T08:27:13",
                "last use date": "2019-02-09T08:27:13",
                "name": "Hue 3#Guy's iPhone X"
            },
            "web-ui-14171": {
                "create date": "2019-02-09T07:53:34",
                "last use date": "2019-02-09T08:28:11",
                "name": "WegGui User"
            }
        },
        "zigbeechannel": 25
    },
    "deconz": {
        "enabled": false,
        "lights": {},
        "port": 8080,
        "sensors": {}
    },
    "emulator": {
        "lights": {},
        "sensors": {}
    },
    "groups": {},
    "lights": {
        "1": {
            "manufacturername": "OSRAM",
            "modelid": "Plug - LIGHTIFY",
            "name": "Bedroom 4",
            "state": {
                "alert": "select",
                "bri": 0,
                "colormode": "ct",
                "ct": 153,
                "hue": 0,
                "on": true,
                "reachable": true,
                "sat": 0,
                "xy": [
                    0.0,
                    0.0
                ]
            },
            "swversion": "V1.03.21",
            "type": "On/Off plug-in unit",
            "uniqueid": "00:17:88:01:00:f:be:45-0b"
        }
    },
    "lights_address": {
        "1": {
            "ip": "10.0.8.8:81",
            "light_nr": 1,
            "mac": "a8:20:66:10:f9:58",
            "protocol": "native"
        }
    },
    "linkbutton": {
        "lastlinkbuttonpushed": "1549700962",
        "linkbutton_auth": "SHVlOkh1ZQ=="
    },
    "resourcelinks": {},
    "rules": {},
    "scenes": {},
    "schedules": {},
    "sensors": {
        "1": {
            "config": {
                "configured": false,
                "on": true,
                "sunriseoffset": 30,
                "sunsetoffset": -30
            },
            "manufacturername": "Philips",
            "modelid": "PHDL00",
            "name": "Daylight",
            "state": {
                "daylight": null,
                "lastupdated": "none"
            },
            "swversion": "1.0",
            "type": "Daylight"
        }
    }
ghost commented 5 years ago

There won't be any lights listed in that curl, it just tests the encryption certificate. Is a8:20:66:10:f9:58 the correct mac address for your diyHue host? If not, you will need to delete the cert.pem and restart the container to regenerate it with the correct info. Either way I recommend you delete cached data for the hue app on your phone. On android you can clear it in the android system settings. On iPhone you have to reinstall the app.

gbrooker commented 5 years ago

Yes that is the correct mac address for the diyHue host and also the virtual light (which runs on port 81).

Thank you so much. deleting the cert.pem file and deleting and re-installing the Hue app on the iPhone solved the problem with pairing. I can now control the virtual light from the Hue app and from the diyHue web interface. One step forward.

Unfortunately the Logitech Harmony Hub, which was the ultimate reason for setting this up, will not see the diyHue.

chrisdata commented 5 years ago

@gbrooker can you please share how to install diyhue on MacOS? I'm running Mojave and now I'm using Virtualbox with Ubuntu, it make my mac slow, I really want to run diyhue on native Mac terminal instead.

ghost commented 5 years ago

@gbrooker can you please share how to install diyhue on MacOS? I'm running Mojave and now I'm using Virtualbox with Ubuntu, it make my mac slow, I really want to run diyhue on native Mac terminal instead.

He is using the docker container rather than installing it directly on his mac

ghost commented 5 years ago

@gbrooker Can you enable debug (add -e "DEGUB=true" when you run the container) and post the logs when you try to pair the logitech hub? Make sure to press the virtual pair button in the webui

gbrooker commented 5 years ago

@gbrooker can you please share how to install diyhue on MacOS? I'm running Mojave and now I'm using Virtualbox with Ubuntu, it make my mac slow, I really want to run diyhue on native Mac terminal instead.

I found the easiest way was to install Docker see instructions on Ray Wenderlich then follow the instructions here to install and run the docker version.

gbrooker commented 5 years ago

@gbrooker Can you enable debug (add -e "DEGUB=true" when you run the container) and post the logs when you try to pair the logitech hub? Make sure to press the virtual pair button in the webui

Ok, I’ll give it a go when I get home at the weekend - currently travelling abroad

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 2 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically closed as it has not had any recent activity. Thank you for your contributions.