Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HomeKit - Error When Configuring Device Triggers #81685

Closed
Garywoo opened this issue Nov 6, 2022 · 8 comments · Fixed by #80703
Closed

HomeKit - Error When Configuring Device Triggers #81685

Garywoo opened this issue Nov 6, 2022 · 8 comments · Fixed by #80703
Assignees

Comments

@Garywoo
Copy link

Garywoo commented Nov 6, 2022

The problem

I have previously experimented with device triggers, however the non-static device assignment IDs caused me problems with HomeKit automations changing unexpectedly after HA restarts, so I stopped using them, and found other workarounds using automations and virtual entities. I see this issue was fixed in the 2022.11 release, so I wanted to try them out again.

When I configure the HomeKit integration though the UI and select an one of my Apple TV's as a device trigger in the final Advanced Configuration step of the config, I get an error upon saving.

The part of the error I believe is pertinent is here, while the full error is included below:
RuntimeError: Cannot assign IID 131 to <service display_name=StatelessProgrammableSwitch unique_id=changed_states- chars={'ProgrammableSwitchEvent': None, 'Name': '', 'ServiceLabelIndex': 1}> as it is already in use by: <service display_name=StatelessProgrammableSwitch unique_id=changed_states- chars={'ProgrammableSwitchEvent': None, 'Name': 'Changed_States', 'ServiceLabelIndex': 1}>

I have looked for an existing entity related to this stateless switch in the HA developer tools, but cannot find one. I also deleted my automations which were triggered by this device in case there was a conflict. I've also tried restarting HA after deselecting and reselecting the device triggers in the UI config without any success. The same error persists.

What version of Home Assistant Core has the issue?

core-2022.11.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

HomeKit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit

Diagnostics information

config_entry-homekit-e0291e9970b140327f7ba89c871e19a7.json (1).txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: components/homekit/accessories.py:665
First occurred: 8:34:11 pm (3 occurrences)
Last logged: 8:38:20 pm

Error setting up entry Home Assistant Bridge for homekit
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 365, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 345, in async_setup_entry
    await homekit.async_start()
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 778, in async_start
    if not await self._async_create_accessories():
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 940, in _async_create_accessories
    acc = await self._async_create_bridge_accessory(entity_states)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 929, in _async_create_bridge_accessory
    self.add_bridge_triggers_accessory(device, device_triggers)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 708, in add_bridge_triggers_accessory
    DeviceTriggerAccessory(
  File "/usr/src/homeassistant/homeassistant/components/homekit/type_triggers.py", line 49, in __init__
    serv_stateless_switch = self.add_preload_service(
  File "/usr/local/lib/python3.10/site-packages/pyhap/accessory.py", line 129, in add_preload_service
    self.add_service(service)
  File "/usr/local/lib/python3.10/site-packages/pyhap/accessory.py", line 151, in add_service
    self.iid_manager.assign(s)
  File "/usr/local/lib/python3.10/site-packages/pyhap/iid_manager.py", line 31, in assign
    iid = self.get_iid_for_obj(obj)
  File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 665, in get_iid_for_obj
    raise RuntimeError(
RuntimeError: Cannot assign IID 131 to <service display_name=StatelessProgrammableSwitch unique_id=changed_states- chars={'ProgrammableSwitchEvent': None, 'Name': '', 'ServiceLabelIndex': 1}> as it is already in use by: <service display_name=StatelessProgrammableSwitch unique_id=changed_states- chars={'ProgrammableSwitchEvent': None, 'Name': 'Changed_States', 'ServiceLabelIndex': 1}>

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Nov 6, 2022

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homekit can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign homekit Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit documentation
homekit source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Nov 6, 2022

Device triggers still need a lot of work for HomeKit. After I finish fixing #80703 , I'll try to take a look at this one

@bdraco
Copy link
Member

bdraco commented Nov 6, 2022

Both of these should be significantly less work than the stable ids

Unfortunately, end of year means less time to work on homeassistant since my "day job" is much busier

@bdraco
Copy link
Member

bdraco commented Nov 8, 2022

Originally posted by @bartgabriels in #81762


Homekit doesn't sync anymore with HA

Logger: homeassistant
Source: components/homekit/accessories.py:665 
First occurred: 06:45:34 (1 occurrences) 
Last logged: 06:45:34

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 778, in async_start
    if not await self._async_create_accessories():
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 940, in _async_create_accessories
    acc = await self._async_create_bridge_accessory(entity_states)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 929, in _async_create_bridge_accessory
    self.add_bridge_triggers_accessory(device, device_triggers)
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 708, in add_bridge_triggers_accessory
    DeviceTriggerAccessory(
  File "/usr/src/homeassistant/homeassistant/components/homekit/type_triggers.py", line 49, in __init__
    serv_stateless_switch = self.add_preload_service(
  File "/usr/local/lib/python3.10/site-packages/pyhap/accessory.py", line 129, in add_preload_service
    self.add_service(service)
  File "/usr/local/lib/python3.10/site-packages/pyhap/accessory.py", line 151, in add_service
    self.iid_manager.assign(s)
  File "/usr/local/lib/python3.10/site-packages/pyhap/iid_manager.py", line 31, in assign
    iid = self.get_iid_for_obj(obj)
  File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 665, in get_iid_for_obj
    raise RuntimeError(
RuntimeError: Cannot assign IID 1255 to <service display_name=StatelessProgrammableSwitch unique_id=current_option_changed- chars={'ProgrammableSwitchEvent': None, 'Name': '', 'ServiceLabelIndex': 1}> as it is already in use by: <service display_name=StatelessProgrammableSwitch unique_id=current_option_changed- chars={'ProgrammableSwitchEvent': None, 'Name': 'Current_Option_Changed', 'ServiceLabelIndex': 2}>

@Garywoo Garywoo changed the title Homekit - Error When Configuring Device Triggers HomeKit - Error When Configuring Device Triggers Nov 8, 2022
@bartgabriels
Copy link

Is there a workaround available?

@bdraco
Copy link
Member

bdraco commented Nov 8, 2022

Is there a workaround available?

Not at this time

@bartgabriels
Copy link

I saw an reference in the new 2022.11.01 but it didn't fix the issue

@bdraco
Copy link
Member

bdraco commented Nov 15, 2022

2022.11.3

@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants