core: Google Assistant: ArmLevel missing

The problem

hello,

I noticed the alarm panel on my Google Assistant Hub UI was greyed out (unavaiable) and saw this in my logs:

The log is from 2023.6.2 but, it may have also been there on 2023.6.x as I noticed the alarm panel was also grey-out before 2023.6.2

thanks

Logger: homeassistant.components.google_assistant.smart_home
Source: components/google_assistant/smart_home.py:181
integration: Google Assistant (documentation, issues)
First occurred: 7:16:17 AM (4 occurrences)
Last logged: 7:58:11 AM

Unexpected error serializing query for <state alarm_control_panel.partition1=disarmed; code_format=number, changed_by=None, code_arm_required=False, secure_arm=False, alarm_type=None, last_error_type=None, last_error_desc=None, last_error_at=None, disarm_failed=0, friendly_name=Qolsys Panel partition1, supported_features=63 @ 2024-06-11T07:05:44.936506-06:00>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/smart_home.py", line 181, in async_devices_query_response
    devices[devid] = entity.query_serialize()
                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 702, in query_serialize
    deep_update(attrs, trt.query_attributes())
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 1628, in query_attributes
    "currentArmLevel": self._default_arm_state(),
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 1596, in _default_arm_state
    raise SmartHomeError(ERR_NOT_SUPPORTED, "ArmLevel missing")
homeassistant.components.google_assistant.error.SmartHomeError: ArmLevel missing

the alarm panel works and is it should in HA UI directly.

What version of Home Assistant Core has the issue?

2024.6.2

What was the last working version of Home Assistant Core?

pre 2024.6 (maybe)

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Google Assistant

Link to integration documentation on our website

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

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (9 by maintainers)

Most upvoted comments

I think the bug is if len(states) != 1: code but should have been len(states) < 1 to check for no arm states.

I think the bug is if len(states) != 1: code but should have been len(states) < 1 to check for no arm states.

Somewhat like that yes. For some arming only allowed one level to exist for default logic to trigger. I missed that when I extracted the code, and the tests only ever had one level so it never triggered.

So that limit need to removed from the reporting case at least.

Looks like this is fixed on 2024.7.0b0. Thanks

20240626_094650.jpg

I’ve opened a fix for this issue. It’s a “semi” fix/feature change. So i’m not sure if i can include it in a patch release. We’ll see.

disarmed is definitely supported in general, but I think the google assistant integration didn’t make use of it (see https://github.com/home-assistant/core/pull/119238/files#diff-610fcbdd05a06183431282ef0d29febefc0c5d56166c572cb35e6d6bdf4ef857R1562), since the armLevel wasn’t being sent if the alarm was disarmed