cancel
Showing results for 
Search instead for 
Did you mean: 

Google Home garage script with sunrise condition

shanecb
Community Member

Hi all,

I've just recently installed a smart light switch in my garage and now want to add this into an automation which opens my garage door (which is on a smart relay)

I have a standard automation set up in the app to open the garage door when I say a certain phrase, but now I'd like to add the light to this. My issue is, I'd only want the light to come on if it's executed between sunset and sunrise.

Is this possible?

If so, do I need to have two scripted automations (one to open if sunrise condition is not met and one to open and turn light on if it is)?

Would some kind person assist me with an example?

 

Also, as an aside, is there a way to create a script to require a verbal code before executing an action?

1 Recommended Answer

GBD
Bronze
Bronze

@shanecb, Using the web based google home script editor (https://home.google.com/home), you would create a 2nd script that would turn the light on when the garage door is opened. Below is a sample script that I just did that will turn the light on in my sunporch when the heater in the sunporch is turned on but only after sunset and before sunrise.

 

 

metadata:
  name: Turn on light when the heater is on
  description: Turn on light when the heater is on
automations:
  - starters:
      - type: device.state.OnOff
        device: Heater - Sunporch #replace this with your garage door relay name 
        state: on
        is: true
    condition:
      type: time.between
      after: SUNSET
      before: SUNRISE
    actions:
      - type: device.command.OnOff
        devices:
          - Porch overhead - Sunporch #replace this with your garage light name
        on: true

 

 

 

In addition, as far as I know, home automations/scripts won't ask for or wait for further instructions once activated.

View Recommended Answer in original post

3 REPLIES 3

GBD
Bronze
Bronze

@shanecb, Using the web based google home script editor (https://home.google.com/home), you would create a 2nd script that would turn the light on when the garage door is opened. Below is a sample script that I just did that will turn the light on in my sunporch when the heater in the sunporch is turned on but only after sunset and before sunrise.

 

 

metadata:
  name: Turn on light when the heater is on
  description: Turn on light when the heater is on
automations:
  - starters:
      - type: device.state.OnOff
        device: Heater - Sunporch #replace this with your garage door relay name 
        state: on
        is: true
    condition:
      type: time.between
      after: SUNSET
      before: SUNRISE
    actions:
      - type: device.command.OnOff
        devices:
          - Porch overhead - Sunporch #replace this with your garage light name
        on: true

 

 

 

In addition, as far as I know, home automations/scripts won't ask for or wait for further instructions once activated.

shanecb
Community Member

Thank you very much, that works perfectly.

catheryn
Community Specialist
Community Specialist

Hi @shanecb

 

Thanks for bringing your concern to our attention and posting it in the community. I apologize for the inconvenience you were having with the Google Home script. 

 

Let us know if you have any other questions about it. If you have inquiries about any Google Nest products, don’t hesitate to ask and feel free to post them. 

 

In addition, thanks to @GBD for your quick and easy-to-understand response. 

 

 Warm regards, 

 

Catheryn.