Turn on a smart plug for a certain amount of time through Google Home

is there a way to do something like okay google turn on heater for 1 hour or 30 minutes? I know that i can set up a rule that says turn off outlet after 4 hours but I want it to be what ever i ask Google. When in my office i know im in there for an hour and want the heater on and I want to not forget to turn it off.

Seems quite simple You could Write a rule/piston that turns off that switch after it's been on for a set amount of time.

Or if you set up a virtual switch and link it to Google you could write a rule/piston that links that virtual switch to the heater to turn it off after a set amount of time that way u have a timer switch and the heater switch

I know how to set up a switch to turn off after a set amount of time as stated above but only if the time is static. like ALWAYS turn off after 30 minutes. What happens if I'm in the office for 4 hours? I would have to turn on the heater 8 times? I want to know if there is a way to give the time as a variable in my command to google home IE "Okay Google turn on the heater for 4 hours" and then that variable gets passed to Hubitat as to how long the switch should stay on for.

This seems so simple to do and is a typical use case for a smart device yet I cannot seem to find a way to do this!

I'm not sure u can set a variable with Google.
My work around off the top of my head would be multiple virtual switches like heat 1, heat 2, heater 3.

yeah the only thing I could think about also was an accumulating variable. so when you turn the plug on set the turn off timer variable for 1 hour. then if you turn it on again it would add an hour to the existing variable. if you turn it off it would reset the variable. so basically keep clicking up on the virtual light switch. I guess treat it like a button more than a switch? you would have to decide if you want to go up by 30 minutes or 1 hour etc but really when I think about that solution that's what I already have. I have a switch that plugs into the wall and when you press it it turns on the LED for an hour, second press turns on for 2 hours third press turns on for 4 hours 4th press turns on for 8 hours, 5th press turns it off. it's a physical digital timer meant for heaters. I was just hoping there be a way to do it through using your voice.

I released a Google calendar, task, and reminder integration:

It will allow you to automate things based on these Google items. I have been playing with making reminders more dynamic by parsing the reminder text to then turn on or off switches mentioned within the reminder to then match up to a list of devices defined within the trigger child app.

I live in an Alexa household but if you say Google remind me in 1.5 hours to turn off the heater does it create a Google Reminder you can see in your Google account? Does the due date set to 1.5 hours from now? I ask because this app and new enhancement might work well for you.

But you would have to turn it on first and then setup the reminder to turn it off. My app would pick that up and turn it off along with marking the reminder completed.

in alexa you ask for a sleep timer if that helps ....google may work similar

Have you tried using motion sensors for this? Truly automated, no action on your part required to start the heat. Sounds like this is an occupancy issue, rather than a specific time issue.

Set a rule to monitor for presence and then turn the heater on if the office is occupied >X minutes (so it won't turn on if you just step into the office for a few minutes). Then turn the heater off if the office is unoccupied for >X minutes (allowing you time to go to the bathroom, or other short breaks).

The most effective way to use motion sensors for offices that I've found is to:

  1. Install one on the underside of the desk, or wall/inside back of the desk, pointing at the chair you sit in. That way any motion of your legs, feet, chair, etc. will maintain presence
  2. Install a second motion sensor behind you pointing at your back

Combine them into a Motion Zone Controller using the HE app, and then you'll have reliable presence detection in your office to keep the heat on, or turn it off when you leave for more than X minutes. Even if you're sitting pretty still you are going to move your feet/legs often enough to maintain presence. That's what we've found, anyway.

You could also continue to use GV to turn on the heater, and just have an occupancy rule that turns the heater off when you leave for >X minutes, if you don't want the heater turning on automatcally (e.g., you have pets/kids that might trigger it coming on).

You could also have a failsafe Auto Off set up for the heater regardless of presence that turns it off after X hours if there is concern about safety or about running up the heating bill.


You can literally say "okay google turn on heater for 1 hour" and it will turn on for an hour and then turn off. Of course given Google, it may not always work reliably.


I swear I have tried this before and this never worked. of course now that you say that and I tried it it worked perfectly fine. it seems like Google actually sets the timer and turns it off after 10 minutes not Hubitat

thank you I feel like such an idiot


@danabw This is a great solution also!!

1 Like

NP...I had no idea Google would manage the time, but I find Google a little too flaky on and off to feel totall confident about that.

Also, in case you didn't know there is a great little "Auto Off" app that is extremely useful for stuff similar to this.

So I tried to use one of my smart plugs and then expose it to Google home and then ask Google Home to turn it on for 30 seconds as a test and Google states

"Sorry because of potential risk to safety I cannot schedule actions for devices configured as switches"

But then I change its type to a fan in Google Home and it will let me schedule it. Very strange it wont allow me to do this without making it a fan to bypass that security feature. I got it to work though

Yeah, switches configured as lights and fans are considered safe so they allow scheduling actions for them.