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

Error - data not loading properly #16

Open
freekeys opened this issue Sep 11, 2022 · 3 comments
Open

Error - data not loading properly #16

freekeys opened this issue Sep 11, 2022 · 3 comments

Comments

@freekeys
Copy link

Any idea what’s causing this please?

`This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/mila/devices/device.py:85
Integration: Mila Cares (documentation, issues)
First occurred: 20:58:58 (25 occurrences)
Last logged: 21:49:59

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 151, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 388, 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.10/site-packages/benedict/dicts/init.py", line 54, in getitem
super(benedict, self).getitem(key))
File "/usr/local/lib/python3.10/site-packages/benedict/dicts/keypath/keypath_dict.py", line 36, in getitem
return super(KeypathDict, self).getitem(
File "/usr/local/lib/python3.10/site-packages/benedict/dicts/keylist/keylist_dict.py", line 42, in getitem
return self._getitem_by_keys(key)
File "/usr/local/lib/python3.10/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']"'
`

@freekeys
Copy link
Author

Also getting this..

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/mila/devices/device.py:85
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 21:44:21 (5 occurrences)
Last logged: 21:47:58

[140376831107728] 'Invalid keys: "['outdoorStation', 'sensor', 'latest', 'value']"'
[140378013365776] 'Invalid keys: "['outdoorStation', 'sensor', 'latest', 'value']"'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/config/custom_components/mila/entities/appliance/fan.py", line 113, in async_turn_on
await self.async_set_preset_mode(PRESET_MODE_AUTOMAGIC)
File "/config/custom_components/mila/entities/appliance/fan.py", line 135, in async_set_preset_mode
await self.device.set_fan_mode(preset_mode)
File "/config/custom_components/mila/devices/appliance.py", line 69, in set_fan_mode
await self._coordinator.async_request_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 158, in async_request_refresh
await self._debounced_refresh.async_call()
File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 82, in async_call
await task
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_refresh
await self._async_refresh(log_failures=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 110, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 348, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 388, 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.10/site-packages/benedict/dicts/init.py", line 54, in getitem
super(benedict, self).getitem(key))
File "/usr/local/lib/python3.10/site-packages/benedict/dicts/keypath/keypath_dict.py", line 36, in getitem
return super(KeypathDict, self).getitem(
File "/usr/local/lib/python3.10/site-packages/benedict/dicts/keylist/keylist_dict.py", line 42, in getitem
return self._getitem_by_keys(key)
File "/usr/local/lib/python3.10/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']"'

@freekeys
Copy link
Author

Logger: homeassistant.components.sensor
Source: custom_components/mila/devices/device.py:85
Integration: Sensor (documentation, issues)
First occurred: 20:56:58 (2 occurrences)
Last logged: 20:56:58

Error adding entities for domain sensor with platform mila
Error while setting up mila platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 777, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 571, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 388, 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.10/site-packages/benedict/dicts/init.py", line 54, in getitem
super(benedict, self).getitem(key))
File "/usr/local/lib/python3.10/site-packages/benedict/dicts/keypath/keypath_dict.py", line 36, in getitem
return super(KeypathDict, self).getitem(
File "/usr/local/lib/python3.10/site-packages/benedict/dicts/keylist/keylist_dict.py", line 42, in getitem
return self._getitem_by_keys(key)
File "/usr/local/lib/python3.10/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']"'

@microraptor
Copy link

This happens, if no outdoor AQI is available. To fix it go in the Mila Cares App to Settings -> Your Hood -> Outdoor AQi -> Change and select a station with AQI by swiping left and right. If this doesn't fix the issue try adding the location again in the settings and add the mila to the new location.

Even if the outdoor AQI value is not interesting for a user, this is actually a big bug, because it makes the whole fan entity not work and some kind of exception handling is missing in the code.

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

No branches or pull requests

2 participants