I’ve placed this thread in the “Bindings” category for obvious reasons
This API gives us an opportunity to (e.g.):
get alarms and timers
get/set Assistant notifications
set night mode
get device settings
set bluetooth discoverable
etc.
The API is not officially published. It’s a result of manual network scanning. Shout out to the authors!
I’ll play around with the API in my local openHAB and see what we can do with it!
In the meantime we can think of a binding for that! I think googlehome or googlehomecontrol would be a proper name
for that. Is there anyone who would like to code one? I’m setting up a branch with binding skeleton
EDIT: The port is 8008, so you need to send a POST or GET request (e.g. with Postman) to the following endpoint:
Little things like this want to make me sell all my alexa devices and switch to google home instead. Even if its a small API, the fact that this is useable locally, makes it really attractive.
Thanks for the post!
You actually can already Google Home has a Chromecast inside, so you can use Chromecast binding and treat GHome as an Audio Sink.
From there you can simply add a rule:
rule "The garage is still open"
when
Something happened
then
say("The garage is still open")
end
Note that you’ll need to set up a TTS service in openHAB (like VoiceRSS, PollyTTS etc).
Hi,
I was wondering if there are any news on this project. I just tried to to install the binding from github by creating a jar file and placing that in the addons folder. However, I guess, that is not the correct way, as I cannot find the binding in the paper UI.
This binding’s functionality would be quite different from the Google Assistant Action.
Best wishes,
Johannes
May I bring this topic up again? Does this API still work for you?
I recently tried to use it however I got stuck at getting the required authentication tokens. Before I invest more time into this I’d like to know if it’s worth it or if the API is not available anymore.
Edit: I got the API working and can communicate with my Nest Hub successfully. If anyone comes across this in the future an has questions hit me up
Understandable! I failed to get this API to work three times. Only after many many google searches and trial and error I got it working.
I am writing this now since tomorrow I will switch back to Alexa for my smart speakers.
If you have any questions let me know. Also I want to add that the developer/the guy who found the API is alive and reachable via email. I found it on his github. I once wrote him and he answered to me in about half a day.
I created a github repository to include all needed files and my experience. You can find it here.
Hi @Felix_Schneider, thank you for your detailed git repo! I just discovered this unofficial API whichs offers great possibilities if successfully implemented. I finished reading through yours and author’s documentation, and an a-to-z openhab binding seems delicate due to new authentification methods. By the way, I’m still googling / trying to use your first script, get_master_and_access_tokens.py, which returns the error “Provide an android_id”. Do you know if it is related to the " Local Authorization Token" as documented by the author or have you encountered a similar issue ?
Thank you for your time.
I didn’t encounter this issue. However looking at the code this issue has to be before the lokal auth token is used.
I printed my android id out for testing. Maybe you can test using this one instead of calling _get_android_id()
Do you get any import errors? In line 13 getmac is imported (from uuid import getnode as getmac)and used later to get the id. If the import doesn’t work the script can’t get the id.
Thank you fr your help! I did notice the import line 13, I tried to “pip install uuid” without success (it installed the module but did not solve the issue). I should have included the full output, I’m sorry. No import errors, here it is :
~/Git/GoogleHomeApi$ python3 get_master_and_access_tokens.py
Traceback (most recent call last):
File "get_master_and_access_tokens.py", line 78, in <module>
device_id = _get_android_id()
File "get_master_and_access_tokens.py", line 58, in _get_android_id
raise OSError("a valid MAC could not be determined."
OSError: a valid MAC could not be determined. Provide an android_id (and be sure to provide the same one on future runs).
Do you know how this Id is obtained ? My IoT devices, including the two google home, are on a separate subnet.
I used your Android Id (Device Id) and I’m actually getting master and access tokens. I have to test if I can get a local auth token for my device with them (maybe device id validation is only happening when requesting the first tokens…). I have to recompile grpcurl first!
No, sadly not. However you may google what the imported function from uuid import getnode does.
You’ll have to see if this works for you. However I am pretty optimistic it does. The script only communicates with googles servers and if you are able to communicate with your Google homes you should be golden.
When you do get these tokens you should get the lokal tokens and be able to communiate with your devices.
Hi Felix,
thanks for your support - last year … I finally came around to give this another try and now it works for me Basically, my intention is the same as yours, get the alarms and timers. Ideally, I want to capture the alarm set as part of the “good night” routine, and in the morning slowly increase the brightness of the lights in the bedroom, before the alarm sounds. Let’s see, if I can get this to work.
Best wishes
In regards to @Potjoe : I had the same issue and just put in the mac address of a google home mini … I don’t think that’s the proper solution, but it worked for me.