ebaauw / homebridge-hue

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

Busch-Jaeger control element light and switch linked #561

Closed patrickschaper closed 4 years ago

patrickschaper commented 4 years ago

Issue

I'm using a Busch-Jaeger 4-gang control element which controls one light with button 1 and 2 and has 6 more buttons to be customised. The home app shows a dimmable Light and a switch which has no other functionality than configuring the buttons' behaviour.

Now since iOS 13 the light and wall switch are linked with one another and this brings the following issue with it. This does not address the main sensor re-coupling issue in #493 rather than decoupling lights and switches (maybe related to discussion also in the issue: https://github.com/ebaauw/homebridge-hue/issues/493#issuecomment-519131227).

In the Apple's home app:

  1. Although the name of the light is "Ceiling" the home app shows "Wall Switch", the name of the switch. The real name is only shown within the enlarged view and its settings. wondering
  2. Adding/removing any of the two to favourites will always add/remove the other too. This is particularly annoying as it spams the Favourites sheet with useless wall switches. eyes-rolling
  3. Having the light and the inevitable and useless switch in my favourites, when going to the HomeKit quick access in iOS's control center the useless wall switch is shown but the light is missing. face-palm

Log Messages

[11/19/2019, 8:53:36 PM] [Hue] Phoscon-GW: /lights/1: Dimmable light "Living Room Ceiling"
[11/19/2019, 8:53:36 PM] [Hue] Phoscon-GW: /lights/1: config: {"on":true,"bri":true,"ct":false,"xy":false,"waitTimeUpdate":20,"unknown":false}
[11/19/2019, 8:53:36 PM] [Hue] Phoscon-GW: /sensors/2: ZHASwitch "Living Room Wall Switch"
[11/19/2019, 8:53:36 PM] [Hue] Phoscon-GW: /sensors/3: ZHASwitch "Living Room Wall Switch"
[11/19/2019, 8:53:36 PM] [Hue] Phoscon-GW: /sensors/4: ZHASwitch "Living Room Wall Switch"
[11/19/2019, 8:53:36 PM] [Hue] Phoscon-GW: /sensors/5: ZHASwitch "Living Room Wall Switch"

Config

{
    "bridge": {
        "name": "Homebridge",
        "username": "AA:CC:BB:BB:CC:AA",
        "port": 51826,
        "pin": "111-11-111"
    },

    "description": "HomeKit bridge running on Raspberry Pi",

    "accessories": [
        {
            "accessory": "XiaomiRoborockVacuum",
            "name": "Eve",
            "ip": "192.168.178.76",
            "token": "123456789012345678901234567890",
            "pause": false,
            "dock":  false
        }
    ],

    "platforms": [
        {
            "platform": "Hue",
            "host": "127.0.0.1",
            "users": {
                "raspberrypi": "ASDFGHJKL"
            },
            "lights": true,
            "nativeHomeKitLights": false,
            "sensors": true,
            "nativeHomeKitSensors": false,
            "excludeSensorTypes": ["Daylight"]
        }
    ]
}

Debug Files

homebridge.log

Screenshots

IMG_A408DCFB7DA1-1

IMG_FD4891DBBFDA-1

IMG_FD061CCEAD89-1

ebaauw commented 4 years ago

The home app shows a dimmable Light and a switch which has no other functionality than configuring the buttons' behaviour.

The Home app is very confusing (even misleading) in that it doesn't distinguish correctly accessories from services, see https://github.com/ebaauw/homebridge-hue/issues/493#issuecomment-535892440. Homebridge-hue exposes a single accessory, with a Lightbulb service (for the light resource) and a Stateless Programmable Switch service (combining the four ZHASwitch resources). Indeed, in HomeKit the only function of a stateless switch is to assign actions to the button presses.

Although the name of the light is "Ceiling" the home app shows "Wall Switch", the name of the switch. The real name is only shown within the enlarged view and its settings. wondering

HomeKit has a separate name for the accessory and a separate name for each service. Siri uses the service names. These names are maintained by HomeKit apps, through the HomeKit API; they're copied initially from homebridge (over HAP), but once the accessory has been paired, homebridge cannot change (or even see) the names.

I'm not sure if you can even set the accessory name from Apple's Home app. In Eve, the service names are editable under Types & Names (or Names) and the accessory name under Accessory Details in the popup window behind the gear box.

It looks like the Home app cannot decide between showing the accessory as a single combined tile (presumably showing the accessory name) vs as separate tiles per service (each with the service name).

Adding/removing any of the two to favourites will always add/remove the other too. This is particularly annoying as it spams the Favourites sheet with useless wall switches. eyes-rolling

I haven't experienced this behaviour. Of course Apple changed the way the Home app displays tiles in iOS 13, and then again in 13.1. Again, it looks like the Home app cannot decide between handling the accessory as a single combined tile (marking the accessory as favourite) vs as separate tiles per service (marking each service as favourite).

Have you tried showing the accessory as one tile, then remove the one tile from favourites, then show it again as separate tiles, and only add the tile you want to favourites?

If that doesn't work, as a workaround, you can tell homebridge-hue to expose the light resource as a separate accessory from the ZHASwitch resources, see https://github.com/ebaauw/homebridge-hue/issues/493#issuecomment-538634073.

Having the light and the inevitable and useless switch in my favourites, when going to the HomeKit quick access in iOS's control center the useless wall switch is shown but the light is missing. face-palm

The control centre only shows nine favourites. I have no clue how it decides which nine if you have more. Again, these are managed by the Home app, not visible over HAP; nothing I can do about that in homebridge-hue.

patrickschaper commented 4 years ago

Have you tried showing the accessory as one tile, then remove the one tile from favourites, then show it again as separate tiles, and only add the tile you want to favourites?

Unfortunately there is no option for my devices to be merge as one like there is for sensors...

If that doesn't work, as a workaround, you can tell homebridge-hue to expose the light resource as a separate accessory from the ZHASwitch resources, see #493 (comment).

...so the workaround was what I tried next.

Because I didn't know what the JSON in the comment meant I had a look around. The homepage shows similar JSON examples but it's never explained where to use it. First I thought it's part of the homebridge/homebridge-hue configuration but then I found out that this is JSON to be used in a POST request to an undocumented deCONZ REST API endpoint called /api/<ApiKey>/resourcelinks. That was pretty hard to figure out.

Now here is what I did

For everybody else and my future self who forgot how it's done ^^

First, I read out what lights are available to get the path of the lights I want to be separated from their wall switch. So I made a GET call to http://192.168.178.10/api/<ApiKey>/lights. It turned out that light 1, 11 and 13 are the ones to be split off their counterpart.

And now I sent a POST request to http://192.168.178.10/api/<ApiKey>/resourcelinks with the following body.

{
  "classid": 1,
  "description": "splitlight",
  "links": [
    "/lights/1",
    "/lights/11",
    "/lights/13",
  ],
  "name": "homebridge-hue",
  "recycle": false,
  "type": "Link"
}

It returned a success message.

Be sure to remove the "owner" node seen in other examples to work, otherwise the API returns an error ("parameter, owner, not available").

PS: The /resourcelinks endpoint is also the place where one can reconfigure lights to outlets. See: https://github.com/ebaauw/homebridge-hue/releases/tag/v0.10.0

Thank you for your great work and support.

patrickschaper commented 4 years ago

Because I don't have a Hue Bridge and didn't know that the Hue Bridge comes with an API, I never realised that the deCONZ REST API is something like a rebuild of the Hue API. If anyone needs more information on what all the knobs mean register as Hue developer and take a their API: https://developers.meethue.com/develop/hue-api/