Tuesday, January 16, 2018

The Google Home has an undocumented local API that you can now access

Google Home, Google's growing lineup of AI-powered speakers, offers a wealth of possibilities for smart home hobbyists. Problem is, it's locked down pretty tightly. When it comes accessing alarms data, settings, Bluetooth modes, and other on-device info, you've got two options: Checking the Google Home companion app on your smartphone and/or tablet, or shouting a command. As of right now, Google Home lacks a proper API.

That hasn't stopped an intrepid developer on the Google Home subreddit from piecing together one himself. Redditor rithvikvibhu painstakingly sniffed a Google Home device's traffic and recorded each network request, collating the results in a nifty cheat sheet on Github. So far, he's managed to identify local GET and POST commands for equalizer settings, device options, night mode, and more, in addition to connectivity requests that return a given speaker's Wi-Fi configuration, its supported list of timezones and locales, and the names of bonded Bluetooth devices.

It's a relatively simple process. After you've identified the IP address of your Google Home speaker by using an app like Fling, you can make GET and POST calls by appending the address with URIs in the Google Home local API documentation.

This URI, for example, grabs a list of local alarms and timers on a Google Home speaker:

  /setup/assistant/alarms  

Here's the GET call (the "X" marks are placeholders):

  http://ift.tt/2mCQaoZ  

Navigating to that address on any device connected to the same network as the Google Home will return a JSON response with the day, month, year, and time the alarm is scheduled to sound:

Source: Google Home Local API

 

This related URI returns the alarm and timer volume on a Google Home speaker:

  /setup/assistant/alarms/volume  

The POST call returns the volume level in decimal form:

  0.8199999928474426  

If you're feeling brave, this URI reboots a Google Home device:

  /setup/reboot  

The unofficial documentation for the Google Home's local API is available on rithvikvibhu's Github repository, along with the code required to use it. Keep in mind, though, that it's in no way official — don't expect the APIs to behave predictably.


Source: Google Home Local API Source 2: /r/GoogleHome



from xda-developers http://ift.tt/2DERwbe
via IFTTT

No comments:

Post a Comment