Help with more advanced Google assistant actions

Hi.

I have Google assistant running on a Google mini and i have it working with home assistant (hass.io) directly via the non-cloud method. I can use it to turn on and off things as well as the climate control. Everything i have is interfaced directly through hass.io. It works great. But i want more advanced features than just on or off. For instance to find when the next bus is i have to say “turn on when is the next bus” to activate my bus script.

I want to be able to say stuff like;

“ok Google close the garage door”. This will interact with a template switch to close the door, and if the door is already closed (on) it will say the door is already closed. Currently it only works as turn on or turn off the garage door. But i want to say close and open.

"ok Google where is Emily’ (my wife), this will return the status of a template sensor which is either “home” , “work” “friends house” etc.

“Ok Google what is the temperature in the sunroom” it will tell me the sunroom temp.

Should i be researching into dialogflow component to get this up and running out should i use iftt or is there a better way. If like to try and avoid to much delay as well. Also i don’t want to have to say ok Google talk to home assistant and then the command.

Thanks
Kiwi

1 Like

Maybe use shortcuts?

+1 for shortcuts when it comes to running scripts. This has worked really well for me.

Returning sensor values is something I hadn’t thought of. I’d assume this would require the sensor to be exposed to Google, which currently isn’t supported according to the docs. Interested to see what others might have to say on this topic as well.

For the garage door I am able to say open close because I have it configured as a Cover component and not a template switch. Not sure if that would help you at all? Using a shortcut would probably work here too, but I don’t think it would return your desired “garage door is already closed.”

What is “shortcuts”.

Do you mean just “turn on < script name >”?

I forgot they actually just renamed Shortcuts to be part of the Routines functionality. Basically it lets you define within the Google Home app that when you say X, it should then do Y. So in this case you could create a Routine for whenever you say “Okay Google, Close the Garage Door” the Assistant will actually run the command “Turn Off Garage Door.”

See more from the Google Help page.

1 Like

Shortcuts are available from the Google Home app go to Menu > More Settings > Shortcuts from there you can assciate any voice command with an action.

1 Like

I use a script as I have a reed switch that will tell me if the garage door is open or not.

I’ll then call the script within google home using a “routine” so i can ask google if “I left the garage open” or “Is the garage door open”, etc.

garage_door_status:
  alias: "Garage Door Status"
  sequence:
  - service: tts.google_say
    entity_id: media_player.family_room_speaker
    data_template:
      message: >
        {% if is_state("sensor.garage_status", "closed") %}
        Yes, the garage door is closed.
        {% endif %}
        {% if is_state("sensor.garage_status", "open") %}
        No, the garage door is still open. Let me close it for you.
        {% endif %}
      cache: true
  - service_template: >
      {% if is_state("sensor.garage_status", "open") %}
        cover.close_cover
      {% endif %}

Also use this for temperature:

garage_temp:
  alias: "Garage Temperature"
  sequence:
  - service: tts.google_say
    entity_id: media_player.family_room_speaker
    data_template:
      message: 'The garage temperature is {{ states("sensor.garage_temp") }} degrees'
      cache: false
5 Likes

This is fantastic! Will definitely try it out. Only downside is the need to manually set these scripts and routines up for each individual device/sensor, but I’m sure it’s only a matter of time before someone writes some code to make it easier… :slight_smile:

Great. Thank you.

Routines is definitely what i need since i don’t need the advanced features that dialog flow has and it looks a lot easier to set up. Thank you.

I am testing out a custom find my phone script. Why am I doing this. It’s because I have multiple phones and I hate having to wait for google to ask me what phone I want and run through the list.

How do you include the script?

This is my configuration.yaml

google_assistant:
  project_id: !secret google_assistant_project_id
  client_id: !secret google_assistant_client_id
  access_token: !secret google_assistant_access_token
  agent_user_id: !secret google_assistant_agent_id
  api_key: !secret google_assistant_api_key
  expose_by_default: false
  entity_config:
        script.find_mikes_phone:
          name: Find Mikes Phone
          expose: true
          aliases:
            - Find Mikes Phone

Scripts.yaml

find_mikes_phone:
  alias: "Find Mikes Phone"
  sequence:
    - service: notify.html5
      data_template:
        title: "Here is your phone"
        message: 'tts'
        target: "mike"
      data:
        data:
          tag: 'Home Assistant'

Then on my phone in smart home app under shortcuts I have

And under smart home control I have

1 Like

The problem is the voice trigger, it seems if you have “where” or “find” in the shortcut it doesn’t use the shortcut.

"Locate Mike’s Phone" works though.

Just a note… In Australia and probably other non-US places, Routines are not available. We only have Shortcuts. We also can configure Continued Conversation but that is not working yet even though activated…

2 Likes

Came across this post in search of shortcuts or routines. However, on my iPhone in the Google Home app, nor in the Google Assistant app, I can’t find shortcuts nor routines. For context, I am living in the Netherlands.
Am I not looking good enough?

In bottom right tap the head & shoulders icon
Then under Google Assistant tap more settings
Then tap Assistant in the menu bar and routines.

Clock bottom right icon on main screen
Then click settings.

…A screen will load with your photo…

Then click assistant
Then click routines

Thanks @kiwijunglist and @DavidFW1960, but please find here the proof that I am not crazy.

Maybe good to note that I am using my Google Suite account. Maybe this is the differences, as Google Assistant also doesn’t support calendar integration yet for those accounts.

under my profile i have

Your info - Assistant - Services - <my_home_name>

i have under “Assistant” i have

Languages
Continued conversation
Voice Match
Home Control
Routines
Email updates
Assistant devices

The “routines” function used to be called “shortcuts”

@vlamofiel

routines / shortcuts is not yet available for the dutch market, maybe in a few months
google rolled out routines to more countries this week, but still not in dutch
i am working with google aliasses, you can configure them in HA, this will accompllish the same as routines/shortcuts from google

so if you have a script like “watch tv” , expose that entity and make aliasses, so you can say “watch tv” in different ways :

example :

switch.tv:
  name: Watch TV
  expose: true
  room: Harmony
  aliases:
    - TV 
    - Televisie
    - Television  

so as you can see, you can combine languages in your aliasses

2 Likes

PS: you are eventually not going to see those aliasses in the google home app, only the name…
but you can use them, you just need to know them :slight_smile:

But if I understand correctly, with these aliases you still have to say; ‘Hey Google, turn on Televisie’.
The question this topic is about is not turning stuff on, but have other context like ‘Hey Google, where is my wife?’, ‘Hey Google, what is the temperature in room X’?