Skip to content

Invalid keys since Mila server maintenance  #37

@TomBrien

Description

@TomBrien

Since the Mila server maintenance, I see a lot of error in the HA log relating to updating the pm25 sensor. These seem to happen when ever trying to set the fan speed or when the update coordinator tries to update the sensor. The PM25 sensor appear to have not worked since arounf 18:00 BST 28/05/24

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 543, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mila/entities/location/aqi_sensor.py", line 21, in native_value
    pm25: float = self.device.get_value("outdoorStation.sensor.latest.value")
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mila/devices/device.py", line 85, in get_value
    return self._device_data[data_path]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/benedict/dicts/__init__.py", line 54, in __getitem__
    super(benedict, self).__getitem__(key))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/benedict/dicts/keypath/keypath_dict.py", line 36, in __getitem__
    return super(KeypathDict, self).__getitem__(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/benedict/dicts/keylist/keylist_dict.py", line 42, in __getitem__
    return self._getitem_by_keys(key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/benedict/dicts/keylist/keylist_dict.py", line 49, in _getitem_by_keys
    raise KeyError('Invalid keys: "{}"'.format(keys))
KeyError: 'Invalid keys: "[\'outdoorStation\', \'sensor\', \'latest\', \'value\']"'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions