Thursday, January 5, 2023

Triggering Google Assistant Routines from Home Assistant

Introduction:

If you're like me, you probably love the convenience and automation that smart home devices bring to your daily life. One of the best ways to take advantage of these devices is by setting up routines in your smart home assistant, such as Home Assistant.

What is Home Assistant?

Home Assistant is an open-source smart home platform that allows you to automate and control your home's devices and systems. It supports a wide range of devices and services, including popular smart home products like Google Home, Amazon Echo, and Philips Hue. With Home Assistant, you can easily set up routines to automate tasks and make your home more efficient and convenient.

What are Home Assistant routines?

Home Assistant routines are automated actions that are triggered by certain events or conditions. For example, you can set up a routine to turn off all the lights in your house when you go to bed, or to turn on your coffee maker every morning at 6 am. You can even set up routines to control your thermostat, lock your doors, or turn on your security system. The possibilities are endless!

Home Assistant device support

The support for creating automations of the devices in the home is quite powerful and flexible.  One limitation is that it can only control devices where there are integrations with Home Assistant and have been added to the setup.  Unfortunately, not all devices can be directly integrated into Home Assistant. With the 2023.01 version of Home Assistant, now you can trigger Google Assistant commands from Home Assistant.

Google Assistant Routines

One of the primary use cases I have for this integration is triggering Google Assistant routines from Home Assistant.  Since Home Assistant has support for triggering routines with NFC tags, one example of this is triggering the "Good night" Google Assistant routine, when I put my phone on my bedside table.

Configuration

Since this integration works through Google's APIs, the setup will require creating an Oauth client ID and secret.  This page has instructions for doing this setup.

Once the client is configured, then the integration can be added to your Home Assistant installation


In the resulting dialog, once you enter the OAuth credentials, you will be able to send commands to Google Assistant.

Usage

Once configured, several services will be added, that will be quite useful for integrating with Home Assistant, with some examples.


service: google_assistant_sdk.send_text_command
data:
    command: turn off kitchen TV


service: notify.google_assistant_sdk
data:
    message: time for dinner

The google_assistant_sdk.send_text_command service is great for triggering an Google Assistant routines. The notify.google_assistant_sdk will allow messages to be spoken through Google Assistant speakers.

No comments:

Post a Comment

DIY Cloud Storage: A Step-by-Step Guide to Setting Up Nextcloud on Your Raspberry Pi

In this post, I'm going to walk you through the process of setting up Nextcloud on a Raspberry Pi using NextcloudPi . If you're loo...