RogerSelwyn / O365-HomeAssistant

Office 365 integration for Home Assistant
MIT License
178 stars 14 forks source link

Error during setup of component #235

Closed relind closed 3 weeks ago

relind commented 4 weeks ago

I followed all of the installation steps up to step 6 however once I restart after adding o365 to the configuration.yaml I don't get a repair dialogue. instead, I get an error notification saying Invalid config. In the logs, there is a warning and an error.

The warning says "Could not locate token at /config/o365_storage/.O365-token-cache/o365_Account1.token." I think this is expected since I haven't authenticated yet.

The error says "error during setup of component o365" with the following error trace

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 404, in _async_setup_component
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/o365/__init__.py", line 52, in async_setup
    await _async_setup_account(hass, account, conf_type)
  File "/config/custom_components/o365/__init__.py", line 72, in _async_setup_account
    account, is_authenticated = await _async_try_authentication(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/o365/__init__.py", line 105, in _async_try_authentication
    account = await hass.async_add_executor_job(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/O365/account.py", line 23, in __init__
    protocol = protocol(default_resource=main_resource, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/O365/connection.py", line 234, in __init__
    super().__init__(protocol_url=self._protocol_url,
  File "/usr/local/lib/python3.12/site-packages/O365/connection.py", line 104, in __init__
    self._timezone: ZoneInfo = get_localzone()
                               ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tzlocal/unix.py", line 219, in get_localzone
    _cache_tz = _get_localzone()
                ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tzlocal/unix.py", line 176, in _get_localzone
    tzenv = utils._tz_from_env()
            ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tzlocal/utils.py", line 109, in _tz_from_env
    raise zoneinfo.ZoneInfoNotFoundError(
zoneinfo._common.ZoneInfoNotFoundError: 'tzlocal() does not support non-zoneinfo timezones like America/Detriot. \nPlease use a timezone in the form of Continent/City'

I'm not quite sure what's causing the error any help would be appreciated.

RogerSelwyn commented 4 weeks ago

It looks like there is something wrong with the timezone config on your server. Detroit is spelt incorrectly in that error.

relind commented 3 weeks ago

Yep Looks like I had a typo in the docker configuration for the timezone it works now. Thanks.