Skip to content

Home Assistant -- Scripts

Last Updated: YYYY-MM-DD Status: Template

1. Purpose

This document describes all reusable scripts in Home Assistant. Scripts are sequences of actions that can be called from automations, dashboards, or other scripts.

Scripts differ from automations: - Scripts: Action sequences without triggers (called manually or by automations) - Automations: Include triggers, conditions, and actions


2. Design Principles

  • Single Responsibility: Each script does one thing well
  • Parameterized: Accept variables for flexibility
  • Idempotent: Safe to run multiple times
  • Documented: Clear description and usage examples
  • Fail-Safe: Handle edge cases gracefully

3. Script Categories

3.1 Lighting Scripts

Scripts for common lighting scenarios and routines.

Example: Bedtime Routine

Script ID: script.bedtime_routine

Purpose: Dims lights and prepares the house for sleep

Parameters: - room: Target room (optional, defaults to all) - dim_level: Brightness percentage (default: 10%)

Triggered By: - Dashboard button - Voice command - Scheduled automation


3.2 Security Scripts

Scripts related to alarm management and security routines.


3.3 Notification Scripts

Reusable notification patterns with consistent formatting.


3.4 System Scripts

Scripts for maintenance and system management.


4. Script Development Workflow

  1. Define Use Case: What problem does this script solve?
  2. Identify Inputs: What parameters are needed?
  3. Draft Actions: List the sequence of operations
  4. Test Manually: Trigger from Developer Tools
  5. Add to Dashboard: Create button for easy access
  6. Document Here: Add to this file with examples

5. Script Inventory

Script ID Purpose Used By Status