natekspencer / hacs-vivint

Home Assistant integration for a Vivint home security system.
MIT License
66 stars 4 forks source link

Error with integration after upgrade to HA 2023.3 #84

Closed clearscreen closed 1 year ago

clearscreen commented 1 year ago

This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/vivint/hub.py:95 Integration: Vivint (documentation, issues) First occurred: 3:50:22 PM (2 occurrences) Last logged: 4:04:54 PM

Error setting up entry email@address.com for vivint Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/vivint/init.py", line 53, in async_setup_entry await hub.login(load_devices=True, subscribe_for_realtime_updates=True) File "/config/custom_components/vivint/hub.py", line 95, in login await self.account.connect( File "/usr/local/lib/python3.10/site-packages/vivintpy/account.py", line 65, in connect authuser_data = await self.vivintskyapi.connect() File "/usr/local/lib/python3.10/site-packages/vivintpy/vivintskyapi.py", line 61, in connect if self.__has_custom_client_session and self.is_session_valid(): File "/usr/local/lib/python3.10/site-packages/vivintpy/vivintskyapi.py", line 56, in is_session_valid cookies = self.__client_session.cookie_jar.filter_cookies(VIVINT_API_ENDPOINT) File "/usr/local/lib/python3.10/site-packages/aiohttp/cookiejar.py", line 239, in filter_cookies self._do_expiration() File "/usr/local/lib/python3.10/site-packages/aiohttp/cookiejar.py", line 150, in _do_expiration self.clear(lambda x: False) File "/usr/local/lib/python3.10/site-packages/aiohttp/cookiejar.py", line 115, in clear for (domain, path), cookie in self._cookies.items(): ValueError: too many values to unpack (expected 2)

natekspencer commented 1 year ago

You will need to check to see if there is ".vivintpy_cache.pickle" file in your config directory and delete it or uninstall the integration and then reinstall it to clear that file. The error stems from loading a cached file with cookies, which was used to avoid having to frequently re-authenticate with Vivint, but aiohttp 3.8.4 stores them as tuples instead of a string: https://github.com/aio-libs/aiohttp/issues/7216

clearscreen commented 1 year ago

image

There were two of them in the config directory. Deleted both of them, then reloaded the integration via the UI and now we're good!

You rock, thanks!

natekspencer commented 1 year ago

Yeah, I'm realizing now I should use the aiohttp version dynamically in that file instead of the vivintpy version since it is related to the aiohttp upgrade only from that bug I referenced.

markmanxp commented 1 year ago

I followed the advice above difference being I only had one cache file. After deleting it and reloading issue persisted. Plan B was to uninstall and reload. After entering username and password at prompt I get Unexpected Error. I've tried multiple times. I've reset my password and can sign onto the native vivint app and website fine. Any ideas? More beer errrr coffee on its way.

ebotty commented 1 year ago

I followed the advice above difference being I only had one cache file. After deleting it and reloading issue persisted. Plan B was to uninstall and reload. After entering username and password at prompt I get Unexpected Error. ...

Same. Any other suggestions on how to fix this?

natekspencer commented 1 year ago

@markmanxp / @ebotty Can you verify both your HA version as well as the version of this integration? And enable debug logging and post all related logs.

ebotty commented 1 year ago

Sure thing. First, though, an update: last night, i worked at this some more. After rebooting my HA system, I tried again to add Vivint. The config wizard took several minutes to start, but when it finally did, I was able to successfully add the integration, and everything appears to be working now.

I'm on HA 2023.3.1. I've enabled debug logging for the integration, but I'm a bit of a novice and unsure where to find these logs. They're not in System > Logs.

bateschris commented 1 year ago

For what it's worth, I had the same issue, but realized this morning that I had to manually update the addin in HACS, then it worked fine.

Thanks!

natekspencer commented 1 year ago

Yes, the latest version of this integration (2023.3.0) is required to work with HA 2023.3+

markmanxp commented 1 year ago

@markmanxp / @ebotty Can you verify both your HA version as well as the version of this integration? And enable debug logging and post all related logs.

Before I had a chance to read your suggestion here, I ended up reloading the integration manually and then was able to get it to prompt me for my credentials and mfa. the cameras wouldn't load until I rebooted the vivint panel but for now all is back and wonderful once again. Thank you.