Automations

Create intelligent automations using Homix's visual automation designer.

Visual Automation Designer

Homix features a powerful drag-and-drop automation designer that makes creating complex automations intuitive. No coding required!

Designer Features

  • Visual Flow: See your automation logic at a glance
  • Drag & Drop: Build automations by connecting components
  • Real-time Testing: Test automations as you build them
  • Variable Support: Use dynamic values with template variables

Automation Components

The automation designer includes several categories of components:

Triggers

Triggers start your automations when specific events occur:

πŸ“± Device State Changed

Triggers when a device changes state (light turns on, door opens, etc.)

πŸ“‘ NATS Event

Listen for events on NATS subjects with wildcard support

⏰ Time & Schedule

Trigger at specific times or on cron schedules

πŸŒ… Sunrise/Sunset

Solar-based triggers that adjust to your location

πŸ”„ Interval

Regular interval triggers (every 5 minutes, hourly, etc.)

πŸ’Ύ State Changed

Triggers when KV store values change

Actions

Actions define what happens when an automation triggers:

πŸŽ›οΈ Control Device

Send commands to devices (turn on lights, adjust temperature)

πŸ“€ Publish NATS Event

Publish custom events to NATS subjects

πŸ’Ύ Update State

Update values in the KV store

🎬 Activate Scene

Activate predefined scenes

πŸ“’ Send Notification

Send notifications to mobile devices or services

⏸️ Delay

Add delays between actions

Conditions

Conditions control when actions execute:

πŸ“± Device State Is

Check if device is in specific state

⏰ Time Between

Check if current time is within range

πŸ“… Day of Week

Check specific days of the week

πŸ”’ Numeric Compare

Compare numeric values with operators

πŸŒ… Sun Position

Check if sun is up or down

Logic Components

Logic components provide flow control and decision making:

πŸ”€ AND/OR/NOT Gates

Boolean logic operations

πŸ”€ Switch

Route flow based on values

πŸ”’ Counter

Count events and trigger actions

⏱️ Timer

Time-based logic and delays

Building Your First Automation

Let's create a simple automation that turns on lights when you arrive home:

  1. Open the Homix dashboard and navigate to "Automations"
  2. Click "Create New Automation"
  3. Drag a "Device State Changed" trigger to the canvas
  4. Configure it to trigger when your phone's location changes
  5. Add a "Device State Is" condition to check if you're home
  6. Add a "Control Device" action to turn on the lights
  7. Connect the components by dragging from output to input ports
  8. Save and enable the automation

Pro Tip

Start with simple automations and gradually add complexity. Test each component individually before connecting them together.

Advanced Automation Patterns

Presence Detection

Create smart presence-aware automations:

Phone Tracking: Use device tracker integrations
Motion Sensors: Detect movement in rooms
Door Sensors: Track entry and exit
Bluetooth Beacons: Room-level presence detection

Environmental Automations

Respond to environmental changes automatically:

Climate Control

Adjust temperature based on weather, occupancy, and time of day.

Lighting

Automatically adjust brightness and color temperature throughout the day.

Security

Activate security measures when nobody's home or during specific times.

Multi-Stage Automations

Create complex automations with multiple stages:

# Example: Bedtime Routine
1. Trigger: Time is 10:00 PM
2. Condition: Anyone is home
3. Action: Dim living room lights to 30%
4. Delay: 30 minutes
5. Action: Turn off all lights except bedroom
6. Action: Set thermostat to night mode
7. Action: Activate security system

State Management in Automations

Using Variables

Automations support template variables for dynamic behavior:

{{device.state}} - Current device state
{{trigger.time}} - When the automation was triggered
{{user.name}} - User who triggered the automation
{{weather.temperature}} - Current temperature
{{kv.key_name}} - Value from KV store

Persistent State

Store automation state in the KV store for complex logic:

  • Counters: Track how many times something happened
  • Timestamps: Remember when events occurred
  • Flags: Store boolean states for conditions
  • User Preferences: Store user-specific settings

Testing and Debugging

Automation Testing

Test your automations before deploying:

  1. Manual Testing: Use the "Test" button in the designer
  2. Simulation: Use the device simulator to trigger events
  3. Dry Run: Enable dry-run mode to see what would happen
  4. Logging: Review automation logs for debugging

Common Issues

Automation Not Triggering

  • Check if automation is enabled
  • Verify trigger conditions are met
  • Review NATS subject patterns
  • Check device connectivity

Actions Not Executing

  • Verify device states and commands
  • Check condition logic
  • Review variable substitutions
  • Test individual components

Performance Issues

  • Limit trigger frequency
  • Use specific NATS subjects
  • Optimize condition checking
  • Review automation complexity

Automation Examples

Welcome Home

Turn on lights and adjust climate when arriving home:

Trigger: Device tracker shows "home"
Condition: Sun is down
Actions: Turn on entry lights, set thermostat to 72Β°F

Energy Saving

Automatically reduce energy consumption when nobody's home:

Trigger: All phones leave home
Actions: Turn off non-essential lights, set thermostat to away mode, turn off entertainment devices

Security Alert

Send notifications for unexpected activity:

Trigger: Motion detected
Conditions: Nobody home AND time between 9 AM - 5 PM
Actions: Send notification, record security footage, turn on lights

Best Practices

Design Guidelines

  • Start Simple: Begin with basic automations and add complexity gradually
  • Test Thoroughly: Test all edge cases and failure scenarios
  • Use Meaningful Names: Name automations clearly for easy maintenance
  • Document Logic: Add descriptions for complex automation logic
  • Monitor Performance: Watch for automations that trigger too frequently

Maintenance

  • Regularly review automation logs
  • Update automations when adding/removing devices
  • Archive unused automations
  • Keep automation count reasonable for performance
  • Version control automation configurations

Related Documentation