Closed
Description
The changes in #712 apparently broke the vacuum integration in HomeAssistant for me and others.
home-assistant/core#37610
The changes were introduced in home-assistant/core#35417
Initialising the miio component used in HomeAssistant leads to the following error:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 451, in _async_add_entity
entity.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 290, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 317, in _async_write_ha_state
attr.update(self.device_state_attributes or {})
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/vacuum.py", line 333, in device_state_attributes
if self.timers:
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/vacuum.py", line 284, in timers
for timer in self._timers
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/vacuum.py", line 284, in <listcomp>
for timer in self._timers
File "/usr/local/lib/python3.7/site-packages/miio/vacuumcontainers.py", line 444, in next_schedule
local_tz = timezone(self.timezone)
File "/usr/local/lib/python3.7/site-packages/pytz/__init__.py", line 163, in timezone
if zone.upper() == 'UTC':
AttributeError: 'dict' object has no attribute 'upper'
Apparently the call to pytz here
python-miio/miio/vacuumcontainers.py
Line 444 in c9f238c
expects a String while it gets passed an dictionary.
When I run a timezone command on my Vacuum (Xiaowa E25) I get this dictionary but I am not sure if that is the identical call output used in the code.
{'olson': 'Europe/Berlin', 'posix': 'CET-1CEST,M3.5.0,M10.5.0/3'}
Because of that I am not sure if its a problem in python-miio or in the implementation in HASS.