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:
- Open the Homix dashboard and navigate to "Automations"
- Click "Create New Automation"
- Drag a "Device State Changed" trigger to the canvas
- Configure it to trigger when your phone's location changes
- Add a "Device State Is" condition to check if you're home
- Add a "Control Device" action to turn on the lights
- Connect the components by dragging from output to input ports
- 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:
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:
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 storePersistent 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:
- Manual Testing: Use the "Test" button in the designer
- Simulation: Use the device simulator to trigger events
- Dry Run: Enable dry-run mode to see what would happen
- 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:
Condition: Sun is down
Actions: Turn on entry lights, set thermostat to 72Β°F
Energy Saving
Automatically reduce energy consumption when nobody's home:
Actions: Turn off non-essential lights, set thermostat to away mode, turn off entertainment devices
Security Alert
Send notifications for unexpected activity:
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
- Device Management - Managing devices used in automations
- Scenes - Using scenes in automations
- NATS Messaging - Understanding the messaging system
- Troubleshooting - Debugging automation issues