Google Home - Actions (API) now available!

(Emil Blennow) #443

Currently tearing my hair out. I got everything working, restarted my node server and suddenly Google home won’t authenticate properly. It even says “Accounts now linked” but the browser doesn’t close and no SYNC requests are sent. I have verified in the oauth2 playground that the authentication on my instance is working and I have tried restarting my raspberry, reinstalling the node server and using both Chrome and Firefox in the home app. I have also tried phone reboot and reinstalling Google home app. Please advise or confirm if you are having the same issues!

(Gregory Strike) #444

Aww man, this is exactly where I’m at on this. I’ve been following this thread for months and decided to give it a go tongiht. And now I’ve been fighting this for a couple hours.

I too get the “Accounts now linked.” but then it redirects me to the Oauth2 Allow/Deny page on my openhab-cloud instance again. If I click Allow again, unfortunately, I get this error and the “[test] my test app” in the Google Home app doesn’t show up under linked services.

0|app      | GET /oauth2/js-plugin/jquery-cookie/jquery.cookie.js?_=[numbers] 404 4.808 ms - 186
0|app      | POST /oauth2/authorize/decision 302 7.017 ms - 1516
0|app      | POST /oauth2/token 200 6.048 ms - -
0|app      | GET /oauth2/js-plugin/jquery-cookie/jquery.cookie.js?_=[numbers] 404 3.579 ms - 186
0|app      | POST /oauth2/authorize/decision 403 9.827 ms - 3034
0|app      | Error
0|app      |     at transactionLoader (/var/www/
0|app      |     at Layer.handle [as handle_request] (/var/www/
0|app      |     at next (/var/www/
0|app      |     at Routes.ensureAuthenticated (/var/www/
0|app      |     at Layer.handle [as handle_request] (/var/www/
0|app      |     at next (/var/www/
0|app      |     at Route.dispatch (/var/www/
0|app      |     at Layer.handle [as handle_request] (/var/www/
0|app      |     at /var/www/
0|app      |     at Function.process_params (/var/www/
0|app      |     at next (/var/www/
0|app      |     at serveStatic (/var/www/
0|app      |     at Layer.handle [as handle_request] (/var/www/
0|app      |     at trim_prefix (/var/www/
0|app      |     at /var/www/
0|app      |     at Function.process_params (/var/www/
0|app      |     at next (/var/www/
0|app      |     at /var/www/
0|app      |     at Layer.handle [as handle_request] (/var/www/
0|app      |     at trim_prefix (/var/www/
0|app      |     at /var/www/
0|app      |     at Function.process_params (/var/www/

I thought maybe there was something cookie related going on since there was a 404 error on jquery.cookie.js. So I created a symlink in the public folder to it and it was finally able to find the file. But I still had the same issue, so unfortunately, that wasn’t it.

I verified my oauth2 in the Oauth2 Playground, it seemed to work… But just doesn’t want to work with the Google Home app. Anyone have any ideas what would be causing this?


(Elmar Seestädt) #445

Exactly where I’m as well … it used to work - but I had a (yet unidentified) problem with my items. So I decided to remove all my neatly arranged item files and start adding them one by one and reconnecting google home each time.

After I readded the third item file google home suddenly refused to work with the exact same behaviour as described above.

Google Home App either forwards my a second time to the allow/deny page or sometimes even pops up chrome with a random page I recently visited.

(Elmar Seestädt) #446

@blennster @gstrike I figured it out … it is a client side problem with the google home app. I just tried to add connect the smart home devices on my wifes smartphone and it worked like a charm (added my google account).

Now we have to figure out what exactly is stale - already tried to deinstall/reinstall google home app - without luck.

(Gregory Strike) #447

@Elmar Well that’s at least some good news! Since the Google Home app is launching Chrome to do the oauth2, I focused on that. I disabled Chrome and installed Firefox. With Firefox installed, it hangs at the “Accounts Now Linked”. I reinstalled Chrome. I cleared all browsing data in Chrome (for "All Time) with Chrome I get the same behavior.

So here’s a really strange piece… Just on a whim I decided to choose “Deny” when asked to authorize. The behavior was exactly the same, it even showed “Accounts Now Linked”. Sooo uhhh… yeah…

( -) #448


I am now at the exact same point just minutes after you @gstrike

One thing I did was that I added “timezone”: “Europe/” to the config.json which solved timezone.js errors before reaching this point with Accounts Now Linked but the app responds with “Couldn’t update settings. Configuration not changed” or something equivalent.

(Emil Blennow) #449

Holy sh*t!!!

Thank you so much @Lockzi! It was either this or the new oreo update on my OnePlus 5T that did it but it is working!

To anyone else reading this, add the “timezone”: “Europe/” to the config.json of you openhab-cloud instance and make sure the google cloud endpoint is returning response 200. It didn’t work the first try but it did the second so just keep at it.

( -) #450

Great! Glad I could help!

I am still not up and running though. I keep on getting the “Account Linking Failed” followed by “Couldn’t update the setting. Check your connection.”

Nothing being verbosed into the logs.

(Emil Blennow) #451

Nothing in the Google function logs? No response code? Just some pointers on the problems I had:

hostname should NOT have https:// and the path should be ‘/rest/items/’. Important that all of the ‘/’ are in the path otherwise the cloud function will return a 404.

Also make sure your openhab is accessible from your cloud instance. Try adding /rest/items to the url when you are logged in. There you can see the rest API and make sure everything that you want have the tag Lighting or Switchable.

Send me a message if you need anything else!

(Will Waterston) #452

Hi all, just thought I would add this in here in case anyone is considering alternatives. I was hoping to avoid using any external cloud service (except google of course) like myopenhab, since I’m in Australia and latency is an issue, plus just simply avoiding relying on external services for my openhab system to work.

I found, through various posts, hints and my own experimenting, a fairly simple solution.I created an IFTTT account, created an applet to recognise commands from my home mini, and added a url with POST request as the action, directed at my openhab running on Pine64. On the Pine I installed apache and PHP and the IFTTT applet will execute the PHP script. The PHP script can do whatever you want… right now I just have it sending MQTT publishes which openhab responds to, but I intend to expand that. The whole thing took me about 3 hours to setup and get working.It takes about 3 seconds (remember I’m in Aus) from saying a google command to having the device respond; not bad I think.

Any thoughts? Any limitations? I also intend to add a reverse proxy to increase security.

(Mehmet Arziman) #453

Cool that you guys try it!

The Google app had a lot of bugs before. Make sure you dont search only errors on your setup. Delete app or reconnect accounts with OH cloud.

Let me know if I can support.

(Gregory Strike) #454

Thanks for that! Using ‘/rest/items/’ I seemed to get me a bit further! Once I changed it to that, it looked like it was going to work, and said something along the lines of linking… Then nothing happened and it didn’t show up as a linked account. Now, I can’t get it to do it again. It’s now behaving exactly like what it was before I updated it to ‘/rest/items/’.

@MARZIMA, you are correct. It appears that there are ALOT of bugs on Google’s side. I really want to believe it’s something I’m doing wrong. But I’ve been at this for days. :slight_smile: Very frustrating. Thanks for sticking with us though!

(Dennis Persinger) #455

I’ll second this suggestion. I was having similar troubles to y’all, so I gave IFTTT a shot and it works fabulously–for me, better than a native Actions API would. For me, the chief benefit is that IFTTT can intercept any command natively. This way, I can capture any phrase and have it trigger arbitrary rules in openhab.

Similar to what @dontpanic does, I use webhooks in IFTTT to send out a POST request, however, I just go directly to the rest API in openhab (or rather, I use authenticate through an nginx reverse proxy, which hands the request off to the openhab rest api). Rather than have 45 different applets on IFTTT, I just have 5 different “master templates”, e.g. “Turn $”, “Open $”, “Close $”, “Dim $ to #”, and “Set $ to #”. These just pass to the same String Item in openhab, and I have a master rule that fires when that Item updates. This allows me to parse the phrase however I want, and all changes and additions are handled entirely within openhab.

I can supply additional info and examples of what I did, if anyone is interested. The result is rock solid and immediately responsive (at least here in the US). Note that I started off trying to use instead of my own openhab cloud instance to handle the IFTTT action (through the official openhab IFTTT action), but I found that was wildly unreliable–sometimes it would work great, sometimes I had minutes (or more) of latency. YMMV, but if you’ve got your own openhab cloud set up, I advise you to use that.

(Dennis Persinger) #456

Slight correction: I send POST requests directly to the rest api on my primary openhab instance, not the openhab cloud instance I set up (to experiment with the Actions API in this thread). Note that I still use SSL (via letsencrypt), and have a name:password (that are captured and validated by nginx), before passing on to the rest api. The approach I use does require a static ip (or dynamic DNS at least), but doesn’t require openhab cloud (I turned off mine). Also note that since this is all tied in to Google Assistant, I can issue voice commands to my phone while away from home and it will still work, since Google Assistant on the phone filters through the same IFTTT recipes that Google Home does.

(Will Waterston) #457

Hi Dennis,

yes I would like to know how to get IFTTT to go directly to openhab rest API. I know that openhab has an IFTTT binding, but again that uses, so thats not what I want.

If you could put together some info on IFTTT->rest API I would definitely try that,

(Gregory Strike) #458


So this evening I deleted my Google Project and Action and started from scratch. I rebuilt it all. I documented each step and still no go. You may have sensed my frustration in my last post, but, I had the same results. It kept asking me for oauth2 authorization.

Well due to unrelated reasons, I was trying to fall asleep and my mind was racing… I couldn’t sleep and I started thinking about this some more. I decided to to try wiping the Google Home app cache and IT WORKED! The crazy thing is that I’ve uninstalled the app many times, so why it took clearing the cache, I don’t know… But that was the last thing that got it working.

As I mentioned earlier, I also meticulously documented my steps on this rebuild. I’m hoping to have some time in the next day or two to get it cleaned up (easier to read, sensitive info sanitization) and shared for everyone.


(joris) #459

Sounds interesting, maybe you want do describe this as a tutorial in another thread?

(Jason Holmes) #460

I’ve updated the README, albeit it’s not merged yet.

Might want to see what it’s in my PR and update it if you have different steps.

(Will Waterston) #461

Hi Dennis, I haven’t gotten as far as the reverse proxy, that was going to be one of my next steps. I’m using dynamic dns ( for the link from IFTT to openhab.

If you could describe at least your IFTTT applet and how it refers to the rest interface I might be able to work out the remainder. Or, as much info on how you have done it will help of course. I have seen an article written on how to set up the reverse proxy so I can probably get that part done, but anything you can provide would be appreciated, thanks.


(Will Waterston) #462

So this is a little off topic, but I’ve been searching and come up blank. Can google home be used for general text to speech? ie, somehow send it some text and have it say it?

If nothing so simple exists, would there be a way to get openhab to use google home to make announements? say if one of my timed rules is executed, google home would announce it?