brutella / hkknx-public

hkknx is a HomeKit KNX bridge for KNX.
https://hochgatterer.me/hkknx
97 stars 6 forks source link

Configurator app should generate unique accessory names to prevent HMErrorCode 31 #210

Closed brutella closed 1 year ago

brutella commented 1 year ago

HomeKit doesn't allow multiple accessories with the same name. Specifically you cannot rename accessories to have the same name. Therefore the Configurator app should use the room name as a prefix for accessory names. This should work because Home app automatically removes the room name from the accessory name when displaying the accessory.

The only downside is that when you rename the room, the room name doesn't match the accessory name prefix anymore.

Any thoughts on this?

chef76 commented 1 year ago

I have multiple accessories by the name Deckenlicht in different rooms. Works flawlessly. I Never had a Problem with this Setup. Why shouldn't this be possible?

brutella commented 1 year ago

Did you rename those accessories afterwards, or did you set the name on creation? HomeKit doesn't allow renaming accessories to have the same name.

chef76 commented 1 year ago

O.k. understood. All names were given on creation in the bridge, no renaming afterwards in Homekit.

mirkolenz commented 1 year ago

I have the same setup as @chef76: Multiple items with the same name (e.g., "Decke" or "Rolladen") that were given this name upon creation. I never tried to rename them, but if that is not possible, this seems to be a bug that should be handled somehow. To me, your proposal makes sense in general. However, I think there may be some edge cases. For example, some may already prefix the accessory names with the room names manually. Maybe this should not be handled "magically" by the configurator app, but in HKKNX directly instead: If the given room name is not a prefix of the accessory, add it. This should be more transparent for users hopefully.

brutella commented 1 year ago

If the given room name is not a prefix of the accessory, add it.

You mean the name field in hkknx should also contain the room name after saving the name?

mirkolenz commented 1 year ago

Yes, exactly. This could be treated as some kind of "auto-correct" that is then also mentioned in the save confirmation banner.

mirkolenz commented 1 year ago

I just had another idea regarding this issue: Maybe the automatic renaming should only happen in case a conflict occurs (i.e., the same name is used twice). This gives more freedom to the user.

brutella commented 1 year ago

This issue has some interesting developments. I'm running iOS 16.2 and it seems like HomeKit automatically updates the accessory names after changing them in hkknx. There is no need to synchronise the names using the Configurator.app.

You can even use the same name for multiple accessories without any issues. 😳 Can someone verify this?

brutella commented 1 year ago

I'm unable to reproduce the issue of name collision in iOS 16.3. HomeKit doesn't seem to complain anymore when naming multiple accessories the same.