ha-google-home: 4 is not a valid GoogleHomeAlarmStatus

Describe the bug

Integration fails to load entities. Exceptions in log image

Version of the integration

If you are unsure about the version check the github release here.

1.40

Glocaltokens Version (Underlying package)

bash-5.0# pip show glocaltokens
Name: glocaltokens
Version: 0.3.0

Logs

2021-04-11 14:48:40 ERROR (MainThread) [custom_components.google_home] Unexpected error fetching sensor data: 4 is not a valid GoogleHomeAlarmStatus
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 173, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 143, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/google_home/api.py", line 246, in update_google_devices_information
    coordinator_data = await asyncio.gather(
  File "/config/custom_components/google_home/api.py", line 220, in collect_data_from_endpoints
    device = await self.get_alarms_and_timers(device, ip_address, auth_token)
  File "/config/custom_components/google_home/api.py", line 139, in get_alarms_and_timers
    device.set_alarms(resp.get(JSON_ALARM))
  File "/config/custom_components/google_home/models.py", line 46, in set_alarms
    self._alarms = [
  File "/config/custom_components/google_home/models.py", line 47, in <listcomp>
    GoogleHomeAlarm(
  File "/config/custom_components/google_home/models.py", line 144, in __init__
    self.status = GoogleHomeAlarmStatus(status)
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 4 is not a valid GoogleHomeAlarmStatus```

## Debug log

<!-- To enable debug logs, put the below snippet in your configuration.yaml file.
You can delete the below snippet before you submit this issue.
-->

```yaml
logger:
  default: debug
  logs:
    custom_components.google_home: debug

2021-04-11 14:52:42 DEBUG (MainThread) [custom_components.google_home] Fetching data from Google Home device Living Room TV - https://192.168.1.AAA:8443/setup/assistant/alarms
2021-04-11 14:52:42 DEBUG (MainThread) [custom_components.google_home] Fetching data from Google Home device Entryway clock - https://192.168.1.AAA:8443/setup/assistant/alarms
2021-04-11 14:52:42 DEBUG (MainThread) [custom_components.google_home] Fetching data from Google Home device Bedroom speaker - https://192.168.1.AAA:8443/setup/assistant/alarms
2021-04-11 14:52:42 DEBUG (MainThread) [custom_components.google_home] Fetching data from Google Home device Kitchen speaker - https://192.168.1.AAA:8443/setup/assistant/alarms
2021-04-11 14:52:43 ERROR (MainThread) [custom_components.google_home] Unexpected error fetching sensor data: 4 is not a valid GoogleHomeAlarmStatus
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 173, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 143, in _async_update_data
    return await self.update_method()
  File "/config/custom_components/google_home/api.py", line 246, in update_google_devices_information
    coordinator_data = await asyncio.gather(
  File "/config/custom_components/google_home/api.py", line 220, in collect_data_from_endpoints
    device = await self.get_alarms_and_timers(device, ip_address, auth_token)
  File "/config/custom_components/google_home/api.py", line 139, in get_alarms_and_timers
    device.set_alarms(resp.get(JSON_ALARM))
  File "/config/custom_components/google_home/models.py", line 46, in set_alarms
    self._alarms = [
  File "/config/custom_components/google_home/models.py", line 47, in <listcomp>
    GoogleHomeAlarm(
  File "/config/custom_components/google_home/models.py", line 144, in __init__
    self.status = GoogleHomeAlarmStatus(status)
  File "/usr/local/lib/python3.8/enum.py", line 339, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.8/enum.py", line 662, in __new__
    raise ve_exc
ValueError: 4 is not a valid GoogleHomeAlarmStatus
2021-04-11 14:52:43 DEBUG (MainThread) [custom_components.google_home] Finished fetching sensor data in 23.034 seconds

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 19 (3 by maintainers)

Most upvoted comments

@whitehead-aa it’s merged. Can you test the master?

On Lenovo smart clock “state_four” comes back when I make the alarm inactive: image image

When setting it active again status changes to set: image image

I will try on a home hub as well but currently it’s not responding.

Yeah, I did exactly that.

In my case it gets “set” state. I even checked that while playing it has “ringing” state and after cancelled it has “set” again for the next day.

We can probably mark 4 as unknown but it’s interesting to figure out what it really means.

@whitehead-aa can you try to pause timer on lenovo clock? Maybe we have missing status there as well?

@GuyKh, the fix is now merged #181, we’ll release it in a few days to test 😃

@AstroViking any ideas?

Do you know what 4 means?

class GoogleHomeAlarmStatus(Enum):
    """Definition of Google Home alarm status"""

    NONE = 0
    SET = 1
    RINGING = 2
    SNOOZED = 3