MacroDroid and Google Home / Assistant

Josué García

MacroDroid Support
Staff member
Hi guys, today I bring you an alternative way to use Google Home (Google Assistant).

What is the difference with the existing implementation?

You don't need to say "Run" macro name "in macrodroid", just the name of the routine.

Requirements:

Install: Google Home - Apps on Google Play (Complete initial configuration)

Check compatibility with your language here

Next enter here https://home.google.com/ followed by clicking on "Add Routine"
(delete the existing demo code) and copy and paste the following code, modifying the following lines:

is: "Activation phrase" - replace 'Activation phrase' with your preferred phrase this phrase will activate the routine.

body: "My Macro Example" - define here the name of the macro you want to invoke.

members: example@gmail.com - Please change your email address here, the same as the one used in Google Home.


YAML:
metadata:
  name: MacroDroid Automation
  description: MacroDroid - Google Home

automations:
  - starters:
      - type: assistant.event.OkGoogle
        eventData: query
        is: "Activation phrase"
    actions:
      - type: home.command.Notification
        title: "Google Home MacroDroid"
        body: "My Macro Example"
        members: example@gmail.com

Save the routine and we finish the work on this site.

We now turn to MacroDroid.

In a new or existing macro we add a trigger "Notification Received".
Select the Google Home application and 'Contains' the same value as the body line: "My Macro Example" in this case we should put 'My Macro Example'.

Finish the actions of your macro, and now you can say "Ok Google My Macro Example" and the macro should run successfully.

Advanced:

To create more automated routines within the script
just copy and paste this code snippet (with the corresponding modifications).

YAML:
  - starters:
      - type: assistant.event.OkGoogle
        eventData: query
        is: "Activation phrase 2"
    actions:
      - type: home.command.Notification
        title: "Google Home MacroDroid"
        body: "My Macro Example 2"
        members: example@gmail.com

In this way

YAML:
metadata:
  name: MacroDroid Automation
  description: MacroDroid - Google Home

automations:
  - starters:
      - type: assistant.event.OkGoogle
        eventData: query
        is: "Activation phrase"
    actions:
      - type: home.command.Notification
        title: "Google Home MacroDroid"
        body: "My Macro Example"
        members: example@gmail.com

  - starters:
      - type: assistant.event.OkGoogle
        eventData: query
        is: "Activation phrase 2"
    actions:
      - type: home.command.Notification
        title: "Google Home MacroDroid"
        body: "My Macro Example 2"
        members: example@gmail.com
 
Last edited:

WatermanGarry

New member
Wow, this is brilliant! I have read all the forum and tried all possible options to start macro by voice command from Google Assistant. System lang and assistant lang: EN. Everything is set up, access is provided everywhere, but still fails.. The only one way I managed to trigger the macro is your post.
P.S. Only one improvement I'd propose: to remove notification after processing.. But this can be easily done with an action....
Thank you so much!
 
Top