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¶
- Define Use Case: What problem does this script solve?
- Identify Inputs: What parameters are needed?
- Draft Actions: List the sequence of operations
- Test Manually: Trigger from Developer Tools
- Add to Dashboard: Create button for easy access
- Document Here: Add to this file with examples
5. Script Inventory¶
| Script ID | Purpose | Used By | Status |
|---|---|---|---|
6. Related Documentation¶
- Architecture: home_assistant.md
- Automations: ha_automations.md