r/googlehome•
TurnTM

Use the API on your Google Home to view things like alarms, music playing, volume,...

I'm not sure if this is common knowledge but I've never came across anything while searching Google.

Basically, you can call the API on your Google Home to get info about things like alarms in JSON format. For example, I'll use this to display current alarms and timers on a screen in the same room as the Google Home.

How to do it: First you'll need to find the IP address of your Google Home. You can use something like Fling (Android app) for this or just log in to your router. Then make a simple GET call like this: http://192.168.X.XX:8008/setup/assistant/alarms. Change 192.168.X.XX to your IP.

This will give a response like this:

{"alarm":[{"date_pattern":{"day":15,"month":1,"year":2018},"fire_time":1515995400000.0,"id":"alarm/5a77ecee-0000-24fd-9251-001a114cb4cc","status":1,"time_pattern":{"hour":6,"minute":50,"second":0}}],"timer":[]}

I'm not sure what other calls you can make but I'm pretty sure you should be able to call everything that the Google Home App is able to display (i.e. current music). You can use an app like Packet Capture and hook it into the Google Home app to find out about other API calls it makes.

Hope this was useful to someone!

Edit: While looking a bit more into the API, I found the following values:

{"ble_supported":true,"bluetooth_audio_sink_supported":true,"bluetooth_audio_source_supported":false,"bluetooth_supported":true}

Could this mean using the Google Home as bluetooth source instead of bluetooth sink is or will be possible?

Posted Jan 15, 2018, 1:11 AM UTC · edited

7123
rithvikvibhu•

Awesome! Never thought of checking this. Will try to find more endpoints when I get back home.

5
TurnTMOP•

Nice! Let me know if you find any!

2
rithvikvibhu•

Goodie! Found some and they seem useful. Going to create a repo on GitHub to document this. Anyone willing to contribute, please let me know

Edit: Worked on this: https://rithvikvibhu.github.io/GHLocalApi/ Can you guys test it out and add more stuff? u/henrylim96 u/TurnTM u/insureventures u/roflcoopter1

6
henrylim96•

Wow good find! Super useful for me as I am building a smart digital clock using Android Things! (currently able to show what song is casting) https://medium.com/@limhenry/diy-android-things-smart-digital-clock-e6e79d26a3bb

(update) * to get what song is casting, you actually can use Google Cast API to do that. It works on all cast-supported devices. And you can use that API to get other info like current volume, set volume, next track, previous track, etc.

and this is the method i am using for the digital clock: https://stackoverflow.com/questions/38269861/android-get-current-playing-media-on-chromecast / https://developers.google.com/cast/v2/android_sender

since google home is also a chromecast device, some endpoints are actually same as the "normal chromecast", you should able to find some from google :)

2
neuromonkeyHEY GOOGLE! GIVE ME SOME FLAIR!•

You are godlike and I want to kiss you.

...in a totally Platonic, you are an awesome nerd sort of way. No hobo.

1
TurnTMOP•

Definitely! I'll help out!

1
insureventures•

Nice. Im in.

1
[deleted]•

[deleted]

1
roflcoopter1•

I'd also like to contribute!

1
henrylim96•

More HTTP endpoints (but not really useful) : https://www.iot-tests.org/2017/09/ok-google-home-what-about-privacy/

and u can get gHome device info: http://<ip_address>:8008/setup/eureka_info?params=version,name,build_info,device_info,net,setup,settings,opt_in,opencast,multizone&options=detail

since the request between the google home app and google home is not encrypted, i think we should able to use wireshark to get all possible http endpoints/url right?

2
rithvikvibhu•

Thanks! I see more in my logs than that. New features since 9-2017 I think.

1
WYkkYD666GH | CC | CCA | Wink | Home Assistant•

Great find! I'm going to have to add this to my Home Assistant frontend so I can get a quick summary of alarms and timers. Would be cool if you could set one as well, have you looked into that?

3
TurnTMOP•

No problem! I've looked into it but I'm 99% sure it's not possible right now. Good rule of thumb: everything that's possible to do within the Google Home app is possible to do with API calls.

If this is really important to you, you could set up something like a Raspberry Pi next to the home, record a .mp3 file of yourself saying "Set a timer for 7am" and make the Pi play this file when you tell it to do so.

1
algag•

You can get the IP address of your cast devices in the Google Home App:
Home App>Hamburger Menu>Devices>Three Dot Menu of the Device>Settings>Scroll Down

2
roflcoopter1•

Interesting! I wonder what other information we could access. Maybe the shopping list?

1
TurnTMOP•

Should be anything within the Google Home app + maybe more! I'm sure there's tools out there to find more endpoints but I'm not very familiar with them.

1
klausita•

Like this we could have a local shopping list

1
TurnTMOP•

The shopping list is not saved on the Google Home but on your Google Account. Should still be able to fetch it though, I'll check it for you.

1
henrylim96•
1
TurnTMOP•

This simply says there's no official API. The API I just posted isn't official either. Anything that can be fetched by an app can be fetched with API calls that mimic this app. Difficulty varies though and it'll definitely be a lot tougher for the Shopping List since it isn't stored on a device in your network.

1
fodder69•

You ever get a chance to look at this? Would be interested in trying to integrate it with the HA shopping list

1
mmaceGHM Charcoal•

This is great, thank you!

1
TurnTMOP•

Glad it was useful!

1
kaikaikaisauce•

Could I be able to turn off alarms through this? I use my GH as my alarm clock, the part that wakes me up is screaming "OKAY GOOGLE"

1
TurnTMOP•

You should be able to cancel them before they go off, but I'm not sure about when they're going off already. I'll check it for you.

Also, can't you just tap the top of the GH to cancel an alarm when it's going off?

1
kaikaikaisauce•

i assumed the button was permanently disabled unless you enroll fro beta?

1