Home Assistant Guide

Simple tutorials for powerful automations

Scripts in Home Assistant

Scripts in Home Assistant let you group a series of actions together, so you can run them all at once with a single tap, voice command, or automation. If you want to turn off all your lights, send a notification, and play some music as part of a bedtime routine - or trigger any set of tasks in a specific order - a script is the way to do it.

What is a Script?

A script is simply a list of actions that run in sequence, just like a recipe. Each action in a script can do something like turn on a device, adjust a setting, call another script, or even pause for a certain amount of time. You can reuse scripts anywhere - run them from the dashboard, call them from automations, or activate them with voice assistants.

Common Use Cases

  • Bedtime routines (turn off lights, lock doors, arm alarm)
  • Leaving home (turn off devices, set thermostat, send notification)
  • Movie night (dim lights, close blinds, turn on TV and speakers)
  • Custom notifications (send a specific message when called by another automation)

How are Scripts Different from Automations?

Automations are triggered by something happening (like a sensor detecting movement or a certain time of day). Scripts don't trigger on their own - they only run when you call them. Think of automations as "if this happens, do that," and scripts as "do this set of things when I tell you."

Creating a Script

You can create scripts using the visual editor in Home Assistant, found under Settings > Automations & Scenes > Scripts. The editor lets you add actions one by one, adjust their order, and configure any details. Each script needs a name and can be given an icon and description to make it easy to find later.

Tips & Best Practices

  • Break up complex automations by putting reusable steps in scripts.
  • Use scripts for routines you might want to trigger in several ways (button, automation, voice).
  • Scripts can call other scripts for maximum flexibility.
  • Test scripts from the UI to make sure everything works as expected.

What Can You Put in a Script?

  • Turn devices on or off
  • Adjust lights, switches, media players, thermostats, and more
  • Send notifications
  • Wait for a specific time or until something happens
  • Call other scripts or services

Ready to try it? Head to the Scripts section in Home Assistant and create your first routine!