07-31-2023 08:06 AM - edited 07-31-2023 08:13 AM
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
Answered! Go to the Recommended Answer.
07-31-2023 03:01 PM
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.
07-31-2023 08:21 AM
Instead of For, maybe you can try one of these:
greaterThanOrEqualTo: 5min
greaterThan: 5min
07-31-2023 02:55 PM
But this key will only analyze the opening percentage, not the duration of the device state.
07-31-2023 03:01 PM
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.
07-31-2023 04:16 PM
Right. I thought I was doing it wrong, not that it was a bug.
04-12-2024 02:48 PM
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?