22

I have raspberry pi controlling my garage door and I want to be able to have an action to open or close it via google home / assistant.

This action is custom and only specific to my needs and I'd like to be able to leverage google to interact with it, but I don't want to publish it for others since it is custom for me. Can this be done? I believe with Alexa it is possible and a quick browse through the docs nothing jumped out at me for this scenario.

Becker
  • 417
  • 1
  • 4
  • 12

7 Answers7

24

The accepted answer is incorrect as the OP specified publishing isn't required. It also provides a link to a different question, namely whether it's possible to retrieve personal information to use personalized actions per user.

The correct answer is yes, you can create a private action for your Google Home. You can create the action within API.ai and preview it locally on your Google Home also within API.ai. This doesn't publish your action, but rather it allows you to use your created action only on your Google Home. Here's a video that confirms this Actions on Google: Introduction to Conversation Actions

To do this, create your action within API.ai. For a screencast on how to do this, check out this video Actions on Google: Building Assistant Actions using API.AI. When you hit "Preview" in API.ai, your created action will be available in the web simulator and the Google Home device that has the same Google account as the one you're signed into API.ai with.

Prags
  • 2,457
  • 2
  • 21
  • 38
Patrick
  • 11,552
  • 7
  • 29
  • 41
  • 3
    Thank you for the detail, I will give this a shot. As I understand the issue with this approach is that the ability to test the action on Google home is temporary in this scenario, like for 24 hours, is this correct? – Becker Dec 09 '16 at 10:57
  • I couldn't find any sources to back this up but sadly it seems that's the case with the web simulator at least. I tried my action today in the web simulator and it didn't work until hit preview again in API.ai. I suppose that's the problem with technology < 24 hours old! – Patrick Dec 10 '16 at 03:10
  • 1
    Seems like this is an easy limitation for them to remove at some point and make the integrations stick without having to preview them again, kind of like keep them in a permanent preview mode would be nice. – Becker Dec 10 '16 at 14:08
  • 1
    Looks like the gliactions cli tool from jsc0's answer might fix this limitation. – Patrick Dec 19 '16 at 06:02
13

In the gactions cli tool you can change the preview time limit with the '-preview_mins' flag.

D:\test> gactions preview -preview_mins 999999999 -action_package=action.json -invocation_name="my action"
Pushing action 'my action' for testing...
'my action' is now available for you until 3918-04-09 12:01AM CST (a long while from now)

That will give you ~2000 years of 'preview' time.

jsc0
  • 3,807
  • 1
  • 17
  • 8
8

Yes, you can. Here the steps to keep your action private:

  • Download Google gactions cli.
    Note: on Mac and Linux run $chmod +x gactions in a terminal to make the binary executable.
  • Copy the executable inside my_project_dir (your project directory).
  • Initialize gaction, open a terminal and run: $ cd <my_project_dir> $ ./gaction init
  • gaction creates a file named ‘action.json’
  • Open a browser developer console (for Chrome: click the three dots in the upper right corner -> More tools -> Developer Tools ).
  • Click the ‘Network’ tab.
  • Open your API.AI project and open the ‘Integrations’ window.
  • Click “AUTHORIZE” button.
  • Click “PREVIEW” button
  • In the browser developer console inspect the XHR response from: https://console.api.ai/api/agent/googleassistant/preview
  • Copy the content of the response and paste it into the file ‘action.json’
  • Save the file.
  • To set your preview to last forever in a private mode, open a terminal and run $ cd <my_project_dir> $ ./gactions preview -action_package <template_dir>/action.json -preview_mins 999999999 -invocation_name [invocation_name_here]

This command will send the Action (‘action.json’ file, same as the the API.AI project) to your Google Home and will run it as a preview for 999999999 minutes (about 2000 years).

For more detailed information you can follow this tutorial: How to create a custom private Google Home Action with API.AI and Google App Engine

Sara
  • 1,844
  • 22
  • 18
  • DialogFlow project interface is slightly changed now. I've tried to do similar things, but with no success. Mainly because XHR response from https://console.dialogflow.com/api/agent/googleassistantv2/preview is empty. This solution is not working now. – Lukas Novak Feb 17 '18 at 10:33
2

Unfortunately private stand-alone actions that you can use just on your local devices are not implemented yet. Actions on Google Developers official Google+ community

Prags
  • 2,457
  • 2
  • 21
  • 38
  • 1
    Regarding Patricks response. The answer in my link reveals the answer to this question in the first statement. You are correct you can do *PREVIEW* actions which can be utilized on devices currently logged into the Google Account linked to the API.ai account they were developed under. However they're only available temporarily, and require you to refresh their 'preview status' repeatedly. As such they are not officially 'supported' in any way or recommended for use in real world scenarios. – corefracture. Dec 09 '16 at 19:58
  • I agree, I would not recommended making preview persist longer, as most answers below suggest. The ever changing mthods for this sort of illustrate that, see also the answers to this question: https://stackoverflow.com/questions/41088596/make-google-actions-development-project-preview-persist-longer/41205026 – Yahoo Serious Jul 27 '18 at 12:59
2

One thing you may want to try is using the Assistant IFTTT channel

With it you can register your own, private, voice commands to trigger an IFTTT action, which could be a call to a custom webhook using the Maker channel, which controls your garage door.

The downfall of this method is that it only allows you to register one off commands, you can't implement a whole dialog like this.

0

Only for 30 minutes is my understanding. After 30 minutes you have to refresh the developer mode to get the actions back.

Stew
  • 9
  • 1
0

If you use Api.ai, you can preview your private actions for up to 30 minutes (default) or extend to up to 24 hours. After this period, your private actions won't be available. Reference: Make google actions development project preview persist longer

Community
  • 1
  • 1
Eric
  • 1