PTST / O365-HomeAssistant

Office 365 integration for Home Assistant
MIT License
69 stars 13 forks source link

Error Handling Request #123

Open reotto613 opened 3 years ago

reotto613 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

First let me say, I have no idea how this code works. But, looking at the error, can you confirm your timezone in HA is set correctly. Maybe reset it?

\Greg

From: Karl @.> Sent: Monday, August 16, 2021 11:45 AM To: @.> Cc: @.***> Subject: Re: [PTST/O365-HomeAssistant] Error Handling Request (#123)

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'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPTST%2FO365-HomeAssistant%2Fissues%2F123%23issuecomment-899614787&data=04%7C01%7C%7Cb73aa451f43e4ec1721c08d960cced97%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637647255537266554%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HnKMZHuvO0Qqhk0AgEfrVaODQPCcnT5MFenec5npEGU%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEO6ZZCM3DUTYSGME6JUPDT5EXC5ANCNFSM5CH24LQQ&data=04%7C01%7C%7Cb73aa451f43e4ec1721c08d960cced97%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637647255537276548%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=euvEsmnJdQyUwzRSekgtF6AuAPPIrgU1LeqtwHMLAlA%3D&reserved=0.

RogerSelwyn commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

reotto613 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

https://github.com/regebro/tzlocal/issues/112

RogerSelwyn commented 3 years ago

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 - https://github.com/O365/python-o365/issues/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 commented 3 years ago

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 commented 3 years ago

I appreciate the work on this. I hope the project owner comes up for air soon. There are a number of items needing attention.

\\ Greg


From: reotto613 @.> Sent: Tuesday, August 17, 2021 2:07:48 PM To: PTST/O365-HomeAssistant @.> Cc: uSlackr @.>; Comment @.> Subject: Re: [PTST/O365-HomeAssistant] Error Handling Request (#123)

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#670https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FO365%2Fpython-o365%2Fissues%2F670&data=04%7C01%7C%7Cf2a443dd348241cf7a9608d961a9ed4d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637648204723948766%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=r1t1o777A9zMfTP0UOTetTEGtgR9wjccdDcIFhFz1Nk%3D&reserved=0

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

Thank you sir. Worked perfect. Thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FPTST%2FO365-HomeAssistant%2Fissues%2F123%23issuecomment-900520209&data=04%7C01%7C%7Cf2a443dd348241cf7a9608d961a9ed4d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637648204723958759%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=IPDYDgeNcVEVVBWyVZ%2BU9zBTi4VZh6%2Buy5uGq2q6Jqc%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGEO6Z6FUOIYFIE3NYWIXP3T5KQPJANCNFSM5CH24LQQ&data=04%7C01%7C%7Cf2a443dd348241cf7a9608d961a9ed4d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637648204723958759%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Omye9gzKcLQ5PsU%2Bm4ks8qbOp2Q1pBOnt0%2BmONlrSeg%3D&reserved=0.

mdegat01 commented 3 years ago

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 commented 3 years ago

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