Hey, Google... When I come home after dark, turn on the flood lights

Whoohoo! One year later I may finally have a solution!

The Macrodroid macro didn’t pan out for me, so I had settled for just having the floodlights come on every time I came home, day or night. No big deal to tell Google to turn them back off as I walked through the garage.

But now…
Google invited me to use AI to Create custom routines. Here’s how.

  1. On a computer, go to home.google.com, while signed into the Google account you have associated with your Google Home.

  2. Click Automations on the left

  3. You’ll see a list of your current automation. Click Add new in the lower right-hand corner.
    (You may be prompted to join Public Preview)

  4. On the right-hand side, enter a prompt for AI to turn into a script. Just type what you want Google Assistant to do, using natural language.
    I used, “When I come home after dark, turn on the driveway lights.”
    The script it came up with was:

  name: Turn on lights when home
  description: Turn on driveway lights when I arrive after dark
  - starters:
      - type: home.state.HomePresence
        state: HomePresenceMode
        is: HOME
      type: time.between
      after: SUNSET
      before: SUNRISE
      - type: device.command.OnOff
          - Floodlight 1 - Driveway
          - Floodlight 2 - Driveway
        on: true

Finally, the “between sunset and sunrise” restriction is in there!

I haven’t actually been anywhere since I set it up, but when I do a test run during the daytime, the lights don’t come on, and when I test run it at night, they do, so this is looking good.

Has anyone else tried writing a Google Assistant automation using AI?