Turning on/off a nest cam / trigger a google home routine from Home Assitant

Hello hello,

TL;DR: Is there a (reliable) way to trigger a google home routine from Home Assistant, or turn on/off a nest camera from Home Assistant.

I have a nest indoor camera, that I want to only record in two scenario’s:

  • When we are not home
  • At night (regardless of whether or not we are home).

I intend to do this with home assistant automations, but I can not figure out a way to enable and disable the camera.

I’ve found that the camera does not seem to support this through home assistant, and have tried a couple workarounds, all to no avail.

I’ve created an automation / routine within Google Home, that can turn on and off the camera, but I can not run this automation from Home Assitant. While I can use the Google Assistant SDK to send a voice command, in accordance to the limitations of the Google Assistant SDK, it will not let me trigger any OkGoogle based automations / routines.

I’ve also seen other users suggest disabling the internet access for the camera, and whilst this may work that also means that the camera would no longer be able to be turned on and off from within the Google Home app, which is not an option for me.

The only solution I have found discussed on these forums is using a controllable speaker with text to speech, to play a voice command in proximity to a google assistant speaker to actually trigger the voice command, this seems a lot less than ideal.

Is there anyone who has found a more reliable (and less noisy) way of doing this?

Okay, it’s time to answer my own question.

I’ve been able to do this by doing the following:

  • Create a input_boolean helper.
  • Add Google assistant integration to Home Assistant
  • In addition to the instructions on said page, I did the following:
    • Added the following to configuration.yaml under the google_assistant section:
        exposed_domains:
          - switch # I don't think this one is neccesary, but I also don't want to touch it anymore now that it works.
          - input_boolean
        entity_config:
          input_boolean.google_camera_enabled:
            expose: true
      
  • Add the input_boolean to Google Home as a switch
    • Open the Google Home app
    • Add a device
    • Works with Google Home
    • Choose the [test] integration you created
    • Add the device from your integration to your home
  • Created an automation in home.google.com with the following script:
    metadata:
      name: Camera enable
      description: Enable the living room camera.
    automations:
      - starters:
          - type: device.state.OnOff
            state: on
            is: true
            device: Google camera enabled - Electric cabinet
        actions:
          - type: device.command.OnOff
            devices:
              - Living Room camera - Living Room
            on: true
    
  • Added another Google Home automation, with the exact same script, just invert the booleans.
  • Added automations in Home Assistant to change the input boolean value

With all of that, essentially what has happened is:
Home Assistant exposes a “fake” switch to Google Home. Once you toggle this in Home Assistant (by way of automation), this gets represented in Google Home.
Once Google Home sees the switch state changes, it toggles the camera.