MTrab / pyworxcloud

PyPI module for integrating with Worx Cloud devices
GNU General Public License v3.0
22 stars 20 forks source link

Integration startup fails for landxcape because of missing timezone information in warranty.py #68

Closed rasmuspeders1 closed 2 years ago

rasmuspeders1 commented 2 years ago

Environment:

Configuration

Configured for Landxcape through GUI

Describe the bug

During initialization an unhandled exception occurs in pyworxcloud.utils.warranty because the data input argument has None for the timezone.

Debug log

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 353, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/landroid_cloud/__init__.py", line 66, in async_setup_entry
    result = await _async_setup(hass, entry)
  File "/config/custom_components/landroid_cloud/__init__.py", line 208, in _async_setup
    await hass.async_add_executor_job(cloud.connect, False, False)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/pyworxcloud/__init__.py", line 226, in connect
    self._fetch()
  File "/usr/local/lib/python3.10/site-packages/pyworxcloud/__init__.py", line 638, in _fetch
    device = DeviceHandler(self._api, product)
  File "/usr/local/lib/python3.10/site-packages/pyworxcloud/utils/devices.py", line 37, in __init__
    self.__mapinfo(api, product)
  File "/usr/local/lib/python3.10/site-packages/pyworxcloud/utils/devices.py", line 90, in __mapinfo
    self.warranty = Warranty(data)
  File "/usr/local/lib/python3.10/site-packages/pyworxcloud/utils/warranty.py", line 27, in __init__
    < datetime.now().astimezone(pytz.timezone(data["time_zone"]))
  File "/usr/local/lib/python3.10/site-packages/pytz/__init__.py", line 168, in timezone
    raise UnknownTimeZoneError(None)
pytz.exceptions.UnknownTimeZoneError: None
MTrab commented 2 years ago

I'll move this to pyworxcloud, as this error is related to the API interface rather than the integration.