Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity/Sensor becomes unavailable after 30 seconds #71

Open
Normanras opened this issue Jun 26, 2023 · 3 comments
Open

Entity/Sensor becomes unavailable after 30 seconds #71

Normanras opened this issue Jun 26, 2023 · 3 comments

Comments

@Normanras
Copy link
Contributor

Issue: After adding the integration to a fresh install of Home Assistant, it connects to zoom as expected and I can trigger the different status for the various scopes selected in the Zoom App/Setup. After 30 seconds or after leaving a meeting, whichever comes first, the status of the entity becomes unavailable and doesn't ever come back. Enabling debug mode shows a 400 Bad Request response to one of the API calls, but what's strange is the debug log shows the new changes in status from Zoom as log entries. It just doesn't update the status/entity.

Log: This includes the error plus the validated status right after:

Traceback (most recent call last):
  File "/config/custom_components/zoom/binary_sensor.py", line 164, in async_added_to_hass
    self._profile = await self._api.async_get_contact_user_profile(self.id)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/zoom/api.py", line 37, in async_get_contact_user_profile
    resp = await self._oauth_session.async_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 510, in async_request
    return await async_oauth2_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 524, in async_oauth2_request
    return await session.request(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 643, in _request
    resp.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api.zoom.us/v2/chat/users/me/contacts/{alphanumeric}?query_presence_status=true')
2023-06-26 16:47:30.294 DEBUG (MainThread) [custom_components.zoom.common] Received validated Zoom event for config entry {alphanumeric}: {'event': 'meeting.started', 'payload': {'account_id': '{alphanumeric}', 'object': {'duration': 826951780, 'start_time': '2023-06-26T20:47:26Z', 'timezone': '', 'topic': "Norm's Zoom Meeting", 'id': '{alphanumeric}', 'type': 1, 'uuid': '{alphanumeric}', 'host_id': '{alphanumeric}'}}, 'event_ts': {alphanumeric}}

The first weird part is that I tried the same exact call in Postman, and got no errors. I thought maybe the integration was grabbing a bad OAuth token, but even when doing that, the error code was different and not the 400 Bad Request. Also, @raman325 's code and and calls align perfectly with Zoom's API Docs. So that was all confusing.

I tried a bunch of changes to the function in the component but none of them changed the behavior. In the end, I commented out the function query_presence_status API call and can see everything working as expected. The only thing I won't get is anything from the status updates in Zoom. But I still get Online, Offline, In_Meeting, Available, etc. So it may just be minor and we could potentially remove this from the code completely.

I'll try a few more things in the coming days and open a PR if necessary. If anyone stumbles upon this, can you please comment and let me know if you're experiencing the same thing?

@zenstrukt
Copy link

I'm getting the exact same issue - workaround hasn't necessarily worked for me :(

@zenstrukt
Copy link

I had a bit more of a play with this one. Seems that once you have the necessary scopes in play - it doesn't die out.
I did NOT have the first one before.

image

@raman325
Copy link
Owner

raman325 commented Oct 5, 2023

I have more or less abandoned this integration because I no longer have a need for it. With that being said, I will try to dedicate some time to addressing some of the existing issues because I know they've been a struggle for people.

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

No branches or pull requests

3 participants