Google Wifi Integration (Custom Component)

I have now just experienced my first dropout, an orange flashing light that was fixed with a reboot. Original Google pucks

Hi @djtimca, mine Google Wifi is dropping also each two days in average.
My case, the router is dropping entirely blinking red led until I restart it.
I seems that started to occur one week ago with one of custom component update.

Follow the errors found at the logs:

2020-12-15 09:41:47 ERROR (MainThread) [custom_components.googlewifi] Error fetching GoogleWifi data: Error connecting to GoogleWifi:
2020-12-15 12:33:34 ERROR (MainThread) [custom_components.googlewifi] Unexpected error fetching GoogleWifi data: ‘NoneType’ object is not iterable
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py”, line 144, in async_refresh
self.data = await self._async_update_data()
File “/config/custom_components/googlewifi/init.py”, line 171, in _async_update_data
system_data = await self.api.get_systems()
File “/usr/local/lib/python3.8/site-packages/googlewifi/init.py”, line 191, in get_systems
return await self.structure_systems(response)
File “/usr/local/lib/python3.8/site-packages/googlewifi/init.py”, line 289, in structure_systems
for this_station in system_metrics.get(“stationMetrics”):
TypeError: ‘NoneType’ object is not iterable

Sergio, Hi there. I am trying to get a similar effect to what you showed here. I am using this template code
‘’’
dec_phone_template:
friendly_name: “Dec Phone (template ver)”
unique_id: dec_phone_template_entity
value_template: “{{ state_attr(‘device_tracker.decpixel5’, ‘connected_ap’) }}”
‘’’
(not sure if spacing pasted correctly, but it creates a sensor correctly in HA)

But the sensor always shows “Unknown”. Am a bit lost as to how to troubeleshoot. It is doing the same for 3 other phone devices setup in the same way

Hi @deccos,

Not really sure why its not working on your side.
What I realised is that my Google home creates multiple entries for each of my devices, which is why this is being hard to maintain on my side.

The best way to debug this, is to go do “Developer Tools - > Template” and try with something simmilar to:

{{state_attr('device_tracker.iphone12desergio', 'connected_ap')}}


It should provide you the correct response and will help you debug.

In the “Developer Tools -> States” you should be seeing your entity like this:

I hope this method helps!

I think I am having the same issues, just removed the component and didn’t have any issues in the past 48 house.

For anyone having dropouts try reducing the refresh interval in options and then restart Home Assistant. Not sure if too frequent an update may be causing this. Unfortunately the data all comes from the cloud since there doesn’t appear to be a local API.

I can confirm I’ve experienced daily dropouts too. Main puck pulsates orange as if it has lost connection even though the modem before it still has a solid connection. Only a power cycle brings it back.

I’ve now increased the polling time to 120s and will monitor to see if it improves it. I had 3s on first install of the integration, and then increased to 30s but the issue still persisted so hoping the larger time makes a difference.

Really love the integration you built @djtimca, thanks for all the work you’ve put into this

3 Likes

Thanks @marcelod.

Still not seeing that here with 60+ wifi devices connected. I get periodic issues with devices dropping off the network, but I think that has more to do with the # of devices than anything else (has been happening for months, long before this integration).

I have been experimenting with scheduling a reboot every day at 2am to try to fix that device drop-out issue which seems to have helped significantly with that issue.

1 Like

I’m not sure what I’m doing wrong here but after I sign in using the URL in step 2 it redirects me to https://accounts.google.com/embedded/close which doesn’t do anything. Where do you get the oauth_code cookie?

Highly recommend you use the Chrome Browser plugin rather than trying to do it via web. Significantly easier to get what you need.

I’ve added the plugin but it doesn’t seem to really do anything.

Nevermind. Tried it on my my old pc and it worked fine. Idk if the fact it was a mac was the problem or not but it worked.

1 Like

I have installed the addon, and it’s working.
When I switch off a device, it turns on immediately after.
Is there a quick solution to that?

Any errors in the logs?

This is the error I get in the log:

Logger: homeassistant.helpers.service
Source: helpers/service.py:102
First occurred: 30. december 2020 18.44.49 (24 occurrences)
Last logged: 8.02.52

* Unable to find referenced entities switch.marco_chromecast_chromecast
* Unable to find referenced entities switch.laptop_4l1k6mbf_windows_device, switch.marco_chromecast_chromecast
* Unable to find referenced entities switch.laptop_eio3skrv_windows_device
* Unable to find referenced entities switch.huawei_p_smart_2019_4e7fb_huawei_android_device
* Unable to find referenced entities switch.laptop_4l1k6mbf_windows_device

The entities are correct, and I can see that my kid’s laptops go off when they turn them off.

A reboot of Home Assistant did the trick.
Sorry for the inconvenience.

1 Like

Only re-found this thread again today. I’m not sure how or why since it is a few weeks ago, but it started working !. Then I expericened the “red led” issue on my master puck. so have since uninstalled the integration. I may go back to it again …

What would cause all the device_tracker entities for this integration to show the state of not_home? I have had this installed for about 2 months and I have never seen any change to the home state. I have no errors in the log to report. I reinstalled this morning and all still show not_home. Do I need to add anything to the configuration file to get the device tracker to work that my not be listed on the GitHub page?

Thanks

I keep getting these in the log. Any idea why?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 126, in _handle_refresh_interval
    await self.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 200, in async_refresh
    update_callback()
  File "/config/custom_components/googlewifi/__init__.py", line 308, in _update_callback
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 295, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 316, in _async_write_ha_state
    if not self.available:
  File "/config/custom_components/googlewifi/switch.py", line 210, in available
    self.coordinator.data[self._system_id]["devices"][self._item_id].get(
KeyError: 'EEE006E66A1ADFF1E21254FAB4696069C08DDB44E8248A2A4D48EFE29375EF01'

Those can sometimes happen after the Google cloud stops tracking a device. Try either reloading the integration or restarting Home Assistant - either should reload the list of entities to track.

1 Like