cancel
Showing results for 
Search instead for 
Did you mean: 

Let's discuss: creating powerful automations with our new script editor!

kelanfromgoogle
Community Manager (Admin)
Community Manager (Admin)

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: 

  • Use clear and concise titles in your post. For example, Automation Script: Water the lawn in the mornings.
  • Include why you created the automation. Describing what this solved for you may inspire others to try it out. For example, "My schedule can vary a lot during the week so it's helpful to add a few conditions to create the automation flexibility I need."
  • Share the script in text format. Copy and paste your automation script so that other users can learn from what you’ve created.

  • Do not include personal information. To ensure your safety, security, and privacy, make sure your custom automation doesn’t include any personal information you don’t want to share.
  • Use the category “Sharing an Automation.” Using the correct category helps other community members find your post.

 

166 REPLIES 166

Fleate
Community Member

I really hope this builds into us accessing 3rd party device's specific settings, like scenes 7 routines on Govee or Hues. Very much looking forward to playing with this!

AndresLobaton
Community Member

Hi Guys, this looks like an interesting release product. Congrats, good job.
In my case, I have in mind to announce some message when an event has happened. 
Maybe an event in a topic using pub/sub or some webhook that google home give me to expose.

Specific Scenery: I have a custom application, every day at night I organize all my next day tasks hour by hour. 
Sometimes I start to do any task and the time happens, and I forgot my next task. I would like google home to announce at that hour that I have to continue with the next task, then I need to connect with an external app.

DWB1973
Community Member

Am I misunderstanding the supported states of the device.state.OpenClose type? I get an error message every time I validate a scripted automation that uses openState as state but openPercent state does not return any validation error. Even the dev docs only cite openPercent as a supported device.state.OpenClose state.

https://developers.home.google.com/automations/schema/reference/entity/sht_device/open_close_state#o...

 

Is openState a supported state or not?

Janicebell
Community Member

Thanks

Looking forward to seeing what everyone is creating. We are here to help if there are any questions.

CHNeves
Community Member

I made a routine where, when opening the living room door (door sensor), it checks if it is between sunset and sunrise and if the living room light is off. If so, it turns on the hallway light and notifies you through the loudspeakers that someone has opened the door. It's working 100%.

 

 

# ------------------------------------------------------------------------------------------ #
# 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.
# By: CHNeves on 2023-07-21. v1.0
# ------------------------------------------------------------------------------------------ #

metadata:
  name: LuzPortaAbre 
  description: Ligar a Luz ao abrir a porta 

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.OpenClose
      state: openPercent
      is: 100
      device: Porta Da Casa - Sala de estar

  # ---- 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: and
    conditions:
      - type: device.state.OnOff
        state: on
        isNot: true
        device: Luz da Sala - Sala de estar
      - type: time.between
        before: sunrise+10min # Adjust offset as needed. Supported units: sec, min, hour
        after: sunset-15min

  # ---- 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:
        - Luz do Corredor - Corredor

    - type: device.command.SetVolume # Set the volume of a given device.
      volumeLevel: 45
      devices:
        - Google Home - Sala de estar
        - Google Nest - Corredor

    - type: assistant.command.Broadcast
      message: "Alguém abriu a porta da sala"
      devices:
        - Google Home - Sala de estar
        - Google Nest - Corredor

 

 Congratulations on this new scripting option.
I also suggest putting different lock options (and, in Brazil, models like Intelbras).
It would also be important to have variable options. For example, it would be possible to roll back the previous volume if there were variables to use.

I would also like to know if Google Nest Hub and Google Nest Hub Max will implement the Brazilian Portuguese language in them?

Regards,
CHNeves

 


Regards,
CHNeves

shehbazallisheh
Community Member

On the finger lock

NestJoke
Community Member

Hello ,
I m making different scripts and very happy with it btw , but whenever one of those commands are involved , it doesn't work at all but rest of the actions are fine. Is it because my assistant is in French or because i do a multiple automatin in the same scrit?
- assistant.event.OkGoogle
- assistant.command.Broadcast

Thanks 
Alex

kessleynogueira
Community Member

@kelanfromgoogle wrote:

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: 

  • Use clear and concise titles in your post. For example, Automation Script: Water the lawn in the mornings.
  • Include why you created the automation. Describing what this solved for you may inspire others to try it out. For example, "My schedule can vary a lot during the week so it's helpful to add a few conditions to create the automation flexibility I need."
  • Share the script in text format. Copy and paste your automation script so that other users can learn from what you’ve created.
  • Do not include personal information. To ensure your safety, security, and privacy, make sure your custom automation doesn’t include any personal information you don’t want to share.
  • Use the category “Sharing an Automation.” Using the correct category helps other community members find 

I have a problem with an automation script. I need my Google Mini to announce that the gate is open too long, in case I forget it open. However, I need it to only announce 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 it again. Can anyone tell me if I'm using it doing this wrong? automation follows:

- starters:
- type: device.state.OpenClose
state: openPercent
is: 100
device: Gate - Garagem

actions:
- type: device.command.
volumeLevel: 80
devices: Gmini - Room

- type: assistant.command.Broadcast
message: The garage door is open too long. Check if you have any problems.
devices: Gmini - Room


 

BobDollarSign
Community Member

My first script did not run...

metadata:
name: Garage Door Open Detector
description: When the garage door is opened, announce it on all 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.OpenClose
state: openPercent
# [available operators: is, isNot, lessThan, lessThanOrEqualTo, greaterThan, greaterThanOrEqualTo]
greaterThan: 10
device: Garage Door - Garage

# ---- 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”.

# ---- 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: The garage door has been opened.
devices:
- Bathroom Speaker - Bathroom
- Living Room Display - Living Room
- Master Bedroom Display - Master Bedroom

Jifaarmahamad
Community Member

#

???  

krroller
Community Member

Looking for some help as to what would cause this script, which does validate with no errors, to not run unless I run it manually.

The intent is to set the temperature to 76 degrees F when the temperature drops below 76 and the mode is set to cool.  So for the scenario where there is no schedule set and the thermostat is not locked out, and someone manually sets the thermometer to a temperature too low (which would cost high electric bills), the thermostat would reset itself back to the target temperature of 76 degrees.

 

# ------------------------------------------------------------------------------------------ #
# 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: Dining Room 2 Temp Less XX
description: If Cooling drops below XX set it to YY
automations:
# “starters” and “actions” are required; “condition” is optional.
# Use Ctrl + Space to see autocomplete suggestions.

# ---- STARTERS ---- #
starters:
- type: device.state.TemperatureSetting # Handles temperature points and modes of a thermostat device.
state: thermostatTemperatureAmbient
lessThan: 76F
device: Dining Room(Dining Room 2) - Dining Room

# ---- CONDITIONS ---- #
condition:
type: device.state.TemperatureSetting # Handles temperature points and modes of a thermostat device.
state: activeThermostatMode
is: cool
device: Dining Room(Dining Room 2) - Dining Room

# ---- ACTIONS ---- #
actions:
- type: device.command.ThermostatTemperatureSetpoint # Set the target temperature for a thermostat device.
thermostatTemperatureSetpoint: 76F
devices: Dining Room(Dining Room 2) - Dining Room

 

Gk1984
Community Member

I'm confused. Isn't this exactly what setting the thermostat to cool does by itself? Even my dumb thermostat before getting a nest would cool when the temp dropped below the set temperature. 

krroller
Community Member

Your question does not account for someone manually changing the thermostat.  😉

The intent is that if someone walks up to the thermostat to set it to 65 degrees in cool mode that the routine will set it back to 76 degrees at some point without relying on a schedule, preset ranges or locking out the thermostat. 

GlenYYC
Community Member

Using This,         But want to Add,  that the lights only will  run  for 5 Mins

metadata:
name: Lights On At Arrival
description: After dark, when someone arrives home, turn on lights, and turn off all lights when the home is unoccupied.
automations:
# Turn on certain lights after someone gets home after dark
- starters:
- type: home.state.HomePresence
state: homePresenceMode
is: HOME
condition:
type: time.between
after: SUNSET
before: SUNRISE
actions:
- type: device.command.OnOff
devices:
- Garage Lights - Garage
- Kasa Smart Bulb - Outside
on: true
# Turn off all lights when everyone is away during the day
- starters:
- type: home.state.HomePresence
state: homePresenceMode
is: AWAY
condition:
type: time.between
after: SUNRISE
before: SUNSET
actions:
- type: device.command.OnOff
devices:
- Garage Lights - Garage
- Kasa Smart Bulb - Outside
on: false

 

 

 

 

tolunlade
Community Member

It would be nice to be able to adjust the brightness and color of my lights without changing the on/off state. I know this is a supported payload with Hue bulbs, and I feel the use case is common when dealing with multiple light-related scripts.

 

In my use case, I want to be able to turn off the lights in a room while watching movies after sunset and then turn them back on once I am done. But, I will be gradually dimming my lights between sunset and midnight. Without this feature, I now have the added hassle of having to manually turn off my lights mid-viewing because my viewing and time schedules may overlap.

umasud
Community Member

Any plans to allow a certain apps notifications to be used as triggers? I am trying to see if I can automate my Nest Home Hub in the Kitchen to play the Islamic call to prayer during the variables 5 times over the course of the year. I have an app on my phone that notifies me of the times as they change each day. But I am wondering how I could use the prayer time (which changes each day based on length of day, sun position and certain other conditions) as a starter to trigger a video of the call to prayer to play on youtube.

Afrinick
Community Member

Hi everyone, I didn't find a confirmation yet, so could you please tell me:

if I create a script with two starters, the second will be trigger only if the first starter has already been triggered or it is independent?

no, it's "OR" logic there

is it possible to change it in "AND"?

that's what "condition" for. you can apply and/or logic in the conditions after at least one of the starters triggered

my purpose is to turn a light on when there is motion in the room.

only when the light is turned on by the first starter, if there is no motion for 10min I want that it should turn the light off.
I have the eve motion sensor and the "device.state.OccupancySensing" type is not supported

IanSav
Community Member

How will the script editor integrate with local processing as promised by Matter?  Will scripts be synchronised with local Google controllers such that scripts will not require the cloud to operate?

Gk1984
Community Member

A recent blog post states we can enable starter suppression, but it doesn't explain how. Can someone point me towards how to enable/use/turn this on?

IanSav
Community Member

This project needs some readable documentation.  The current documentation is based on explaining an object when you ask about the object.  There is little generic documentation to bring new users up to speed with how things work in general.

Please see this example: https://developers.home.google.com/automations/example-scripts#when_i_walk_through_my_corridor_first...

suppressFor field in the starter enables this. 

 

We will work on improving the documentation discovery for this feature.

Tinkerer, Google Home Automations Team

il_Capitano_25
Community Member

I currently have the problem that "members" does not work in the notifications. As soon as I type in members, the two household members are suggested with their names and email addresses. However, as soon as I want to shoot down the automation, I am told that this is not a member of the household. How can I solve the problem?

 

I also connected an Aqara M2 Hub with multiple contact sensors to Google Home via Matter. Unfortunately, the alarm or security system can only be controlled via Aqara. Does anyone have an idea how to sharpen the "fake" alarm. So due to this, Automation will receive a notification and the Nest audio will play a sound when a window has been opened. This is basically possible, but of course only if I have started an automation for it. I didn't want to rely on the presence and absence detection, but rather switch it on and off manually. i.e. an automation that creates a notification and the Nest audio emits a sound when a window is opened. This is basically possible, but of course only if I have started an automation for it. I didn't want to rely on the presence and absence detection, but rather switch it on and off manually.

Pat_
Community Member

Hi!

I am trying to combine the state of my TV (switching it on) and the sunset to turn on some lights in the living room.

The lights should be switched on when I turn on the TV AND it is after sunset.

metadata:
  name: Auto Living room lights 
  description: Turn on lights when I'm starting the TV after sunset

automations:
  - starters:
      - type: device.state.OnOff
        state: on
        # [available operators: is, isNot]
        is: true
        device: P TV - Living Room

    condition:
      type: time.between
      after: sunset

      weekdays:
        - MON
        - TUE
        - WED
        - THU
        - FRI
        - SAT
        - SUN

    actions:
      - type: device.command.OnOff 
        on: true
        devices: Living Room Lights - Living Room

It's actually quite a simple script, however it is not firing. Maybe the starter is incorrect. Any suggestions?

Btw, the second part of the script would be to turn on the lights at sunset if the TV is running.

ThorsReign
Community Member

You're missing the before sunrise part of the condition, but I've been trying the same thing with intermittent success.  I've tried using my TV and my Roku as the starter and online or turned on as the conditions.  It's worked before, in fact my lights have been on in the morning when online was the starter, but it doesn't trigger consistently.  I think the issue is that Google isn't continually monitoring the activity of the TV or the Roku unless it's triggered through the assistant (eg using the assistant or another routine to turn on the TV)

Pat_
Community Member

Thanks for your reply.

The before attribute is optional, so I thought I could skip it. I put it in upon your advice but it's still not working. 

I have the same impression as you, it appears to be a monitoring issue. Or maybe the TV isn't telling the home "Hey, I'm on now. Do what you have to do."

fahanas
Community Member

script making not creativity creativity making only one script

fahanas
Community Member
  •   

fahanas
Community Member

one searching one answer created not creativity creativity making only one creator for searching history 

fahanas
Community Member

pivacy want for privet searching place human privacy important good searching place

Idave
Community Member

I thought that it’s gonna be possible to initiate a Starter

condition

action

Condition 

action

 

i want to do that because I want a broadcast alert if I left the door open for more than 5 min

but it don’t want to

Idave
Community Member

Or if we can add a time.delay in condition it will fix the problem 

hallivaeh
Community Member

Hello, is it possible to have zones person detection? Currently it's only letting me choose person detection without a condition if it's inside or outside the zones

hallivaeh
Community Member

Hi, I am trying to create a script to disarm security once the door lock has been unlocked.

I wrote it as:

actions:
- type: device.command.ArmDisarm
devices: Security - Entryway
arm: false

But I am getting an error message that I have to add cancel field. According to the documentation it's not mandatory. Any suggestions?

SydneyAutoHome
Community Member

Firstly | Great advancement with Script Editor.

I have used this editor for the following:

1. Medication reminder | turns on & changes led strip lights to purple between 08:30 & 09:30

2. Reminder to take out the trash | turns on & changes led strip lights to blue between for 30 minutes on Thursdays @ 16:00hrs

Now I would like to modify this script to flash led strip lights between red & green & yellow & green on alternate weeks, lighting the led strip lights for 30 minutes on each occassion.  A little stumped on the coding...!!
We have three trash bins Red, Yellow & Green, I always get mixed up as to which ones to put out for collection.

Any suggestions would be welcome .. Kelan

Chadab
Community Member

Any update on the ThermostatSetModeCommand command? It's in the documentation. But the script editor doesn't recognize it as valid. It would be really useful.