home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.61k stars 30.37k forks source link

SIA alarm integration does not set supported features #82569

Closed t-enk closed 1 year ago

t-enk commented 1 year ago

The problem

Not able to show current armed state to homekit

Logger: homeassistant.helpers.event
Source: components/homekit/type_security_systems.py:160 
First occurred: November 21, 2022 at 17:26:44 (4 occurrences) 
Last logged: November 22, 2022 at 23:30:03

Error while processing state change for alarm_control_panel.ajax
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 284, in _async_state_change_dispatcher
    hass.async_run_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 573, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 445, in async_update_event_state_callback
    self.async_update_state_callback(event.data.get("new_state"))
  File "/usr/src/homeassistant/homeassistant/components/homekit/accessories.py", line 467, in async_update_state_callback
    self.async_update_state(new_state)
  File "/usr/src/homeassistant/homeassistant/components/homekit/type_security_systems.py", line 160, in async_update_state
    self.char_current_state.set_value(current_state)
  File "/usr/local/lib/python3.10/site-packages/pyhap/characteristic.py", line 297, in set_value
    self.valid_value_or_raise(value)
  File "/usr/local/lib/python3.10/site-packages/pyhap/characteristic.py", line 219, in valid_value_or_raise
    raise ValueError(error_msg)
ValueError: SecuritySystemCurrentState: value=1 is an invalid value.
Logger: pyhap.characteristic
Source: components/homekit/type_security_systems.py:160 
First occurred: November 21, 2022 at 17:26:44 (4 occurrences) 
Last logged: November 22, 2022 at 23:30:03

SecuritySystemCurrentState: value=1 is an invalid value.
SecuritySystemCurrentState: value=2 is an invalid value.

What version of Home Assistant Core has the issue?

2022.11.4

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

core/homeassistant/components/homekit/type_security_systems.py

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

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 commented 1 year ago

This means the integration changed its supported features at runtime which is not allowed.

Which integration provides the security system?

t-enk commented 1 year ago

The data are coming from the SIA, but the armed state are shown correctly in Homeassistant, only homekit has issues

home-assistant[bot] commented 1 year ago

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

Code owner commands Code owners of `sia` 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 sia` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


sia documentation sia source (message by IssueLinks)

bdraco commented 1 year ago

It won't work in HomeKit unless supported_features is set correctly at startup time

https://github.com/home-assistant/core/blob/dev/homeassistant/components/sia/alarm_control_panel.py

lblyweert commented 1 year ago

It won't work in HomeKit unless supported_features is set correctly at startup time

https://github.com/home-assistant/core/blob/dev/homeassistant/components/sia/alarm_control_panel.py

Hey @bdraco I am facing the same error What do you mean « set correctly at startup time » ? What should be set ? Which startup ? Thanks !

bdraco commented 1 year ago

The integration is missing code to set which features it supports

https://developers.home-assistant.io/docs/core/entity/alarm-control-panel?_highlight=supported&_highlight=fea#supported-features

lblyweert commented 1 year ago

It was working fine until yesterday Is there any quick fix I may use please ?

eavanvalkenburg commented 1 year ago

This is indeed not in there, because this protocol does not support any of those features, it is basically a sensor without control, so the default for that is set in the alarm_control_panel entity (here). And indeed this worked without issues, maybe something in homekit changed to be stricter?

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.