cancel
Showing results for 
Search instead for 
Did you mean: 

Google Home scripting - notification at start of "for" condition

mpschimm
Community Member

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

1 REPLY 1

OpethNJ
Community Member

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