cancel
Showing results for 
Search instead for 
Did you mean: 

Device status for routine conditions?

Olfader
Community Member

Hello. Would it be possible to add a condition to routine activator that they activate depending on the state of another device?

 

For example: WHEN motion is detected IF x device is on THEN turn off lights.

 

Having only times as activation conditions is very limited. 

 

Thanks

3 REPLIES 3

shogo
Community Member

I think this is already possible but not for all devices - i.e. the belowmentioned is valid for Chromecast but not for Nest Hub

 

condition:
  type: device.state.OnOff 

    state: on
    is: true
    device: Chromecast - My Bedroom

Olfader
Community Member

Is this possible for Google Home? If so how? I don't know about that functionality you're talking about

@Olfader This is not something that you can do in the home app on your phone. You have to use Google's automation script editor at https://home.google.com/home. to create an automation that uses conditions as @shogo showed.

Follow the link above and when you land on the page, select automations on the left. This will take you to the script editor where you can create a script to perform the automation that you're after. 

The script that you are looking to create would look something like this

metadata:
  name: Light automation
  description: Turn off XXX light when motion detected and XXX is on

automations:
  starters:
    - type: device.event.MotionDetection
      device: (Your motion sensor goes here) 

  condition:
    type: device.state.OnOff
    state: on
    is: true
    device: (Your device to check if it's on goes here)

  actions:
    - type: device.command.OnOff # Turn the device on or off.
      # Whether to turn the device on or off.
      on: true
      devices: (Your light to turn off goes here)