raman325 / ha-zoom-automation

Custom Home Assistant component for Zoom. Tracks when you are connected to a Zoom call by default but may allow you to track more.
MIT License
60 stars 16 forks source link

Worked but doesn't now #45

Closed npentell closed 2 years ago

npentell commented 2 years ago

I installed this yesterday and got it working. Everything was on point but after testing it out a few times it seemed like the binary_sensor wasn't updating very quickly anymore. Now, today it's showing disconnected and not working at all. Not sure what to do. I haven't updated or changed anything since yesterday. Thoughts? Should I build a new app and try again in the zoom dev? Thanks.

raman325 commented 2 years ago

Did you try removing the integration and setting it up again with the same information?

Is your HA instance accessible from the outside world?

npentell commented 2 years ago

I just did. Still no go. I also noticed that if I look at the history of the sensor, I can view the attributes. It used to have a State attribute that would show In_Meeting but now it isn't there. I see ID, First Name, Last Name, Email, and Account ID now where the State attribute used to be where Account ID is.

npentell commented 2 years ago

I am an admin for our company's zoom account. I have the following scopes added in the zoom app: Chat: Get zoom Chat contact information for all users, User:View all user information

raman325 commented 2 years ago

These are the two scopes that are needed:

I'm wondering if the scopes you added are admin only scopes and maybe that's why it's not working? Can you also verify that your verification token matches in the app and the integration?

npentell commented 2 years ago

yes, it matches. It's weird that it worked in the beginning though. I don't see any options to just pick one user instead of doing it as an admin

raman325 commented 2 years ago

yeah I'm not sure how to explain that. Do you have any errors in your logs from the integration?

npentell commented 2 years ago

are they separate from the regular logs?

raman325 commented 2 years ago

they would be in the main logs, but you will see a reference to zoom if there were any entries there.

One thing you can try is to enable debug logs for the integration using this service: https://www.home-assistant.io/integrations/logger/#service-set_level

Try starting a meeting and then check the logs to see if you see a log entry that says Received event: <event data>. If you get that then your app is set up correctly. If you don't, that means that for some reason Zoom is not sending webhooks to your HA instance. That could be because either the Zoom app is misconfigured (specifically the URLs for your HA instance) or your HA instance is not publicly accessible.

npentell commented 2 years ago

Does this help at all? ------- Triggering HTTP discovery, filter_device: None ------- 2021-12-02 22:21:45 WARNING (MainThread) [custom_components.zoom.binary_sensor] Error retrieving initial zoom status, restoring state. Traceback (most recent call last): File "/config/custom_components/zoom/binary_sensor.py", line 159, 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 35, 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 472, in async_request return await async_oauth2_request( File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 486, in async_oauth2_request return await session.request( File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 625, in _request resp.raise_for_status() File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1000, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 400, message='', url=URL('https://api.zoom.us/v2/chat/users/me/contacts/W2CQ3GM9TKOWNdq7PznIZg?query_presence_status=true')

raman325 commented 2 years ago

Interesting - this shouldn't impact the webhook functionality which pushes information to HA when you jump on or off a call but it does mean the scopes you set up are not giving the app the correct permissions. I'm not sure how to troubleshoot this further without you sharing your screen with me or something. If you are interested, find me on the HA discord and we can find some time to do that.

Can you also validate that you have this webhook configured? image

npentell commented 2 years ago

A few things.

  1. I'm happy to do a screen share anytime. I'll look up the discord and find you. Thanks in advance for everything btw
  2. I do have that webhook configured, however, In my Nabu Casa settings there is a section for Webhooks and the only one showing in there is for my phone. Should there be one in there for the zoom integration?
  3. There is an install button at the end of the app setup for zoom. I originally clicked it but it gave an error. Missing code or state parameter in https://6s8sazwjwlce03p9kcsp6bohygrzokkm.ui.nabu.casa/auth/external/callback?code=411iyBZGu5_W2CQ3GM9TKOWNdq7PznIZg Since everything was working at the time and since I didn't see anything about instaling the app in the integration wiki I figure I don't need to install it. Hope that's the case
raman325 commented 2 years ago

For 3 is that the URL that's shown as the Installation URL on that step? If you go here and click on your app, you should be able to access the menus again.

I'm pretty sure this step isn't needed. Instead you initiate the installation from HA when you set up the integration.

npentell commented 2 years ago

I agree. For some reason though, I don't think I'm getting connected up now even from the initial config in HA. I can start a zoom meeting and you can have a look at my screen anytime. Just let me know. I'll need an email address when you're ready and I can send you the zoom link. Thanks.

raman325 commented 2 years ago

can you ping me on Discrod? we can coordinate over chat. You can find me in #devs_zwave