Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Error Handling Request #123

Open
reotto613 opened this issue Aug 16, 2021 · 15 comments
Open

Error Handling Request #123

reotto613 opened this issue Aug 16, 2021 · 15 comments

Comments

@reotto613
Copy link

I upgraded to version 2021.8.7 and I am now am not able to see anything in my calendar views. I am getting the following error in the HA logs in regard to it.

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/o365/calendar.py:185
Integration: Office 365 Calendar (documentation)
First occurred: 8:09:51 AM (22 occurrences)
Last logged: 9:21:07 AM

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 211, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/calendar/init.py", line 209, in get
event_list = await entity.async_get_events(
File "/config/custom_components/o365/calendar.py", line 131, in async_get_events
return await self.data.async_get_events(hass, start_date, end_date)
File "/config/custom_components/o365/calendar.py", line 185, in async_get_events
vevent_list = list(
File "/usr/local/lib/python3.9/site-packages/O365/calendar.py", line 1676, in
events = (self.event_constructor(parent=self,
File "/usr/local/lib/python3.9/site-packages/O365/calendar.py", line 871, in init
self.__recurrence = EventRecurrence(event=self,
File "/usr/local/lib/python3.9/site-packages/O365/calendar.py", line 125, in init
get_windows_tz(self.protocol.timezone))
File "/usr/local/lib/python3.9/site-packages/O365/utils/windows_tz.py", line 639, in get_windows_tz
iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'

@krubottom
Copy link

Came here to report the same issue.

o365: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 646, in async_device_update
await task
File "/config/custom_components/o365/calendar.py", line 134, in async_update
await self.data.async_update(self.hass)
File "/config/custom_components/o365/calendar.py", line 207, in async_update
results = list(results)
File "/usr/local/lib/python3.9/site-packages/O365/calendar.py", line 1676, in
events = (self.event_constructor(parent=self,
File "/usr/local/lib/python3.9/site-packages/O365/calendar.py", line 871, in init
self.__recurrence = EventRecurrence(event=self,
File "/usr/local/lib/python3.9/site-packages/O365/calendar.py", line 125, in init
get_windows_tz(self.protocol.timezone))
File "/usr/local/lib/python3.9/site-packages/O365/utils/windows_tz.py", line 639, in get_windows_tz
iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'

@uSlackr
Copy link

uSlackr commented Aug 16, 2021 via email

@RogerSelwyn
Copy link
Contributor

I also have this error, a rollback to 2021.8.6 fixes the problem, so I don't think it is how the Timezone is configured in the settings that is the issue (mine is Europe/London). It's not clear to me what has changed in 2021.8.7 because I have looked through all the commits on the core and I can't see what is causing the issue.

I've had a go at hacking the code of the pypi module to see what is going on, as far as I can see the structure of the timezone being passed is now incorrect (or at least different from what used to work). But as soon as I fudge that piece of code (in windows_tz.py) it fails elsewhere. So somehow something in .7 has caused the TZ info to be altered.

@reotto613
Copy link
Author

I tried to reset my timezone which means delete it, click save, and then re-add. I rebooted, and saw no difference. Same error. I think uninstalled it in HACS, change my timezone again, and rebooted. When I ran check config, it errored out. I did a Reboot host to get around the config issue, and now I am getting this error.

Logger: homeassistant.setup
Source: setup.py:173
First occurred: 11:34:58 AM (1 occurrences)
Last logged: 11:34:58 AM

Setup failed for o365: Integration not found.

@RogerSelwyn
Copy link
Contributor

I tried to reset my timezone which means delete it, click save, and then re-add. I rebooted, and saw no difference. Same error. I think uninstalled it in HACS, change my timezone again, and rebooted. When I ran check config, it errored out. I did a Reboot host to get around the config issue, and now I am getting this error.

Logger: homeassistant.setup
Source: setup.py:173
First occurred: 11:34:58 AM (1 occurrences)
Last logged: 11:34:58 AM

Setup failed for o365: Integration not found.

You need to re-add the version number to manifest.json. I suspect you did that a couple of HA releases ago.

@reotto613
Copy link
Author

Good call. That worked, and now I am back to the top of this thread. Same error.

@reotto613
Copy link
Author

I also have this error, a rollback to 2021.8.6 fixes the problem, so I don't think it is how the Timezone is configured in the settings that is the issue (mine is Europe/London). It's not clear to me what has changed in 2021.8.7 because I have looked through all the commits on the core and I can't see what is causing the issue.

I've had a go at hacking the code of the pypi module to see what is going on, as far as I can see the structure of the timezone being passed is now incorrect (or at least different from what used to work). But as soon as I fudge that piece of code (in windows_tz.py) it fails elsewhere. So somehow something in .7 has caused the TZ info to be altered.

I looked through .7 as well and nothing jumped out. Is a core issue warranted at this point?

@RogerSelwyn
Copy link
Contributor

I may get a chance to debug this tomorrow, but I personally wouldn’t raise a core issue until I have some sort of clue as to what it is.

It’s just a pain setting up the dev environment for it since it is firewall setup and the like to be done as well.

@RogerSelwyn
Copy link
Contributor

The problem is tzlocal has been upgraded to v3.0 from v2.1 and is returning a different result with no Zone information. I will continue to investigate...

@RogerSelwyn
Copy link
Contributor

regebro/tzlocal#112

@RogerSelwyn
Copy link
Contributor

OK, this is likely less a problem with 2021.8.7 as such, more that because of the upgrade it pulled down a new version of tzlocal which released a new version on the 13th August which changes the structure of the data returned. This then means the O365 module breaks, causing the HA O365 Integration to break. You can work around this for now by updating the manifest.json for O365 as below. I don't guarantee this is a permanent fix, because if someone (particularly in the Core) decides they want to use the features of tzlocal 3.0, then there will be a conflict of versions. However, it should give an opportunity for the owner of O365 module to fix the solution. A very similar issuer has been reported here - O365/python-o365#670

{
  "domain": "o365",
  "name": "Office 365 Calendar",
  "documentation": "https://github.com/PTST/O365Calendar-HomeAssistant",
  "dependencies": ["configurator", "http"],
  "codeowners": ["@PTST"],
  "requirements": ["O365==2.0.9", "BeautifulSoup4==4.8.2", "tzlocal==2.1"],
  "version": "2.1.8"
}

@reotto613
Copy link
Author

OK, this is likely less a problem with 2021.8.7 as such, more that because of the upgrade it pulled down a new version of tzlocal which released a new version on the 13th August which changes the structure of the data returned. This then means the O365 module breaks, causing the HA O365 Integration to break. You can work around this for now by updating the manifest.json for O365 as below. I don't guarantee this is a permanent fix, because if someone (particularly in the Core) decides they want to use the features of tzlocal 3.0, then there will be a conflict of versions. However, it should give an opportunity for the owner of O365 module to fix the solution. A very similar issuer has been reported here - O365/python-o365#670

{
  "domain": "o365",
  "name": "Office 365 Calendar",
  "documentation": "https://github.com/PTST/O365Calendar-HomeAssistant",
  "dependencies": ["configurator", "http"],
  "codeowners": ["@PTST"],
  "requirements": ["O365==2.0.9", "BeautifulSoup4==4.8.2", "tzlocal==2.1"],
  "version": "2.1.8"
}

Thank you sir. Worked perfect. Thanks.

@uSlackr
Copy link

uSlackr commented Aug 17, 2021 via email

@mdegat01
Copy link

OK, this is likely less a problem with 2021.8.7 as such, more that because of the upgrade it pulled down a new version of tzlocal which released a new version on the 13th August which changes the structure of the data returned. This then means the O365 module breaks, causing the HA O365 Integration to break. You can work around this for now by updating the manifest.json for O365 as below. I don't guarantee this is a permanent fix, because if someone (particularly in the Core) decides they want to use the features of tzlocal 3.0, then there will be a conflict of versions. However, it should give an opportunity for the owner of O365 module to fix the solution. A very similar issuer has been reported here - O365/python-o365#670

{
  "domain": "o365",
  "name": "Office 365 Calendar",
  "documentation": "https://github.com/PTST/O365Calendar-HomeAssistant",
  "dependencies": ["configurator", "http"],
  "codeowners": ["@PTST"],
  "requirements": ["O365==2.0.9", "BeautifulSoup4==4.8.2", "tzlocal==2.1"],
  "version": "2.1.8"
}

Thanks for this, this worked for me. Although I did make one tweak, in order to get HA to recognize the new manifest I had to change the version number. I set it to 2.1.8.1 and then it was working again after the restart. I assume a reinstall of the component would get around this as well, was just hoping to preserve my configuration.

@re-1st
Copy link

re-1st commented Aug 25, 2021

OK, this is likely less a problem with 2021.8.7 as such, more that because of the upgrade it pulled down a new version of tzlocal which released a new version on the 13th August which changes the structure of the data returned. This then means the O365 module breaks, causing the HA O365 Integration to break. You can work around this for now by updating the manifest.json for O365 as below. I don't guarantee this is a permanent fix, because if someone (particularly in the Core) decides they want to use the features of tzlocal 3.0, then there will be a conflict of versions. However, it should give an opportunity for the owner of O365 module to fix the solution. A very similar issuer has been reported here - O365/python-o365#670

{
  "domain": "o365",
  "name": "Office 365 Calendar",
  "documentation": "https://github.com/PTST/O365Calendar-HomeAssistant",
  "dependencies": ["configurator", "http"],
  "codeowners": ["@PTST"],
  "requirements": ["O365==2.0.9", "BeautifulSoup4==4.8.2", "tzlocal==2.1"],
  "version": "2.1.8"
}

thank you sir

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

No branches or pull requests

6 participants