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

**URL:** <https://forums.rwusers.com/t/hey-google-when-i-come-home-after-dark-turn-on-the-flood-lights/99>\
**Category:** Help Me\
**Created:** [February 4, 2023, 8:52pm UTC](https://forums.rwusers.com/t/hey-google-when-i-come-home-after-dark-turn-on-the-flood-lights/99 "2023-02-04T20:52:52Z")\
**Posts on this page:** 1\
**Showing post:** 23

<div class="post-metadata">

**Author:** ![southpaw](https://forums.rwusers.com/user_avatar/forums.rwusers.com/southpaw/32/6_2.png) [@southpaw](https://forums.rwusers.com/u/southpaw)\
**Post date:** [March 21, 2024, 1:50am UTC](https://forums.rwusers.com/t/hey-google-when-i-come-home-after-dark-turn-on-the-flood-lights/99/23 "2024-03-21T01:50:42Z")

</div>

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](http://home.google.com), while signed into the Google account you have associated with your Google Home.

2. Click `Automations` on the left  
 ![image](https://forums.rwusers.com/uploads/default/original/1X/dc1e42d7cbb50ac6512bc43817feaa2d91435339.png)

3. You’ll see a list of your current automation. Click `Add new` in the lower right-hand corner.  
 ![image](https://forums.rwusers.com/uploads/default/original/1X/cf3d3ae6839034384c6f0b4fa581089216d40e2b.png)  
(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:

```auto
metadata:
  name: Turn on lights when home
  description: Turn on driveway lights when I arrive after dark
automations:
  - starters:
      - type: home.state.HomePresence
        state: HomePresenceMode
        is: HOME
    condition:
      type: time.between
      after: SUNSET
      before: SUNRISE
    actions:
      - type: device.command.OnOff
        devices:
          - 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?

---

_[View the full topic](https://forums.rwusers.com/t/hey-google-when-i-come-home-after-dark-turn-on-the-flood-lights/99)._
