03-01-2024 03:38 AM
I have a very simple script:
metadata:
name: Plug off
description: Notify when the smart plug is off
automations:
- starters:
- type: device.state.OnOff
device: Smart Plug - Living Room
state: on
is: false
for: 5min
actions:
- type: home.command.Notification
title: Plug off
What I want is the notification to be sent ONLY after the smart plug has been off for 5 minutes. But what actually happens is that the notification is sent at the start of the automation, and also after 5 minutes. I thought the purpose of "for" was to make it wait till the condition has been met for 5 minutes? Is there a simple way to fix this? Thanks
03-09-2024 10:31 AM
You could leverage a delay which is effectively a timer in your action block.
- type: time.delay
for: 5min
https://developers.home.google.com/automations/schema/reference/standard/delay_action