cancel
Showing results for 
Search instead for 
Did you mean: 

"for" initializer for device state duration

kessleynogueira
Community Member

I have a problem with an automation script. I need my Google Mini to tell me the gate has been open too long in case I forget it. However, I need it to announce only when it remains open for more than 5 minutes. The "device.state.OpenClose" option has the "for" key, but when I use it in automation, as soon as I open the gate it already makes the announcement and after 5 minutes it announces again. Can anyone tell me if I'm using this wrong? following automation:

 

- starters:

- type: device.state.OpenClose

status: openPercent

is: 100

device: Gate - Garage

For: 5min

 

actions:

- type: device.command.

volume level: 80

Devices: Gmini - Living Room

 

- type: Assistant.command.Broadcast

message: The garage door has been open too long. Check if you have any problems.

Devices: Gmini - Living Room

1 Recommended Answer

Ah yeah, you're right.  The only keys for duration is For and suppressFor.  If For isn't working as it is described in the developer documentation, then you should send feedback or open a support ticket to let them know.

View Recommended Answer in original post

5 REPLIES 5

DWB1973
Community Member

Instead of For, maybe you can try one of these:

greaterThanOrEqualTo: 5min

greaterThan: 5min

But this key will only analyze the opening percentage, not the duration of the device state.

Ah yeah, you're right.  The only keys for duration is For and suppressFor.  If For isn't working as it is described in the developer documentation, then you should send feedback or open a support ticket to let them know.

kessleynogueira
Community Member

Right. I thought I was doing it wrong, not that it was a bug.

HaroldBien
Community Member

I have similar but different problem. I simply wanted to know if I left my door open. Like you, I used the device.state.OpenClose and "for: 5 min" (note space after value and separating units 'min', not sure if that's important). On the history log, I can see that the automation rule was started because the door was open (OpenClose=100). But then I close the door (<30 seconds) and there are no further events (might be missing the closing event?) and exactly 5 minutes later the routine would fire. So, I know it understood the 5 min duration part, but is either missing the closing event or something else is wrong. For what it's worth, I've also seen if I leave door open longer the door closed event fires (within 5 minutes) but 5 minutes later _still_ the announcement (Action) will fire despite clearly the status not having been 100 for 5 minutes. Any clues or suggestions?