djtimca / hagooglewifi

Home Assistant integration for Google Wifi systems.
Apache License 2.0
79 stars 26 forks source link

After restarting HASS all devices are showing as unknown #18

Closed rothman857 closed 3 years ago

rothman857 commented 3 years ago

Supervisor 2020.12.7; Home Assistant OS 5.8; RPi 3

After restarting HASS all devices are showing as unknown. The only fix is to remove and reconfigure. I see many log items corresponding to network devices:

2020-12-26 12:16:22 ERROR (MainThread) [homeassistant.components.device_tracker] Platform googlewifi does not generate unique IDs. ID 5D448C27F353C88E5A7D3DDF795547FF7945901918DEAB3C5EA6D54DA57D8B89 already exists - ignoring device_tracker.amazon

I also see: 2020-12-26 12:19:50 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Google Wifi for googlewifi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 236, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/googlewifi/__init__.py", line 61, in async_setup_entry await api.connect() File "/usr/local/lib/python3.8/site-packages/googlewifi/__init__.py", line 171, in connect success = await self.get_api_token() File "/usr/local/lib/python3.8/site-packages/googlewifi/__init__.py", line 148, in get_api_token await self.get_access_token() File "/usr/local/lib/python3.8/site-packages/googlewifi/__init__.py", line 140, in get_access_token response = await self.post_api(url, headers, payload) File "/usr/local/lib/python3.8/site-packages/googlewifi/__init__.py", line 37, in post_api async with self._session.post( File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1124, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 626, in _request break File "/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py", line 656, in __exit__ raise asyncio.TimeoutError from None asyncio.exceptions.TimeoutError

I'd be happy to help T/S and provide additional logging.

djtimca commented 3 years ago

It looks like an authentication error, but not something I can recreate here.

Can you try getting a new API token using the tool and reconfigure the integration? You may want to remove, reboot, and reinstall the integration to be sure.

All platforms use a common entity which specifies a unique_id so it looks like something may have gone a bit odd on your system.

rothman857 commented 3 years ago

Sorry for the late reply, but I've had no luck. I've re-created new API tokens, and re-installed the integration, and I'm still getting the above asyncio.exceptions.TimeoutError. Are there any other logs/information from the google end I can look through/provide?

djtimca commented 3 years ago

Unfortunately there isn't much more logging available. It looks like it is trying to post to the Google cloud but isn't getting any response. Sorry I can't be much more help on this one, seems unique to your environment.

The googlewifi api repo is also available here if you have an environment that you could make the calls directly to see if you get any more information/data from what is returned there.

Phoenix260 commented 3 years ago

I also have this issue. I have to delete the integration and re-enter the key after each Home assistant server restart. Not sure how to begin troubleshooting this error.

Phoenix260 commented 3 years ago

Interesting ... I think the newest Home Assistant 2021.3.0 has a function to "enabl[e]/disabl[e] integration configuration entries!". After finishing the HA restart, I just disabled & re-enabled and it seems to be working fine. So, my thoughts are that there might be too much overhead or too short a timeout for the startup to happen at the same time as the rest of the HA start. Might require more testing ...

djtimca commented 3 years ago

Not sure if you had more feedback on this. This seems like one of those issues that may be local to a few installs and is hard to track back due to the back-door APIs we are using.

Phoenix260 commented 3 years ago

It's sporadic. Just did a reboot and it worked fine without having to do the trick.

steverumsby commented 3 years ago

The same thing happened to me. After a Home Assistant restart (well, maybe not every restart, oddly, but certainly most) I would have to delete and reinstall/reconfigure the Google WiFi plugin before it would work again.

That said, I've now had to delete it permanently because of a different problem (https://community.home-assistant.io/t/google-wifi-integration-custom-component/240610/154) , so for now I'm having to live without anyway. As I said in the other discussion, this is a great plugin, and I built some really useful dashboards with it, so thanks! But sadly, I can't use it currently... ☹

Steve.