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

I’ve been playing with “Routines” in the Google Home app, trying to get my friendly Assistant to help me out by automatically turning on my floodlights when I come home after dark.

It doesn’t seem to me that the “Routines” in the Home app are quite robust enough to do what I need. For one thing, I would think I’d need my “starter” to be “when my phone comes home” but my phone can’t even be a “starter” device. I tried going about it a different way, by thinking about what time I’d want this even to happen, but the time options are all simply “at” at certain time, I don’t seen an option for a span of time, like “between sunset and sunrise.”

I’m curious if anyone has set up anything similar and can point me in the right direction. I’m willing to try integrating with another app like Macrodroid, IFTTT, or Zapier if that’s where the solution I need is.

Otherwise, I may have to go back to old-school motion detectors and just deal with lights coming on every time a cat, dog, possum, rabbit, raccoon, fox, or deer wanders through the front yard.

(Hats off to @bitflung whose endless quest to automate everyday tasks reminded me someone out there has probably done this before and could point me in the right direction.)

I’d just like mine to turn the porch light on everyday at sunset, and off at sunrise, but :man_shrugging:

That’s doable - I have a little hall lamp doing that, now, @cbwahlstrom. Plus a desk lamp that turns on every evening at sunset and turns off at 11:30 (in theory to remind me to go to bed)! My string of lights on the deck comes on every night at sunset and turns off at 11:30, and I had all the Christmas lights on about the same schedule.

It’s this added component of arriving that’s got me blocked.

Do you have faulty equipment?

Beats me. I tell assistant to turn the light on every day at sunset. It acts like it accepted the command, but nothing happens. I can give it a simple command to turn it on at sunset, and it will, for only that day.
For a while I was looking for a way to turn the :rotating_light: on when my Nest doorbell cam spotted a person, but the assistant wasn’t yet advanced enough for that. It’s still just a toy to me. I don’t lose much sleep over it.
My favorite is still when the internet goes down and I’m walking around in the dark because I can’t turn the lights on. Technology :man_shrugging:

Hi @southpaw - sounds like you might want to read up on geofencing for Google. We’re an Alexa house so can’t speak to how this works with Google. One article gave the following example – “you could set a geofencing action for your address so that when your phone is detected returning to your docile, the smart lock on your front door unlocks.” Should be able to do this with other smart devices. Found several helpful sites but not sure what policy is for posting links. Hope this helps!

Ha! @cbwahlstrom, Reminds me of the old story in my family of my uncle, as a child, carrying a candle to the living room during a power outage, to watch tv.

I think you’ll need to crack open the Home app to set up the timers on a recurring schedule, instead of trying to tell the assistant to do it. (But I bet that’ll be feasible before long.)

Open the Google Home app and tap…

  1. Routines
  2. (Household/Personal)
  3. +Add starter
  4. At Sunrise or sunset
  5. Sunset
  6. (leave repeat function on every day)
  7. Add starter
  8. +Add action
  9. Adjust Home Devices
  10. [your porch light]
  11. “turn off or on” checkbox
  12. turn on
  13. add action
  14. edit title and type new name for this routine
  15. checkmark at top right
  16. save
    :weary:
    Then do it again for sunrise.

Before you say that’s too much work, okay, it’s 17 steps, times two routines… but in just over two weeks of saying “Hey, Google turn on the porch light at sunset” and “Hey, Google turn off the porch light” you’ll be ahead of the game.

Hi @FreddyP,

Links are fine here.

Sounds like I have homework to do!

I just went with zero step, ultra retro. I never turn the porch light off.

Our house has Alexa, and when setting up automatic-on or off routines one choice is sunrise or sunset. However, a number of our smart switches and plugs are Kasa TP-Link units, and the Kasa app also provides timers that include sunset and sunrise - using that app, one really doesn’t need a Google Home or Amazon Alexa device for simple time-of-day on or off.

That said, we’ve kind of gone overboard with the smart home concept. We can say things like:
“Alexa, vacuum the kitchen” and Roomba will go clean.
“Alexa, mute TV” and we can silence commercials, change channels, search for programs, etc.
Really handy are the multiple Alexa timers when we’re cooking.
We can go into any room in our house and say, “Alexa, lights on‚” and the lights in just that room will go on. Alexa knows what room we are speaking in an she knows what lights are in that room.

As my sweet wife would say, I really need to get a life.

Cor chase my Aunt Fanny up a gumtree, @southpaw has done it again! She made me curious so I investigated how I could control smart switches using a MacroDroid trigger like location or an NFC Tag or any other trigger. With Alexa it’s easy - just install the “Virtual Monkey” Alexa skill. Set up a routine in the Alexa app and tell Virtual Monkey about it. Virtual Monkey gives you a URL and if you point your browser, or MacroDroid Macro Action, or anything else connected to the web at that URL, Virtual Monkey will execute the Alexa routine.

Of course, in the MacroDroid Macro, one can add a time of day constraint so it won’t execute the Macro to turn on the lights in the daytime.

Thank you @southpaw for sending me on this voyage of discovery!

Here is a link to a discussion that I found on the MacroDroid forum that discusses ‘Virtual Monkey’ https://www.macrodroidforum.com/index.php?threads/smart-bulbs.551/#post-2855

I set up a Raspberry Pi with OpenHAB, and I have it programmed to turn on certain lights whenever I get home based on the presence of my cell phone on the network. If I get bored enough, I might add the night feature.

I also have my main lights programmed to light up in the morning for my start-the-day routine, and shut down after I should have gone to the basement for work. (System Administrator, WFH is handy.)

If Google Home has a skill for OpenHAB, you could set up a Pi as a light controller and the Home unit could handle your commands that way. The OpenHAB would handle the automatic lights. You can even have the porch light shut off automatically after you’ve had enough time to get items out of the car and get in to the house.

Drawback: Programming involves editing cron files and writing scripts on the Pi. This doesn’t bother me, but it might be a showstopper for some. I have a Mark I Mycroft assistant that I was voice-controlling my lights with, but it broke down and the Mark II hasn’t arrived yet.

Thanks for the ideas @mwgardiner. Right now I don’t own a Pi, but I have a house full of Google devices, so that’s the solution I’m hoping to work out. Let us know if you get the “after dark” parameter added to what you’re already doing.

@southpaw I don’t happen to own any of these fancy, smart devices so I am unable to test this. However, is this what you are looking for?

https://www.youtube.com/watch?v=XsKxTKo3WXU

Any luck? I watched the video that @johnny_5 posted, but I don’t have the home/away routine option at the top of Google Home. I did apply for the preview version of Google Home. Haven’t got it yet. I did notice they’re building out a home for web version at home.google.com.

Hi @johnny_5 and @cbwahlstrom,

I had tried this previously, but I’m not seeing where I can add anything to limit the action to only take place between sunset and sunrise. I don’t really need my floodlights coming on whenever I come home during the day.

I also don’t have the “home/away” option at the top like this video describes, but the part about nest devices sounds familiar, so I think I may have already walked through some of it, making the button vanish. If I tap the “routines” button I have “home” and “away” options and can set it turn things on when my phone comes home.

1 Like

Okay, I have found a way to do this using Macrodroid paired with IFTTT, and it tests out pretty well, but man is it complicated!

First, you have to set up an account with IFTTT and get your webhook key at https://ifttt.com/maker_webhooks/settings#.

Then, in Macrodroid, set up the following:

  1. Your Geofence area, using the Geofences tile.

  2. Your macro with
    a. Trigger: Entering the above-created Geofence area*
    b. Action: HTTP Request (GET) https://maker.ifttt.com/trigger/{eventname}/with/key/{your webhook key}
    c. Constraints: Before sunrise AND After sunset

  3. Finally, back in IFTTT, create an applet with
    a. If: Receive a web request with event name {eventname}
    b. Then: Turn on your desired smart device using that device’s app.

Unfortunately, Google Home is not an app that accepts events through IFTTT, nor is Hubspace, which happens to be the brand of the light sockets I’m using in my floodlight. I can turn on various lights in the house, but not my floodlights. :confounded:

Still pondering… I suspect there’s a way to accomplish this using only IFTTT, which would be less complicated than pairing Macrodroid and IFTTT, though it still won’t solve for the fact that my light sockets don’t support IFTTT integration.
(Update to the above: IFTTT requires a Pro+ (paid) plan to have more than one trigger in an applet, so I can’t combine entering my home area with a time of day filter unless I’m willing to subscribe to the service.)

*Also of note, using Geofencing requires you to select how often you want Macrodroid checking your location. Higher frequency will consume more battery, so I’d need to set my Geofence area to be large enough that I wouldn’t get home before the lights come on, depending on how often I decide to have it check my location. Or I could just drive verrrrrrrrry slowly once I get in my neighborhood.

(Edited to add, if you’re a Zapier fan rather than an IFTTT fan, the process is similar, but Zaper also has no actions for Google Home or Hubspace, and Zapier webhooks are labeled a “premium” feature.)

1 Like

Okay, I’m going to give this a try, but it’s clunky and I’m worried about battery drain.
Using Macrodroid.
Trigger: I enter my Geofence area
Action: Turn on my phone screen, set my media volume to 57%, open Google Assistant, wait 5 seconds, say “turn on the driveway lights”, wait 15 seconds, turn off the phone screen.
Constraints: When it’s after sunset and before sunrise.

Testing by tapping the option to test has been successful. Now I just need somewhere to go one evening…

1 Like

Thanks for sharing! That’s more effort than returned benefit for me, but thanks. I’m sure in the coming years this will become less Rube Goldberg-esque.

1 Like

That’s more effort than returned benefit for me

Yeah, but part of the fun is in learning something new. I hope Google will add constraints or filters to routines, eventually.

The bigger ROI is just being able to get out of my car and enter my house safely. We live in an area where copperheads on the driveway are a common thing, so I like to be able to see where I’m stepping. If I leave the lights on the whole time I’m gone, the lights attract insects which attract toads; copperheads enjoy feasting on both toads and insects, so in a roundabout way, the lights attract copperheads.

For anyone pondering my concern about battery life, I created another macro to enable the “Light It Up” macro. So it will stay disabled (not checking my location) uness a new macro enables it:
Trigger: I’m driving
Action: Enable “Light It Up”
Constraint: I’m outside my home area, it’s dark, and I haven’t invoked “Light It Up” in the last hour.

So now I’m only polling location if I’m driving. I think there’s more logic to figure out. I’m good for creating endless loops…

1 Like