With the Google Home app, you can automate your home using Routines. To create advanced Household Routines, the script editor allows you to program scripted automations with additional starters, conditions, actions, and advanced logic.
The script editor is currently available in Public Preview. You can access the script editor with Google Home for web or in the mobile Google Home app after you've joined Public Preview.
Learn how to write scripted automations:
- Write scripted automations with the script editor
- Complete list of supported starters, conditions, and actions
- List of supported devices
- Visit our codelab for a guided example of creating your first script.
- Additional practice for writing a scripted automation and example scripts.
Get started
The script editor allows you to write and edit your own Household Routines with Google Home for web or in the Google Home app.
To create scripted automations, you'll need to:
- Understand the basics of YAML, a human-readable scripting language that allows you to enter line-by-line instructions to create home automations.
- Understand how Routines work, including terminology like starters and actions.
- Understand how to use the script editor to write scripted automations.
For more detailed info on how to write a script, follow Write scripted automations with the script editor.
Note: On an iPhone or iPad, you can view, edit, deactivate, and run automations in the Google Home app, but you can't currently create new scripted automations. If you have an iPhone or iPad, we recommend using Google Home for web to create new automations.
Script editor basics
The script editor uses YAML, a scripting language that allows you to enter line-by-line instructions to create home automations. Learn more at Write scripted automations with the script editor.
YAML quick reference guide
Supported starters, conditions, and actions
Create, edit, and delete scripted automations
Use the script editor in Google Home for web or the Google Home app to write and edit custom scripted automations.
Create a scripted automation
With the Google Home app
With Google Home for web
Edit a scripted automation
You can view and edit most automations you created with the script editor. Non-scripted automations and automations that are actively running can't be edited in the script editor. Once you've stopped an automation, you'll be able to edit it.
With the Google Home app
With Google Home for web
Delete a scripted automation
Important: Deleting a Routine or automation is permanent. To stop a Routine or automation temporarily, pause it instead.
With the Google Home app
With Google Home for web
Help with scripted automations
- Find help with scripts and learn what others are working on in the Google Home Automation community.
- For automations to work, scripts must use valid code. If an error exists, a message appears. Learn more about validation errors and warnings.
- To validate your code, click or tap Validate in the script editor. Here are some common errors to look out for:
- Make sure you use the correct device name in the format
Device name - Room name
. If you're not sure, check the name of your device in the Google Home app. - Make sure your device supports the function you want it to perform. You can also use auto-complete to find available options.
- Make sure you include an action. Actions are required for an automation to run.
- Make sure you use the correct device name in the format
- If the script saves, but the automation doesn't behave as expected or stops working, manually confirm that each component in your script works. For example, if you wrote a script to turn on the light and change the brightness at sunset, try completing these tasks with an assistant command to confirm that each individual function works. You can also check that:
- Your device is added or linked in the Google Home app.
- Your device is connected and online.
- The device name, starters, conditions, and actions are written correctly. Note: Manufacturers may change device traits when they perform updates and this can cause scripts to stop working. You can use auto-complete to help update affected scripts.
- Your script has proper indentation and formatting.
- With Google Home for web, you can access Automations logs
below your script to view your automation’s history and to identify potential problems. Learn more about the types of messages you see in the Automation logs.
- Try using the script editor’s experimental generative AI feature to describe the automation you want and it will draft a script for you to review and edit.
- Learn more about the basics of Routines and how to troubleshoot them.
- Refer to Practice writing a first script.