ebaauw / homebridge-deconz

Homebridge plugin for deCONZ
Apache License 2.0
135 stars 7 forks source link

Understanding Accessory Naming (Phoscon vs Cache vs Config UI vs HomeKit) #54

Closed keness521 closed 2 years ago

keness521 commented 2 years ago

Hello!

This isn't a bug report, I was just want to better understand where what gets what name, and what gets updated and when. (Some excellent English grammar there...)

If I understand correctly, the process basically works like this:

1) When you add a device through Phoscon, the generic name which is automatically created immediately becomes the name for the cached accessory and the HomeKit accessory and what shows in Config UI.

2) If you then change the name in Phoscon, the cached accessory name does not change, the HomeKit name does not change and the Config UI name does not change. However, in the log, it does seem that Homebridge-deCONZ does recognize this new name and uses it. Log entries use the new name.

3) Changing the name in HomeKit doesn't change it anywhere else.

4) Deleting the single cached accessory (sometimes requires a couple times) does then cause EVERYTHING to then update to the new name in Phoscon, however any room/scene/automation settings will also need to be redone in HomeKit, if there were any.

(I expect using Expose on/off in Eve might be very useful as well, but I haven't used that option too much yet. I suspect although it might update HomeKit, it probably wouldn't affect the cached accessory name, correct?)

I like to keep a neat, organized system because I have dozens of Aqara air sensors, over a dozen light switches, at least a dozen leak sensors and over a dozen outlets.

So my current process is: Add to Phoscon -> Rename in Phoscon -> Immediately delete cached resource in HB -> Once the real name is reflected in HomeKit, set it up -> Done.

I'm perfectly happy with this process, just want to see if there is a quicker way to ensure the "real" name of the device is in all locations: Phoscon, the HB cached accessory name AND HomeKit.

Thanks as always!

ebaauw commented 2 years ago

HomeKit keeps its own accessory and service names, inaccessible to the accessory itself (i.c. Homebridge). They can only be updated through the HomeKit API, not through HAP. On creation, HomeKit copies these names from the accessory, so unpairing (un-exposing for a bridged accessory) and repairing (re-exposing) the accessory causes the names to be re-initialised. HomeKit effectively sees the re-paired accessory as a new accessory. Any associations to HomeKit rooms, groups, scenes, and automations are lost. Note that for Hue it's the Hue app, which is a proper HomeKit app, that syncs the names on the Hue bridge with the HomeKit, not the Hue bridge itself.

Clearing Expose and then setting it again causes Homebridge deCONZ to un-expose and re-expose the device. It also clears all settings (incl. Eve history), so there should be no need to mess with cachedAccessories.

I'm still busy trying to provide an interface through the Homebridge UI to (un-)expose devices, dropping the requirement for Eve and keeping HomeKit clean. I'll be changing the logic, so Expose Lights truly becomes _Auto-Expose New Lights". Also, new devices will be shown, even before they are exposed, so you can expose them manually, when Auto-Expose New Lights is off.

keness521 commented 2 years ago

Thanks for the explanation. I've very excited to see what you come up with for the UI.

For cachedAccessories, I like to have these match what is in Phoscon as well. All the various parts of software keep it straight of course, regardless of how I rename them, but it can be hard for me since cachedAccessories is always still the default Phoscon name from before I renamed it.

Does clearing it in Expose and then setting it again also re-set the name in cachedAccessories, or would it still be the original default Phoscon name? (When I do this, it is usually BEFORE I have set any settings in HomeKit, so that the name will match what I have put in Phoscon. So I'm doing it just for the name, not to clear settings.)

It sounds like what you are planning with Expose Lights might work out well in this case. Would I be able to turn OFF Auto-Expose, so that I have time to rename it what I want in Phoscon first, and THEN manually Expose whatever light(s) I just added, allowing both cachedAccessories and HomeKit to both use the Phoscon name I gave it?

Thanks!