3 weeks ago - last edited 3 weeks ago
When I voice command "kickstart" during daytime, I want to turn on light A.
When I voice the same command during night, I want to turn on light B.
It seems Google Home doesn't allow creation of two automations (and they have conditions exclusive to each other) using same voice command.
So I was trying some nested automations like this (note the red). Basically turn on Driveway and then off after 15 minutes, but then right after turning it on, conditionally do (or not) something else. Still, I keeps receiving errors with the scripts.
How should I tackle the situation at the top?
automations:
starters:
- type: assistant.event.OkGoogle
eventData: query
is: Testing
actions:
- type: device.command.OnOff
devices: Driveway
on: true
- automations:
starters:
type: assistant.command.OkGoogle
eventData: query
is: testing
condition:
type: time.between
after: sunset
before: sunrise
actions:
type: device.command.OnOff
devices: Home light
on: true
- type: time.between
after: sunset
before: sunrise
- type: device.command.OnOff
on: false
devices: Driveway
Answered! Go to the Recommended Answer.
2 weeks ago
You're on the right track, just don't use the automation key more than once. Here is a script that should work for you. Make sure you use the hyphen on "starters". This tells the automation there is more than one starter (even thought they are the same starter).
metadata:
name: Same starter example
description: How to use the same starter
automations:
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: kickstart
condition:
type: time.between
before: sunrise
after: sunset
actions:
- type: device.command.OnOff
on: true
devices: some light - some room
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: kickstart
condition:
type: time.between
before: sunset
after: sunrise
actions:
- type: device.command.OnOff
on: true
devices: some other light - some other room
The hyphen inside the "actions" block is not necessary unless you are going to have more than one action. The same goes true for the hyphen inside each of the "starters" block. If you did put more than one starter in those "starters" blocks, then you could have multiple starters for each of your conditions (nighttime and daytime in this example). These starters would act like a logical "or" in case you wanted each light to come on, say at a time of day or if some other event happens.
2 weeks ago
You're on the right track, just don't use the automation key more than once. Here is a script that should work for you. Make sure you use the hyphen on "starters". This tells the automation there is more than one starter (even thought they are the same starter).
metadata:
name: Same starter example
description: How to use the same starter
automations:
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: kickstart
condition:
type: time.between
before: sunrise
after: sunset
actions:
- type: device.command.OnOff
on: true
devices: some light - some room
- starters:
- type: assistant.event.OkGoogle
eventData: query
is: kickstart
condition:
type: time.between
before: sunset
after: sunrise
actions:
- type: device.command.OnOff
on: true
devices: some other light - some other room
The hyphen inside the "actions" block is not necessary unless you are going to have more than one action. The same goes true for the hyphen inside each of the "starters" block. If you did put more than one starter in those "starters" blocks, then you could have multiple starters for each of your conditions (nighttime and daytime in this example). These starters would act like a logical "or" in case you wanted each light to come on, say at a time of day or if some other event happens.
2 weeks ago
thank you very much. It works! Very happy with that 😁