RogerSelwyn / O365-HomeAssistant

Office 365 integration for Home Assistant
MIT License
203 stars 15 forks source link

Error during setup of component o365 #244

Closed Maralai closed 3 months ago

Maralai commented 3 months ago

The issue occurred, I think, since 2024.8. I am not sure what the exact nature is of the issue, but I am seeing a lot more logs recently surrounding async, so maybe something is not working as expected in Home Assistant? Let me know if I can provide more details that would help.


Core 2024.8.1 Frontend 20240809.0


Logger: homeassistant.setup Source: setup.py:416 First occurred: 11:24:53 PM (1 occurrences) Last logged: 11:24:53 PM

Error during setup of component o365
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 416, 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 71, in _async_setup_account
    permissions, failed_permissions = await perms.async_check_authorizations()
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/o365/classes/permissions.py", line 88, in async_check_authorizations
    self._permissions = await self._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 "/config/custom_components/o365/classes/permissions.py", line 171, in _get_permissions
    permissions = json.loads(raw)["scope"]
                  ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
RogerSelwyn commented 3 months ago

Looks like your token is corrupted. Follow instructions here to delete it - https://rogerselwyn.github.io/O365-HomeAssistant/token.html

RogerSelwyn commented 3 months ago

Latest release will post a repair asking you to re-authenticate if it can't read the token.

https://github.com/RogerSelwyn/O365-HomeAssistant/releases/tag/v4.8.4

Maralai commented 3 months ago

Brilliant! The new version started the flow, and I am now connected again.