Google Wifi Integration (Custom Component)

The template sensor to track a device around the house works great!
I can already see automations to only have a kids wifi working in the living room and not in the bedroom.

Sensor template:


  - platform: template
    sensors:
      ipad_home_location:
        friendly_name: "IPad Location"
        value_template: >-
          {{ state_attr('device_tracker.sergios_ipad_pro_ipad_pro_2', 'connected_ap') }}

2 Likes

Ok last update for today 0.0.5 is up and has services on the switch platform to allow you to prioritize a device on the network (and a second to clear prioritizations). In the attributes of the switches you will find a prioritized and prioritized_end tag which gives you the details of any prioritization.

Hi Tim , i installed the latest google wifi integration 0.05 but i got this :Unexpected error fetching GoogleWifi data: ‘stationPolicies’
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 121, in _async_update_data
system_data = await self.api.get_systems()
File “/usr/local/lib/python3.8/site-packages/googlewifi/init.py”, line 142, in get_systems
return await self.structure_systems(response)
File “/usr/local/lib/python3.8/site-packages/googlewifi/init.py”, line 191, in structure_systems
for blocking_policy in this_system[“groupSettings”][“familyHubSettings”][“stationPolicies”]:
KeyError: ‘stationPolicies’

how do i fix this ?

Interesting one! I will do a little digging and probably get an update out in the morning for this one. Stay tuned!

Good morning,

I think this is algo affecting the chromecast plug-in that I am using to have my access points as media players. May be related to something like API throughout control?

Media player go to unavailable and then come back online:


Logger: pychromecast.socket_client
Source: /usr/local/lib/python3.8/site-packages/pychromecast/socket_client.py:657 
First occurred: 4:20:14 (2 occurrences) 
Last logged: 4:22:00

[Bedroom Wifi(192.168.86.31):8009] Error communicating with socket, resetting connection
[Hall Wifi(192.168.86.58):8009] Error communicating with socket, resetting connection

At the same time, this addon also suffers for connection issues:

Logger: custom_components.googlewifi
Source: custom_components/googlewifi/__init__.py:126
Integration: Google WiFi (documentation)
First occurred: 3 November 2020, 21:52:42 (28 occurrences)
Last logged: 7:18:56

Unexpected error fetching GoogleWifi data:
Traceback (most recent call last):
  File "/config/custom_components/googlewifi/__init__.py", line 121, in _async_update_data
    system_data = await self.api.get_systems()
  File "/usr/local/lib/python3.8/site-packages/googlewifi/__init__.py", line 144, in get_systems
    raise GoogleWifiException("Failed to retreive Google Wifi Data.")
googlewifi.GoogleWifiException: Failed to retreive Google Wifi Data.

The above exception was the direct cause of the following exception:

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 126, in _async_update_data
    raise PlatformNotReady from error
homeassistant.exceptions.PlatformNotReady

That’s an interesting one. Why are you running a separate component for the Chromecast feature? My Google Home/Minis and Access Points all were discovered automatically with nothing added as media players. I am not seeing this through the standard Chromecast integration. It is possible that there is a collision between these two API session accesses based on the errors in the logs. What is the plug-in you are using - I can try in my Dev environment to see if I can replicate.

Hi!

They are using the Google Cast integration:
image

How do you have yours?

Ok same here. Only one of my Wifi hotspots is the new Nest ones with built in Mini so I will watch for collisions on that. The rest of my Chromcast devices (17 of them lol) are TVs, speakers, and Chromecast Audio devices. I didn’t see any issues yesterday but will monitor that one today.

1 Like

Quick question, what does the reset really do? I’m afraid to use it :smiley:

Reset is just a soft reboot of the access point or the network. So if you are having problems with devices connecting or need to do a router reboot for whatever reason you can reset either a single access point or the whole network. (Not a factory reset, just a soft reset).

1 Like

@ramibouaoun I have updated to version 0.0.6 which includes a fix for this issue. Please let me know the results of your testing since I don’t have a configuration that will throw this error.

I have updated to version 0.0.7 which fixes an issue I noticed where the lights entitites were not being correctly assigned to the devices they belong to.

Loving this option for tracking!

I am seeing an issue where some the switches associated with the device_tracker entities show unavailable and I see this in the logs:

2020-11-04 08:41:51 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 119, in _handle_refresh_interval
    await self.async_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 193, in async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 223, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 676, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/config/custom_components/googlewifi/switch.py", line 78, in is_on
    if self.coordinator.data[self._system_id]["groupSettings"]["lanSettings"]["prioritizedStation"]["stationId"] == self._item_id:
KeyError: 'stationId'

Thanks @TheMattS - I just pushed 0.0.8 which should fix this issue for you. Please let me know if it corrects it once you test. Thanks!

1 Like

Looks much better, thanks!

thank you @djtimca it’s working now

So it turns out that my teenagers internet wasn’t turning off as designed in the Google Home/Wifi apps as it was supposed to… and the new integration flagged it for me. So now Home Assistant has control of their Wifi and they are SO happy about it. Lol.

3 Likes

I just pushed 0.0.9 which I hope solves the issue of entities going unavailable. I also added the ip_address of the device to the device_tracker entities as an attribute.

1 Like

Scratch that - the initial fix didn’t work on the unavailable issue. I took another stab at it in version 0.1.0 which seems to be working on my system correctly. Please report any testing issues here or on the github issue log.

Working flawlessly all night! Thank you very much!
Regarding “duplicate” entities, it does seem that google is storing old versions of device for a long time with no way to remove them. Just need to wait :slight_smile:

1 Like