UI Macros
UI Macros makes macros accessible from user interfaces. By assigning macros to UIs, you create quick-access buttons for automation sequences like scenes, modes, and complex commands.
Overview
UI Macros allow users to:
- Execute automation sequences with one tap
- Access frequently-used macros quickly
- Trigger scenes (Good Morning, Movie Time, Good Night)
- Run complex multi-step operations
- Pass parameters to macros from UI
Interface Layout
The UI Macros page uses a three-column layout:
Left Panel - Macro configuration:
- Macro selector
- Arguments editor
- Display name
- Icon selection
Center - Action buttons:
- Add ▶ - Add macro to UI
- ◀ Remove - Remove macro from UI
Right Panel - Current UI macros:
- List of macros assigned to selected UI
- Sorted by display order
- ▲ ▼ buttons to reorder
Configuration
Subsystem Selector
Select the subsystem to work with:
- Filters macros to those belonging to the subsystem
- Limits choices to relevant macros
- Required before selecting macro
Example: Select "Lighting" to see lighting-related macros
UI Selector
Select the target UI:
- Choose which UI to add macros to
- Shows macros currently assigned to this UI
- Required for add/remove operations
Example: Select "Kitchen Panel" to manage kitchen panel macros
Adding a Macro to a UI
-
Select Subsystem (e.g., Lighting)
-
Select UI (e.g., Living Room Panel)
-
In left panel, configure macro:
Macro - Select from subsystem macros
- Choose the automation to make available
- Only macros from selected subsystem appear
Args - Optional macro arguments (JSON)
- Provide parameters to macro
- Format:
{"param": "value"} - Example:
{"scene": "movie", "brightness": 30}
Name - Display name for UI button
- What users see on the macro button
- Can differ from macro name
- Example: Macro name "activate_movie_scene" → UI Name "Movie Time"
Icon - Icon filename
- Icon shown on macro button
- Located in theme's
/icons/directory - Example:
movie,bed,sun,moon
-
Click Add ▶ button
-
Macro appears in right panel (Current UI Macros)
-
Macro button now appears in the UI under the subsystem control
Removing a Macro from a UI
- Select Subsystem
- Select UI
- In right panel, select the macro to remove
- Click ◀ Remove button
- Confirm removal
- Macro no longer appears in that UI
Note: This doesn't delete the macro, only removes it from this UI.
Reordering UI Macros
Macros display in the order specified by sort_index:
- In right panel, select a macro
- Click ▲ to move up (earlier in list)
- Click ▼ to move down (later in list)
- Order updates immediately
Display Impact: Macro buttons in the UI appear in this order.
Macro Arguments
Macros can accept parameters that customize their behavior:
Static Arguments
Set when assigning macro to UI:
{
"brightness": 75,
"color_temp": 2700,
"scene_name": "evening"
}
Macro steps can reference these arguments:
{args.brightness}→ 75{args.color_temp}→ 2700{args.scene_name}→ "evening"
Use Cases
Scene Variations:
Macro: set_lighting_scene
UI Macro 1: "Bright" - Args: {"level": 100}
UI Macro 2: "Dim" - Args: {"level": 30}
UI Macro 3: "Night" - Args: {"level": 10}
Same macro, different arguments, different buttons
Location-Specific:
Macro: announce_message
UI Macro (Kitchen): Args: {"location": "kitchen"}
UI Macro (Bedroom): Args: {"location": "bedroom"}
Macro announces to appropriate audio zone based on location
Common Workflows
Adding Scene Buttons to a UI
To add "Good Morning", "Good Night", and "Movie Time" to living room panel:
-
Select Subsystem: Lighting (or "Scenes" if you have one)
-
Select UI: Living Room Panel
-
For each scene:
Good Morning:
Macro: good_morningArgs: {} (none needed)Name: Good MorningIcon: sunClick Add ▶
Good Night:
Macro: good_nightArgs: {} (none needed)Name: Good NightIcon: moonClick Add ▶
Movie Time:
Macro: movie_sceneArgs: {} (none needed)Name: Movie TimeIcon: movieClick Add ▶
-
Use ▲ ▼ to arrange in desired order
-
Macros appear as buttons in living room panel
Creating Mode Buttons
For "Home", "Away", and "Vacation" modes:
- Create macros for each mode (see Macros)
- Select Subsystem: Security (or System)
- Select UI: Main Panel
- Add each mode macro with appropriate icons
- Users can switch modes with one tap
Adding All-Off Buttons
For "All Lights Off" per floor:
- Create macros:
first_floor_lights_offsecond_floor_lights_off
- Select Subsystem: Lighting
- Select UI: Main Panel
- Add each macro:
Name: "First Floor Off"Icon: power_off
Macro Display in UIs
Where Macros Appear
UI Macros appear in control pages, organized by subsystem:
Example: In Lighting control page:
┌─────────────────────────┐
│ LIGHTING │
├─────────────────────────┤
│ Zones: │
│ ☐ Entry Hall │
│ ☐ Living Room │
│ ☐ Kitchen │
├─────────────────────────┤
│ Macros: │
│ [🌅 Good Morning] │
│ [🌙 Good Night] │
│ [🎬 Movie Time] │
│ [⚡ All Off] │
└─────────────────────────┘
Macro Button Appearance
Macro buttons typically display:
- Icon (if specified)
- Name
- Loading state when executing
- Success/failure feedback
Icons
Macro icons are stored in the active theme's /icons/ directory.
Standard Macro Icons
Common icons for macros:
sun- Morning/day scenesmoon- Night scenesmovie- Entertainment scenesbed- Bedtime scenespower_off- All off macroshome- Arrival scenesaway- Departure scenesparty- Party modesdinner- Dining scenes
Upload custom icons via UI > UI Themes page.
Best Practices
-
Descriptive Names: Use clear names users will understand
- Good: "Movie Time", "Goodnight", "All Off"
- Bad: "macro_1", "scene_a", "test"
-
Logical Grouping: Assign macros to appropriate subsystems
- Lighting macros → Lighting subsystem
- Security macros → Security subsystem
- Multi-subsystem macros → Choose primary subsystem
-
Limit Quantity: Don't overcrowd UIs with too many macros
- 3-6 macros per subsystem is reasonable
- More than 10 becomes cluttered
-
Icon Consistency: Use consistent icon style from theme
-
Ordering: Place most-used macros first
-
Testing: Test macros before adding to UI
-
Arguments: Document macro arguments in macro description
-
Naming Conventions: Differentiate macro name from UI display name
- Macro name:
activate_movie_scene(descriptive, technical) - UI name: "Movie Time" (user-friendly, concise)
- Macro name:
Advanced Topics
Macro Arguments Object Editor
The Args field uses the ObjectEditor component:
Simple Key-Value:
{"level": 80}
Complex Objects:
{
"scene": "evening",
"zones": [1, 2, 3],
"settings": {
"brightness": 50,
"color": "#FF8800"
}
}
Arrays:
["zone_1", "zone_2", "zone_3"]
Conditional Macros
Create UI macros that behave differently based on args:
Macro: set_scene
UI Macro 1: "Bright"
Args: {"scene": "bright", "level": 100}
UI Macro 2: "Reading"
Args: {"scene": "reading", "level": 80, "color_temp": 4000}
UI Macro 3: "Relax"
Args: {"scene": "relax", "level": 30, "color_temp": 2700}
The macro reads args.scene, args.level, etc. and sets zones accordingly.
Macro Templates
For similar UIs with different macros:
- Create standard set of UI macros for template UI
- Duplicate UI
- Modify macro assignments as needed
- Saves time vs. adding macros individually
Troubleshooting
Macro Button Not Appearing
Check:
- Subsystem Match: Macro subsystem matches control subsystem
- UI Assignment: Macro is assigned to correct UI
- Macro Enabled: Macro itself is enabled (Automation > Macros)
- Control Enabled: UI control for subsystem is enabled
- Browser Cache: Clear cache and reload
Macro Button Not Working
Check:
- Macro Valid: Macro executes successfully when run manually
- Arguments: Verify JSON arguments are valid
- Permissions: User role allows executing macros
- Macro Steps: All steps are valid and configured
- Logs: Check system logs for errors
Wrong Arguments Passed
Check:
- JSON Format: Args must be valid JSON
- Quotes: Use double quotes for JSON (not single)
- Syntax: ObjectEditor validates on save
- Macro Compatibility: Macro must support the arguments
Cannot Remove Macro
Check:
- UI Selected: Verify UI is selected
- Subsystem Selected: Verify subsystem is selected
- Macro Selected: Select macro in right panel before clicking Remove
- Permissions: User has permission to modify UI macros
Related Documentation
- Macros - Creating and managing macros
- UIs - Managing user interfaces
- UI Controls - Navigation configuration
- UI Themes - Icon management