01-01-2024 06:05 AM
Hi,
I'd like to receive a notification on my mobile phone if a light stays on for more than 10 minutes. However, I can't find any suitable "conditions" on Google Home - Script Editor.
Do you have any suggestions?
Simone
Answered! Go to the Recommended Answer.
01-03-2024 09:57 AM
Hey @s_dimaio - Conditions are things that are checked each time your automation starts so they won't quite fit this use case. You can try using the for: parameter in combination with the OnOff device state starter so that they light being on for 11 minutes for example will start the automation and send you a notification. This simple example will only send one notification each time the automation runs so you may need to add more starters to send follow up notifications (e.g. every 10 minutes). Check out the example script below for this basic example:
metadata:
name: Test 11 minute light
description: Send me a notification if a light is left on for more than 10 minutes
automations:
# Start automation if office light has been on for 11 minutes
starters:
- type: device.state.OnOff
state: on
is: true
device: Office light - Office
for: 11 min
# Send me a notification to remind me that the office light is on
actions:
- type: home.command.Notification
title: Office light left on
body: Looks like you left something on
members: [home member email]
01-03-2024 09:57 AM
Hey @s_dimaio - Conditions are things that are checked each time your automation starts so they won't quite fit this use case. You can try using the for: parameter in combination with the OnOff device state starter so that they light being on for 11 minutes for example will start the automation and send you a notification. This simple example will only send one notification each time the automation runs so you may need to add more starters to send follow up notifications (e.g. every 10 minutes). Check out the example script below for this basic example:
metadata:
name: Test 11 minute light
description: Send me a notification if a light is left on for more than 10 minutes
automations:
# Start automation if office light has been on for 11 minutes
starters:
- type: device.state.OnOff
state: on
is: true
device: Office light - Office
for: 11 min
# Send me a notification to remind me that the office light is on
actions:
- type: home.command.Notification
title: Office light left on
body: Looks like you left something on
members: [home member email]
01-13-2024 05:22 AM
Thanks! It works like a charm
01-04-2024 12:24 AM
I want to confirm this but I want to say leveraging FOR in your starter would do it. Something like this:
metadata:
name: Light Notification After A period odf Time.
description: TEST
automations:
starters:
- type: device.state.OnOff
state: on
is: true
device: Glide Hexa - Living Room
for: 15sec
# condition:
# type:
actions:
- type: home.command.Notification # Send a notification to the specified home members.
title: Lighting Uptime
body: Govee Glide Hex has been on for 15 seconds
# members: Your Home members go here
01-04-2024 12:26 AM
I need to check that code when i get home
01-13-2024 05:23 AM
Thanks! It works!