Google Home device integration for the Gekko package. Controls lights and
plugs via the Google Home API and logs inbound device state change events
from Google Cloud Pub/Sub to def_google_home_events.
| Table |
Purpose |
def_google_home_devices |
Device registry — synced from Google Home graph |
def_google_home_events |
Inbound event log from Pub/Sub |
| Key |
Description |
client_id |
Google OAuth 2.0 client ID |
client_secret |
Google OAuth 2.0 client secret |
project_id |
Google Cloud project ID |
pubsub_subscription |
Full Pub/Sub subscription resource name |
device_workflow |
Axion workflow code triggered on inbound events |
token_file |
Path to cached token JSON (local.documents/gekko/) |
svc = ObjServiceApi(db)
context = svc.process({
"device_id": "DEVICE_ID_HERE",
"command": "on", # on / off / brightness
"brightness": 75, # only for command=brightness
})
# context["_google_home"] == "ok" or "error"
# List and sync all devices
python factory.service/package.gekko/ObjServiceGoogleHome.py list-devices
# Turn a device on or off
python factory.service/package.gekko/ObjServiceGoogleHome.py turn-on DEVICE_ID
python factory.service/package.gekko/ObjServiceGoogleHome.py turn-off DEVICE_ID
# Set brightness
python factory.service/package.gekko/ObjServiceGoogleHome.py brightness DEVICE_ID 60
# Start the full event polling + token refresh service
python ServeGoogleHome.py serve
# One-shot device sync only
python ServeGoogleHome.py sync
See resource.notes/package.gekko/google_home_setup.md for the full
step-by-step Google Cloud console setup. The short version:
- Create a Google Cloud project
- Enable the Smart Device Management API and HomeGraph API
- Create OAuth 2.0 credentials (Web Application)
- Complete the consent flow once to get a refresh token
- Save the token to
local.documents/gekko/google_home_token.json
- Token file is loaded on first instantiation
- Refreshed automatically when within 60 seconds of expiry
ServeGoogleHome.token_loop proactively refreshes every 55 minutes
| Trait |
Command |
Devices |
action.devices.traits.OnOff |
on / off |
Lights, plugs |
action.devices.traits.Brightness |
brightness |
Lights |
ServeGoogleHome.py — long-running entry point
factory.service/package.gekko/ObjServiceGoogleHome.yaml — schema
resource.notes/package.gekko/google_home_setup.md — setup guide
config.yaml → gekko.google_home — credentials