06-15-2023 10:46 AM - edited 06-15-2023 11:07 AM
Hey everyone!
This week, we released the script editor, a tool for creating advanced home automations, on Google Home for web and the Google Home app. Learn more about it in our community blog: New to Public Preview: create powerful automations with our script editor.
You can unlock the full potential of home automation by building advanced, personalized automations. Here are some examples that can be done only in the script editor:
We'd love to hear about how you are using the script editor. Share your favorite use cases for the script editor, and your automation scripts in the comments below!
Here are some helpful guidelines for sharing your automations in the Community discussion forum:
06-18-2023 02:58 PM
Eu acredito que essa condição não está funcionando corretamente por que sou um usuário do Brasil, então o horário daqui não é igual do servidor do Google. Não sei se isso faz algum sentido.
06-19-2023 05:57 AM
I wonder if we can use the sensor of the nest mini or nest hub as a starter?
06-27-2023 04:32 PM
I wish..
06-19-2023 02:28 PM
I have consolidated a number of "old" routines that control a number of window shades throughout the house into a singe script with multiple starters. The reporting of a script starting only reports the script name. It would be great if it reported both the script name and the starter that was triggered.
06-20-2023 05:44 AM
by the way, having Online state condition is really awesome, with that I don't have to buy expensive raspberry pi for home assistant.
I can automate devices that don't support relay (physically turn on will turn on by default). I can also press switch physical button to automate other smart switch !
06-20-2023 11:25 AM - edited 06-20-2023 11:27 AM
I've got two sets of automations 1. what happens at night 2. set a group of window shades positions
In one the OkGoogle events trigger just fine but the other it won't recognize the query
The following is test automation gen'd from the larger file. There are no errors but still 'open the window shades' is not recognized. I've tried changing that string but nothing works. I MUST be missing something obvious. I built this same automation as a personal routine and it worked fine
metadata:
name: test
description: Scripted automation
automations:
- name: testing shades
starters:
- type: assistant.event.OkGoogle
eventData: query
is: open the window shades
actions:
- type: assistant.command.Broadcast
message: ok
devices: Office Speaker - Office
- type: device.command.ActivateScene
activate: true
devices: Open Shades in Master Bedroom - Master Bedroom
- type: assistant.command.Broadcast
message: opened
devices: Office Speaker - Office
06-20-2023 11:20 PM
time.delay is not working
06-21-2023 01:56 AM
I've tried a rather simple automation as a workaround for the confusing states of the Samsung Frame TV:
(The Frame showing art while in Art mode, but beeing ON in the google home app. Seems like there is no way to distinguish OFF, ON, ART MODE)
When the TV gets muted, turn on the light.
starters:
- type: device.state.Volume # Provides volume state info.
state: isMuted
is: true
device: Samsung The Frame 55
actions:
- type: device.command.OnOff # Turn the device on or off.
on: true
devices: someLight
For some reason muting the TV does not seem to activate the routine.
Then I tried to use the volume but there it seems I can not enter any valid input. Whatever number I use it's always marked as invalid.
starters:
- type: device.state.Volume # Provides volume state info.
state: currentVolume
is: 0
device: Samsung The Frame 55
actions:
- type: device.command.OnOff # Turn the device on or off.
on: true
devices: someLight
Questions
06-21-2023 09:09 AM
I am trying to add a delay to my motion sensor. My motion sensor is supposed to turn off lights if the hallway lights are turned on (hallway lights turned on = leaving. Hallway lights turned off = coming home).
I am trying to use the following snippet:
condition:
type: and
# "AND" together two or more conditionals
conditions:
- type: device.state.MotionDetection # This function belongs to devices that can detect motion.
state: lastMotionDetectionEventEndTimestampSec
is: 60
device: Hallway - Hallway
However if I try this it won't allow me to save the script. The problem is that when someone comes home the lights turn on, but that immediately causes everything to turn off as well. Any ideas?
06-21-2023 11:37 AM
Can you provide some more information on using the following code as it doesn't work.
actions:
type: home.command.Notification
[Available parameter options: title, body, members]
title: Notification Title
body: Notification text
members: Self
I receive an error that the home.command.Notification is an unknown type name, yet it was available in the auto complete. I also get an error that I am not a member of the household when I use my name or email. I can't find much documentation on this Type.
What I'm trying to do is add a notification after a script is executed as sort of a confirmation that it ran and to get an idea of when it executed. In this case, it's to turn the lights on based on presence sensing. But in the past, with the built-in Home automation, it would turn the lights on based on presence about 3-5 minutes before anyone even pulled into the driveway.
I'd also like to use the same action type to send a silent reminder if the garage door is still open when we go to bed based on a smart garage door opener we have. It has it's own tools built in for that, but I'd like to explore what else I can do with it as well.
06-21-2023 01:10 PM
Is there a way to tell that a new build of the scripting system has dropped?
06-22-2023 12:36 PM - edited 06-22-2023 12:37 PM
I'm having an issue with "type: device.state.TemperatureControl" in the "conditions" section. I picked it from the list but somehow it is rejected by the validation.
# ------------------------------------------------------------------------------------------ #
# Lines starting with “#” are comments and will be ignored by the automation.
# Indentation determines hierarchy within the script.
# Visit g.co/home/script-editor-docs for full documentation.
# ------------------------------------------------------------------------------------------ #
metadata:
name: Too Hot
description: When Smartthing sensor is above 75F turnon the window fan
automations:
# “starters” and “actions” are required; “condition” is optional.
# Use Ctrl + Space to see autocomplete suggestions.
# ---- STARTERS ---- #
# Starters describe events that will start the automation.
# To add more than one starter, duplicate the "- type" section under "starters".
# If you add multiple starter events, any one of them happening will start the automation
starters:
- type: time.schedule
# Required. Time to schedule automation. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
at: sunset-60min # Adjust offset as needed. Supported units: sec, min, hour
# Optional. Days of the week to run automation on.
weekdays:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
# ---- CONDITIONS ---- #
# Conditions are optional. Delete this section if it’s empty.
# Conditions will prevent an automation from starting if the conditions aren’t met.
# See g.co/home/script-editor-docs for documentation about how to use logical operators like “and”, “or”, “not”.
condition:
type: device.state.TemperatureControl
state: temperatureAmbientCelsius
is: 24
device: Temperature Sensor - Master Bedroom
# ---- ACTIONS ---- #
# Actions will start when a starter event takes place and all conditions are met.
# Actions will start in the order they appear in the script, and with any delay specified.
# To add more than one action, duplicate the "- type" section under "actions".
actions:
- type: device.command.OnOff # Turn the device on or off.
on: true
devices: Ceiling Fan - Master Bedroom
06-27-2023 04:27 PM
You have to add C or F for Celsius or Fahrenheit behind the number.
06-27-2023 03:16 PM - edited 06-27-2023 03:32 PM
I created a simple automation that changes the color of the light depending on whether the thermostat is in heating or cooling status. Everything works if I change the temperature/mode in the Google Home app. But after changing it in the Meross app or on the device itself, the starter doesn't work until I open the Google Home app or ask the speaker about the temperature set in the room. The thermostat is a Meross MTS200, in the list of supported devices it says it should support TemperatureControlState.
EDIT1: I waited more than 20 minutes to see if it was due to the delay, but still no response. I also checked the same script with Sonoff light on and off starters, and in this case the script was triggered almost immediately after switching the physical button.
My script:
metadata:
name: Thermostat status light # Choose a short name that summarizes important starters and actions, like “Sunset lights”.
description: Scripted automation # Write a detailed description that includes everything the automation does, like “At sunset, on weekdays, close blinds, turn on lights to 50%, and play the sunset playlist on certain speakers.”
automations:
- starters:
- type: device.state.TemperatureSetting # Handles temperature points and modes of a thermostat device.
state: thermostatMode
is: cool
device: Living Room - Living Room
actions:
- type: device.command.ColorAbsolute
color:
name: blue
devices: Ambient 1 - Office
- starters:
- type: device.state.TemperatureSetting # Handles temperature points and modes of a thermostat device.
state: thermostatMode
is: heat
device: Living Room - Living Room
actions:
- type: device.command.ColorAbsolute
color:
name: red
devices: Ambient 1 - Office
06-27-2023 04:23 PM
I also have gotten a similar issue when setting up a contact sensor, the sensor won't trigger the automation unless I open the home app or the actual contact sensor app. I'm almost certain that it's because the home app is not consistent in checking for device status. Meaning if you change status of the device via some other way then in the home app it doesn't get recognized as a changed status so it doesn't trigger the automation.
07-22-2023 01:36 PM
Did you find a solution for this? I am experiencing similar behavior.
07-23-2023 09:37 AM
FYI, so... I was able to fix my Tuya sensor, by registering it with the SmartLife application rather than the Tuya application. Apparently, with the SmartLife app... the sensor will proactively send an event to Google, where registration with the other app doesn't.
07-28-2023 10:46 AM - edited 07-28-2023 10:49 AM
No but I guess you figured it out, I will try this when I get home if it works, I'm gonna deem you the goat! And sorry for the late response.
06-28-2023 02:17 AM
I have no way of starting an automation with the Google Assistant. An error is always output for "eventdata", even if it says standard "query".
06-28-2023 05:20 AM
What's the error you get?
06-29-2023 01:57 AM
I've solved the problem in the meantime. The name voice command was probably not possible because of the umlauts.
06-28-2023 04:27 PM
Is it possible to do any kind of math, or plans for this? This post is a good reference to what I am looking for. I'd like to do something like set the temp like this: thermostatTemperatureSetpoint: thermostatTemperatureAmbient - 2 with the starter being greater than (or equal to) a specific humidity value.
07-01-2023 03:50 PM
I don't see a way to read the temperature from a temperature sensor. In my case, it's a Smart Life temperature & humidity sensor. I think being able to determine the room temperature is very important for automation.
07-01-2023 03:56 PM
Hi @bostonfern
Unless your sensor is an available device within the Google Home app then you will need to use another home automation system that can communicate with the sensor.
https://developers.home.google.com/automations/supported-devices
07-01-2023 04:21 PM
In Google Home App, it does display the temperature and the humidity reported by this Smart Life sensor. I just don't see a way to read temperature using automation.
07-02-2023 03:06 AM
From the supported devices list that I linked to if you select sensors they only list one smart life (Nedis SmartLife) sensor and that only has on/off as the supported actions or commands 😞
07-02-2023 03:52 PM
I hope google will make the temperature and humidity available to these routines. If google can display them, then there should not be any technical issue in passing the values to the routines.
10-19-2024 07:54 PM
How do we use Nest cam activity zones as a trigger for an event such as announce someone/something is in the driveway.. or frontyard ..
07-01-2023 06:43 PM
I'm having the same problem, I have three temperature sensors, and I can't create routines with them. And both are compatible with Google Home and show temperature and humidity in the app.
07-02-2023 07:22 PM
Sharing an Automation.
Automation Script: This simple script turns on the lights if someone opens that patio door at night.
The Home app does not let me use door sensors as starters, so I was not able to do this previously.
Here's the automation text:
metadata:
name: Kitchen Light On/Off
description:
Turn on kitchen light when back patio door is opened and it's between 10PM and 6AM
Turn off kitchen light when back patio door is closed and it's between 10PM and 6AM
automations:
- starters:
- type: device.state.OpenClose # If the patio door is opened
device: Back Patio Door Sensor
state: openPercent
is: 100
condition:
type: time.between # Between 10:00 PM and 6:00 AM
after: 10:00 PM
before: 06:00 AM
actions:
- type: device.command.OnOff # Turn the kitchen lights on.
devices: Kitchen light - Kitchen
on: true
- starters:
- type: device.state.OpenClose # If the patio door is closed
device: Back Patio Door Sensor
state: openPercent
is: 0
condition:
type: time.between # Between 10:00 PM and 6:00 AM
after: 10:00 PM
before: 06:00 AM
actions:
- type: device.command.OnOff # Turn the kitchen lights off.
devices: Kitchen light - Kitchen
on: false
07-02-2023 07:58 PM
For me this time.between condition doesn't work. I try and the routine doesn't work when I put this condition.
07-03-2023 03:48 AM
Pretty useless tool until you add support for Google Nest Cameras. It's sort of sad that several open source home automation tools are more advanced functionally speaking than Google.
07-04-2023 04:34 AM
Hi! I really like the new automation, but I have a question. Will there be a condition that will check weather temperature outside? Like from AccuWeather or something. It would be really helpful for me because I could make a routine like:
starter: when turning on tv:
condition: if temperature outside is higher than 20 degrees Celcius
action: close the blinds in living room
10-19-2024 05:33 PM
I too would like to write a script to turn on a outlet when the temperature is below 35F
Does anyone have a solution for this animation?
07-05-2023 10:51 AM
Absolutely! The script editor on Google Home for web and the Google Home app allows you to create powerful automations and unlock the full potential of home automation
07-06-2023 11:40 AM
Hello to all! I have a nest cam (battery) with flooding light that is power connected full time.
Im trying to do a testing alert with following code, but it gives me error, it tells me that the device isnt compatible with the motion detection type. Would you help me please? Thanks!
# ------------------------------------------------------------------------------------------ #
# Lines starting with “#” are comments and will be ignored by the automation.
# Indentation determines hierarchy within the script.
# Visit g.co/home/script-editor-docs for full documentation.
# ------------------------------------------------------------------------------------------ #
metadata:
name: Untitled # Choose a short name that summarizes important starters and actions, like “Sunset lights”.
description: Scripted automation # Write a detailed description that includes everything the automation does, like “At sunset, on weekdays, close blinds, turn on lights to 50%, and play the sunset playlist on certain speakers.”
automations:
# “starters” and “actions” are required; “conditions” are optional.
# Use Ctrl + Space to see autocomplete suggestions.
# ---- STARTERS ---- #
# Starters describe events that will start the automation.
# To add more than one starter, duplicate the "- type" section under "starters".
# If you add multiple starter events, any one of them happening will start the automation
starters:
- type: device.state.MotionDetection
state: motionDetectionEventInProgress
is: true
device: Entrada - Entrada
# ---- CONDITIONS ---- #
# Conditions are optional. Delete this section if it’s empty.
# Conditions will prevent an automation from starting if the conditions aren’t met.
# See g.co/home/script-editor-docs for documentation about how to use logical operators like “and”, “or”, and “not”.
condition:
type: time.between
# Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
before: 07:00 # HH:MM (24 hours format). Adjust time as needed
# Optional. Accepts either clock time (10:00:00 AM, with seconds optional, or in a 24 hour format), or 'sunrise' or 'sunset', with an optional offset ('sunrise+10m', for instance)
after: 23:00 # HH:MM (24 hours format). Adjust time as needed
# Optional. Days of the week to apply condition on.
weekdays:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
# ---- ACTIONS ---- #
# Actions will start when a starter event takes place and all conditions are met.
# Actions will start in the order they appear in the script and with any delay specified.
# To add more than one action, duplicate the "- type" section under "actions".
actions:
- type: assistant.command.Broadcast
message: People on front door
devices: Parlante Living - Living
07-06-2023 12:03 PM
This same issue exists for Nest Protects and Nest Thermostats.
It's not likely the API's exist yet to throw events for motion detection on these devices, but it would be good to hear this from the experts and to get this on the roadmap, if not already.
07-06-2023 12:21 PM
As a member of the Google Developer program I can pull the motion events from the API for Nest Battery Cameras into other 3rd Party open source home automation platforms so the API likely isn’t the issue.
07-06-2023 01:10 PM
I do not have device.state.motion as a starter option and typing it in (vs selecting from the drop down list for which it's not an option) does not seem to work either.
07-06-2023 12:09 PM
Motion detection from Nest cameras isn't available yet but Google has indicated that they plan on including it sometime.