cancel
Showing results for 
Search instead for 
Did you mean: 
Replies are disabled for this topic. Start a new one or visit our Help Center.

Getting more info from your Google Nest Wifi Pro devices

gjouret
Community Member

As per my previous post, since the Google Home app is inherently unreliable for detecting and reporting on the status of Google's pods, I've found that there are some APIs that worked with the first generation Google Wifi products that continue to work with the Nest Wifi pro pods. The most useful one appears to be:

There's information on this API here: https://gist.github.com/Zenexer/e1c03b87fee6236c71e4fefcb1ff73a9#request-9

It returns a JSON file in the format below (testwifi.here appears to resolve to the IP address of the pod that is acting as the router. You can substitute it with the IP addresses of your other pods and get a similar result. I've highlighted in bold two key attributes that are worth tracking. If you use Google Chrome, you can install an extension that makes it easy to call this API and get the status: https://github.com/semenko/chrome-status-monitor-for-google-wifi

{
   "dns": {
      "mode": "custom",
      "servers": [ "1.1.1.1", "1.0.0.1" ]
   },
   "setupState": "GWIFI_OOBE_COMPLETE",
   "software": {
      "blockingUpdate": 1,
      "softwareVersion": "1.63.327820",
      "updateChannel": "stable-channel",
      "updateNewVersion": "0.0.0.0",
      "updateProgress": 0.0,
      "updateRequired": false,
      "updateStatus": "idle"
   },
   "system": {
      "countryCode": "us",
      "groupRole": "root",
      "hardwareId": "SIROCCO MP-MP-SAMS3130461501-SAMS3130752900",
      "lan0Link": true,
      "ledAnimation": "CONNECTED",
      "ledIntensity": 30,
      "modelId": "SIROCCO",
      "oobeDetailedStatus": "OOBE_COMPLETE",
      "uptime": 32179
   },
   "vorlonInfo": {
      "migrationMode": "voobed"
   },
   "wan": {
      "captivePortal": false,
      "ethernetLink": true,
      "gatewayIpAddress": "172.125.76.1",
      "invalidCredentials": false,
      "ipAddress": true,
      "ipMethod": "dhcp",
      "ipPrefixLength": 22,
      "leaseDurationSeconds": 600,
      "localIpAddress": "172.125.76.132",
      "nameServers": [ "192.168.1.254" ],
      "online": true,
      "pppoeDetected": false,
      "vlanScanAttemptCount": 0,
      "vlanScanComplete": true
   }
}

Here is a Python script that will poll your pods every minute, writing the status result (and a timestamp) to a log file (change {yourid} to where you want to run the script & have the log files be stored). Update the device_ips to the IP addresses of your pods (if not running this on a Mac, then you can comment out the line that sends a Notification (osascript😞

 

#
# Nest Monitoring
#
import requests
import json
import schedule
import time
import sys
import subprocess
from datetime import datetime
import os

log_folder = "/Users/{yourid}/Documents/Programming/Python/Nest"
device_ips = ["192.168.86.1", "192.168.86.41", "192.168.86.21"]
log_files = [ip + ".log" for ip in device_ips]

def poll_devices():
    global device_ips
    global log_files
    for device_ip, log_file in zip(device_ips, log_files):
        try:
            response = requests.get(f"http://{device_ip}/api/v1/status")
            json_response = json.loads(response.text)
            with open(os.path.join(log_folder, log_file), "a") as log_file:
                log_file.write(f"[{datetime.now()}] {json.dumps(json_response)}\n")
        except Exception as e:
            message = f"Error: Device {device_ip} not reachable. {e}\n"
            sys.stderr.write(message)
            subprocess.run(["osascript", "-e", f'display notification "{message}" with title "Device Error"'])

schedule.every(1).minutes.do(poll_devices)

while True:
    schedule.run_pending()
    time.sleep(1)

 

log files are named 192.168.86.1.log, etc. Here's a second Python script that reads these log files and looks for when the online attribute is no longer True or when the led indicates it is no longer connected ledAnimation ≠ CONNECTED (for my two pods that are acting as bridged access points with backhaul via ethernet, the ethernetLink attribute is reporting False, so that attribute can't be relied upon to report when that link appears to be down):

 

#
# Nest loganalysis
#
import os
import json
from datetime import datetime

log_folder = "/Users/{yourid}/Documents/Programming/Python/Nest"

for log_file in os.listdir(log_folder):
    if log_file.endswith(".log"):
        with open(os.path.join(log_folder, log_file)) as json_file:
            for line in json_file:
                timestamp, json_str = line.strip().split("]", 1)
                json_data = json.loads(json_str)
                log_time = datetime.strptime(timestamp[1:], "%Y-%m-%d %H:%M:%S.%f")
                if json_data['system']['ledAnimation'] != "CONNECTED" or json_data['wan']['online'] != True:
                    print(f"Error: Device {log_file} status is not as expected at {log_time}")

 

If anyone knows of a better way to do some monitoring/logging--please let me know.

4 REPLIES 4

David_K
Platinum Product Expert
Platinum Product Expert

This is really cool, thanks for sharing!

AbigailF
Community Specialist
Community Specialist

Hey folks, 

Thanks for lending a hand, @David_K.
@gjouret, I wanted to follow up and see if you are still in need of any help. Please let me know if you are still having any concerns or questions from here, as I would be happy to take a closer look and assist you further.

Thanks,
Abi

AbigailF
Community Specialist
Community Specialist

Hi gjouret,

Checking back in should you still have some questions here. Let us know by replying to this thread. 

Best, 
Abi

AbigailF
Community Specialist
Community Specialist

Hello everyone,

We haven't heard from you in a while so we'll be locking this thread if there is no update within 24 hours. If you have any new issues, updates or just a discussion topic, feel free to start a new thread in the Community.

Regards, 
Abi