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

Alarm control panel exported to HomeKit bridge error #129867

Closed
cmlpreston opened this issue Nov 5, 2024 · 4 comments · Fixed by #130311
Closed

Alarm control panel exported to HomeKit bridge error #129867

cmlpreston opened this issue Nov 5, 2024 · 4 comments · Fixed by #130311
Assignees

Comments

@cmlpreston
Copy link

The problem

I am using the Ness integration which provides an alarm control panel (interface to a Ness security panel) which is then exported via a HomeKit bridge.

However, the error below is observed and the control panel does not get correctly exported whereas it did work fine previously.

The alarm control panel works fine within Home Assistant itself.

It's unclear to me if the issue is within the HomeKit or Ness integration.

Logger: homeassistant.components.homekit
Source: components/homekit/__init__.py:758
integration: HomeKit Bridge ([documentation](https://next.home-assistant.io/integrations/homekit), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+homekit%22))
First occurred: 10:11:14 (1 occurrences)
Last logged: 10:11:14

Failed to create a HomeKit accessory for alarm_control_panel.alarm_panel
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/homekit/__init__.py", line 758, in add_bridge_accessory
    acc = get_accessory(self.hass, self.driver, state, aid, conf)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 280, in get_accessory
    return TYPES[a_type](hass, driver, name, state.entity_id, aid, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/homekit/type_security_systems.py", line 141, in __init__
    self.async_update_state(state)
  File "/usr/src/homeassistant/homeassistant/components/homekit/type_security_systems.py", line 160, in async_update_state
    hass_state = AlarmControlPanelState(new_state.state)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 'unknown' is not a valid AlarmControlPanelState

What version of Home Assistant Core has the issue?

core-2024.12.0.dev202411040232

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-120ba354f429702065ab0df787cd0d1e.json

Example YAML snippet

Homekit YAML

      include_domains:
        - alarm_control_panel

  entity_config:
      alarm_control_panel.home:
        code: 00000000


Ness YAML

ness_alarm:
  host: 192.168.1.xxx
  port: 23
  scan_interval:
    days: 0
    hours: 0
    minutes: 0
    seconds: 2
    milliseconds: 0
  zones:
    - name: Hall
      id: 1
    - name: Lounge
      id: 2
    - name: Gate
      id: 3
      type: garage_door
    - name: "Side Gate"
      id: 4
      type: door

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Nov 5, 2024

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 Renames 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.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


homekit documentation
homekit source
(message by IssueLinks)

@cmlpreston
Copy link
Author

This appears to be a timing-related issue. After a full restart, the HomeKit AlarmControlPanel item isn't being exported by HomeKit bridge. But if I just restart the relevant bridge integration, the alarm control panel is exported and appears in the Home app etc.

Happy to provide more information as required.

@Ramias1
Copy link

Ramias1 commented Nov 8, 2024

Same issue with Ring Alarm via the Ring Add-on with MQTT. Reloading that particular bridge resolves it. Is there a way to automate bridge reloading when Alarm state changes from "unavailable"? Just updated to 2024.11.1 and this is still happening.

`Logger: homeassistant.components.homekit
Source: components/homekit/init.py:758
integration: HomeKit Bridge (documentation, issues)
First occurred: 8:22:35 PM (1 occurrences)
Last logged: 8:22:35 PM

Failed to create a HomeKit accessory for alarm_control_panel.home_alarm
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit/init.py", line 758, in add_bridge_accessory
acc = get_accessory(self.hass, self.driver, state, aid, conf)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 280, in get_accessory
return TYPES[a_type](hass, driver, name, state.entity_id, aid, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/homekit/type_security_systems.py", line 141, in init
self.async_update_state(state)
File "/usr/src/homeassistant/homeassistant/components/homekit/type_security_systems.py", line 160, in async_update_state
hass_state = AlarmControlPanelState(new_state.state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/enum.py", line 757, in call
return cls.new(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/enum.py", line 1171, in new
raise ve_exc
ValueError: 'unavailable' is not a valid AlarmControlPanelState
`

@alexsydell
Copy link
Contributor

@gjohansson-ST this appears to be caused by the new AlarmControlPanelState enum added in #126283. The enum does not include the 'unavailable' state, which is valid and documented in https://www.home-assistant.io/integrations/alarm_control_panel/. Note that 'unknown' is also a valid, documented state which is not present in the enum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants