cancel
Showing results for 
Search instead for 
Did you mean: 

Exclude Device from Routine Actions if it is Turned Off

linkian19
Community Member

Hello all!

I've been playing around with the new automation script editor and it's been a fun time!

I've recently set up an automation that when I arm my security system it turns off various devices, turns on our bedroom TV and our nightstand lamps.

When the bedroom TV turns on that kicks off another routine that is intended to be a "wind-down". It will wait for 5 minutes, then turn the lamps to 25% brightness, another 5 and to 10% brightness, another 5 and to 1%, and then finally after another 5 minutes it turns the lamps off. Then after about an hour the TV turns off.

This all works except for one case I've discovered: If I turn off one of the lamps before the routine turns it off, when it runs the next brightness command, it turns the lamp back on.

This is not my intended behavior. Ideally I would like the lamp to stay off if we manually turn it off. This could happen because maybe I want my lamp off or my wife's lamp is bothering her (or whatever reason). Is there anyway to check device state during actions (almost like a nested condition in an action?) so that it's essentially an if statement? Basically: if lamp off, don't run the brightness action

I am using the BrightnessAbsolute command, would BrightnessRelative be the better option? I wasn't sure what the difference was since the documentation pages for those commands don't really sate the difference between them.

Any help would be appreciated, thanks!

1 Recommended Answer

linkian19
Community Member

I think I may have figured out a solution to this in a different thread.

The link for that is here: https://www.googlenestcommunity.com/t5/Home-Automation/Starter-gt-condition1-gt-action1-gt-condition...

 

-----EDIT: MORE INFORMATION BELOW-----

I wanted to edit this reply to say that I found out some other ways to achieve what I was looking for. The key points are:

  • Many starters have an optional "for" field which lets you set how long the starter trigger needs to be active for before it kicks off any automation.
    • My TV has to be on for an hour and a half BEFORE it checks conditions and runs actions.
    • time.delay in actions is great for some things but that seems to pause the WHOLE automation if a time.delay is active.
    • Using "for" appears to not pause the rest of the automation so this will allow other actions to take place.
    •  For example: 

 

# ---- TV STARTERS ---- #
  # ---- TV SLEEP TIMER ---- #
  - name: TV Sleep Timer
    starters:
      - type: device.state.OnOff
        state: on
        is: true
        device: Master bedroom Roku - Master Bedroom
        for: 1 hour 30 min

 

  • If you are looking for a workaround way to have a sort of device state variable that is more native to Google (rather than using HomeAssistant, SmartThings, etc) there is a Google Home Playground that will let you set up some virtual/dummy devices that you can add to your home and perform actions on.
    • This means you could set up a simple light and use it as a true/false variable.
    • And example idea:
      • Say you don't want your routine to trigger again if you manually stop it but your starter might trigger it again for some reason.
      • You could have a condition set so that if the virtual light is on then the routine will continue to run.
      • In your actions the first thing you could do is turn the virtual light off and then do your wanted actions.
      • And thusly, if you stop the routine and something triggers again and you don't want it to run then the condition would fail and it wouldn't run.
    • I found out about this option in the following comment that links to instructions on how to get started with the Google Home Playground.
    • I have done much with this knowledge just yet, but I have some ideas rolling around.

 

I hope all this information helps some of you out! Please let me know if you have any questions, I'm happy to help if I can.

 

View Recommended Answer in original post

1 REPLY 1

linkian19
Community Member

I think I may have figured out a solution to this in a different thread.

The link for that is here: https://www.googlenestcommunity.com/t5/Home-Automation/Starter-gt-condition1-gt-action1-gt-condition...

 

-----EDIT: MORE INFORMATION BELOW-----

I wanted to edit this reply to say that I found out some other ways to achieve what I was looking for. The key points are:

  • Many starters have an optional "for" field which lets you set how long the starter trigger needs to be active for before it kicks off any automation.
    • My TV has to be on for an hour and a half BEFORE it checks conditions and runs actions.
    • time.delay in actions is great for some things but that seems to pause the WHOLE automation if a time.delay is active.
    • Using "for" appears to not pause the rest of the automation so this will allow other actions to take place.
    •  For example: 

 

# ---- TV STARTERS ---- #
  # ---- TV SLEEP TIMER ---- #
  - name: TV Sleep Timer
    starters:
      - type: device.state.OnOff
        state: on
        is: true
        device: Master bedroom Roku - Master Bedroom
        for: 1 hour 30 min

 

  • If you are looking for a workaround way to have a sort of device state variable that is more native to Google (rather than using HomeAssistant, SmartThings, etc) there is a Google Home Playground that will let you set up some virtual/dummy devices that you can add to your home and perform actions on.
    • This means you could set up a simple light and use it as a true/false variable.
    • And example idea:
      • Say you don't want your routine to trigger again if you manually stop it but your starter might trigger it again for some reason.
      • You could have a condition set so that if the virtual light is on then the routine will continue to run.
      • In your actions the first thing you could do is turn the virtual light off and then do your wanted actions.
      • And thusly, if you stop the routine and something triggers again and you don't want it to run then the condition would fail and it wouldn't run.
    • I found out about this option in the following comment that links to instructions on how to get started with the Google Home Playground.
    • I have done much with this knowledge just yet, but I have some ideas rolling around.

 

I hope all this information helps some of you out! Please let me know if you have any questions, I'm happy to help if I can.