Automation System
Automate your cannabis grow operations with intelligent rule-based automation supporting condition-based triggers, time-based schedules, and phase-based automation.
Overview
The automation engine provides comprehensive control over all aspects of your grow operation, from environmental control to scheduled tasks. Automation rules can trigger actions based on environmental conditions, time schedules, or plant phase transitions.
Automation Rule Types
Condition-Based Rules
Trigger actions when environmental parameters meet specific conditions.
Environmental Conditions
Monitor and respond to:
- Temperature (above/below threshold)
- Humidity (above/below threshold)
- pH level (above/below threshold)
- EC (Electrical Conductivity) levels
- CO₂ concentration
- Light intensity
- Soil moisture levels
Condition Operators
- Greater than (>)
- Less than (<)
- Equal to (=)
- Between (range)
Time-Based Rules
Schedule actions using cron expressions with timezone support.
Cron Scheduling
Flexible scheduling with standard cron syntax:
- Minute, hour, day, month, weekday
- Wildcards and ranges
- Timezone-aware execution
Common Schedules
- Light cycles (18/6, 12/12)
- Daily watering schedules
- Feeding schedules
- Phase transition schedules
Phase-Based Automation
Automatically adjust settings when plants transition between growth phases.
- Phase detection and transition monitoring
- Phase-specific environmental targets
- Automatic light schedule adjustment
- Phase-specific watering and feeding schedules
Automation Actions
Automation rules can trigger various actions to control your grow environment.
Device Control Actions
Comprehensive device control with MQTT-based commands for all automation actions.
💡 Light Control
Full control over grow lights with scheduling and dimming capabilities.
- On/Off Control: Turn lights on/off with instant commands
- Brightness Control: Adjust dimming level from 0-100% with PWM control
- Light Schedules: Set cron-based schedules (18/6, 12/12, 24/0)
- Phase-Based Cycles: Automatically adjust light cycles on phase transitions
- Sunrise/Sunset: Gradual dimming simulation for natural light transitions
- Emergency Override: Manual override to prevent automation interference
💧 Watering Control
Automated irrigation systems with pump control and moisture-based triggers.
- Pump Control: Activate/deactivate water pumps with duration control
- Speed Control: Adjust pump speed (0-100%) for flow rate management
- Irrigation Duration: Set watering duration in seconds/minutes
- Soil Moisture Triggers: Automatic watering when soil moisture drops below threshold
- Multi-Zone Watering: Control multiple watering zones independently
- Schedule-Based: Time-based watering schedules with cron expressions
- Flow Sensors: Monitor water flow and detect issues
🧪 Dosing Control
Automated pH and EC adjustment with peristaltic pump control.
- pH Adjustment: Automatic pH up/down dosing to maintain target pH (6.0-7.0)
- EC Adjustment: Nutrient concentration adjustment via dosing pumps
- Dosing Schedules: Scheduled nutrient dosing with frequency control
- Multi-Reservoir: Control multiple nutrient reservoirs independently
- Safety Limits: Maximum dosing limits to prevent over-adjustment
- Dosing Calculations: Automatic calculation of dosing amounts based on current levels
- Target Maintenance: Maintain pH/EC within optimal ranges automatically
🌡️ Climate Control
Comprehensive climate management for optimal growing conditions.
- Fan Speed Control: Variable speed fan control (0-100%) based on temperature/humidity
- Humidifier Control: Automatic humidifier activation when humidity drops below target
- Dehumidifier Control: Automatic dehumidifier activation when humidity exceeds target
- CO₂ Injection: Automated CO₂ injection based on sensor readings (target: 1000-1500 ppm)
- HVAC Control: Temperature-based heating and cooling system control
- Air Circulation: Oscillating fan control for air movement
- Ventilation: Exhaust fan control for air exchange and temperature management
🔌 Valve Control
Solenoid valve control for precise water and nutrient flow management.
- Open/Close Control: Control solenoid valves for irrigation zones
- Duration Control: Set valve open duration for precise watering
- Multi-Valve Systems: Control multiple valves independently
⚡ Generic Device Control
Control any IoT device with generic on/off and value setting commands.
- Turn On/Off: Generic device power control
- Set Value: Set numeric values for devices (brightness, speed, temperature, etc.)
- Trigger Actions: Send custom commands to devices via MQTT
- Bulk Control: Control multiple devices simultaneously
Notification Actions
- Email notifications
- In-app alerts
- WebSocket real-time notifications
- Severity levels (info, warning, error, critical)
Rule Management
Priority System
Rules are executed based on priority levels:
- High Priority: Critical safety and environmental rules
- Medium Priority: Standard automation rules
- Low Priority: Convenience and optimization rules
Higher priority rules execute first when multiple rules trigger simultaneously.
Cooldown Periods
Prevent action spam with configurable cooldown periods:
- Time-based cooldown (e.g., 5 minutes, 1 hour)
- Per-rule configuration
- Prevents rapid on/off cycling
- Reduces device wear and power consumption
Rule Status
- Active: Rule is enabled and monitoring conditions
- Inactive: Rule is disabled
- Triggered: Rule has triggered and is in cooldown
Automation Examples
Real-world automation examples for common grow scenarios.
Example 1: Temperature-Based Fan Control
Rule Name: "High Temperature Exhaust"
Condition: Temperature > 80°F
Action: Turn on exhaust fan at 75% speed
Priority: High
Cooldown: 5 minutes
Target: Grow-level (all plants in grow)
Description: Automatically activate exhaust fan when temperature exceeds 80°F to prevent heat stress
Example 2: Vegetative Light Schedule
Rule Name: "Vegetative 18/6 Light Cycle"
Schedule: 0 6 * * * (6:00 AM daily) - Turn on
Schedule: 0 0 * * * (12:00 AM daily) - Turn off
Action: Turn on grow lights at 100% brightness
Priority: Medium
Phase: Vegetative only
Description: Maintain 18/6 light cycle during vegetative phase
Example 3: Flowering Light Schedule
Rule Name: "Flowering 12/12 Light Cycle"
Schedule: 0 6 * * * (6:00 AM) - Turn on
Schedule: 0 18 * * * (6:00 PM) - Turn off
Action: Turn on grow lights at 100% brightness
Priority: Medium
Phase: Flowering only
Description: Maintain 12/12 light cycle during flowering phase
Example 4: Soil Moisture Watering
Rule Name: "Low Soil Moisture Watering"
Condition: Soil Moisture < 30%
Action: Activate water pump for 2 minutes at 50% speed
Priority: Medium
Cooldown: 1 hour
Target: Plant-specific
Description: Automatic watering when soil moisture drops below 30%
Example 5: pH Adjustment
Rule Name: "pH Auto-Adjustment"
Condition: pH < 6.0 OR pH > 7.0
Action: Activate pH dosing pump (up if < 6.0, down if > 7.0)
Priority: High
Cooldown: 30 minutes
Target: Grow-level
Description: Maintain pH within optimal range (6.0-7.0) automatically
Example 6: High Humidity Control
Rule Name: "High Humidity Dehumidifier"
Condition: Humidity > 65%
Action: Turn on dehumidifier
Priority: High
Cooldown: 10 minutes
Target: Grow-level
Description: Prevent mold and bud rot by reducing humidity above 65%
Example 7: Low CO₂ Injection
Rule Name: "CO₂ Supplementation"
Condition: CO₂ < 1000 ppm AND lights are on
Action: Activate CO₂ injection system
Priority: Medium
Cooldown: 15 minutes
Target: Grow-level
Description: Boost CO₂ levels during light hours for enhanced growth
Example 8: Phase Transition Automation
Rule Name: "Auto Phase Transition - Flowering"
Trigger: Plant phase changes to "Flowering"
Actions:
1. Adjust light schedule to 12/12
2. Update temperature target to 65-80°F
3. Update humidity target to 40-50% RH
4. Send notification to user
Priority: High
Target: Plant-specific
Description: Automatically adjust all settings when plant enters flowering phase
Example 9: Scheduled Nutrient Feeding
Rule Name: "Weekly Nutrient Feed"
Schedule: 0 8 * * 1 (Every Monday at 8:00 AM)
Action: Activate nutrient dosing pump for 5 minutes
Priority: Medium
Cooldown: 7 days
Target: Grow-level
Description: Weekly automated nutrient feeding schedule
Example 10: Emergency Temperature Shutdown
Rule Name: "Emergency High Temperature"
Condition: Temperature > 95°F
Action:
1. Turn off all lights
2. Turn on all fans at 100%
3. Send critical alert
Priority: Critical
Cooldown: None
Target: Grow-level
Description: Emergency response to prevent plant damage from extreme heat
Scheduled Tasks
The scheduler service manages time-based automation with cron job support.
- Loads rules on startup and every 5 minutes
- Validates cron expressions before scheduling
- Tracks execution history (last 100 executions per task)
- Timezone-aware scheduling
- Integration with automation service for action execution
Common Schedules
- Light Cycles: 18/6 (vegetative), 12/12 (flowering), 24/0 (seedling)
- Watering: Daily at specific times, or based on soil moisture
- Feeding: Weekly nutrient schedules
- Monitoring: Periodic sensor readings and health checks
Setting Up Automation
- Create a Grow: Set up your grow operation in the system
- Register Devices: Register and configure your IoT devices
- Define Rules: Create automation rules with conditions and actions
- Set Priorities: Assign priority levels to rules
- Configure Cooldowns: Set appropriate cooldown periods
- Test Rules: Test automation rules in a controlled environment
- Monitor Execution: Monitor rule execution and adjust as needed
Best Practices
- Start Simple: Begin with basic rules and gradually add complexity
- Use Cooldowns: Always set cooldown periods to prevent device cycling
- Priority Management: Assign high priority to safety-critical rules
- Monitor Performance: Regularly review rule execution and adjust thresholds
- Test Changes: Test automation changes before deploying to production
- Document Rules: Keep notes on rule purposes and expected behavior
- Backup Configuration: Export and backup automation rules regularly