Automation Rules¶
Create intelligent automations with debounce, hysteresis, and timers
๐ What Are Automation Rules?¶
Automation rules trigger relay actions when sensor values meet conditions. All rules include 60-second debounce to prevent false triggers.
๐ฏ Rule Components¶
| Component | Description |
|---|---|
| Sensor | Temperature, Humidity, Soil1, Soil2, Rain |
| Condition | Above / Below / Equal |
| Threshold | Value that triggers |
| Action | Turn ON / Turn OFF / Toggle relay |
| Deactivation | Hysteresis or Timer |
| Cooldown | Minutes to wait before re-triggering |
๐ก๏ธ Temperature Example: Fan Control¶
Goal: Turn on fan when temperature exceeds 30ยฐC, off when below 26ยฐC
| Setting | Value |
|---|---|
| Sensor | Temperature |
| Condition | Above |
| Threshold | 30ยฐC |
| Action | Turn ON |
| Target Relay | Relay 2 (Fan) |
| Deactivation Type | Hysteresis |
| Return Value | 26ยฐC |
| Cooldown | 5 minutes |
How it works: 1. Temperature > 30ยฐC โ Wait 60 seconds โ Fan ON 2. Temperature < 26ยฐC โ Fan OFF 3. Prevents rapid cycling
๐ง Soil Moisture Example: Auto-Watering¶
Goal: Water plants when soil is dry, stop when wet
| Setting | Value |
|---|---|
| Sensor | Soil1 |
| Condition | Below |
| Threshold | 30% (dry) |
| Action | Turn ON |
| Target Relay | Relay 3 (Pump) |
| Deactivation Type | Hysteresis |
| Return Value | 60% (wet) |
| Cooldown | 10 minutes |
How it works: 1. Soil < 30% โ Wait 60 seconds โ Pump ON 2. Soil > 60% โ Pump OFF 3. 10-minute cooldown protects pump
โ Rain Example: Automatic Window Closing¶
Goal: Close window when heavy rain detected
| Setting | Value |
|---|---|
| Sensor | Rain |
| Condition | Above |
| Threshold | 80% |
| Action | Turn ON |
| Target Relay | Relay 4 (Window Motor) |
| Deactivation Type | Hysteresis |
| Return Value | 50% |
| Cooldown | 1 minute |
How it works: 1. Rain intensity > 80% โ Wait 60 seconds โ Window closes 2. Rain < 50% โ Window opens 3. 60-second debounce prevents false triggers from splashes
โฑ๏ธ Timer Mode Example: Temporary Action¶
Goal: Turn on light for 30 seconds when motion detected
| Setting | Value |
|---|---|
| Sensor | PIR (as soil1/digital) |
| Condition | Above |
| Threshold | 50 |
| Action | Turn ON |
| Target Relay | Relay 1 (Light) |
| Deactivation Type | Timer |
| Timer Duration | 30 seconds |
| Cooldown | 5 seconds |
How it works: 1. Motion detected โ Wait 60 seconds โ Light ON 2. Light stays ON for 30 seconds 3. Auto turns OFF 4. Ready for next detection
๐ง Best Practices¶
Cooldown Recommendations¶
| Relay Type | Recommended Cooldown |
|---|---|
| Fan/Heater | 5 minutes |
| Water Pump | 10 minutes |
| Light/LED | 1 minute |
| Alarm/Siren | 30 seconds |
| Window Motor | 1 minute |
Debounce (Built-in)¶
- 60 seconds for all rules (automatic)
- Prevents false triggers from sensor noise
- Requires stable reading before acting
Threshold Tips¶
- Temperature: 2-5ยฐC hysteresis gap
- Humidity: 10-15% gap
- Soil moisture: 20-30% gap
- Rain: 30% gap
๐ฑ Creating Rules in Dashboard¶
- Go to Automation page
- Click "Create Rule"
- Select device
- Choose sensor type
- Set threshold
- Choose action and relay
- Set deactivation type
- Configure cooldown
- Click Save
Rules sync to device immediately via MQTT.
๐งช Testing Your Rules¶
- Simulate - Use a hair dryer for temperature, water for soil
- Watch logs - Monitor debounce progress
- Verify - Check relay toggles correctly
- Adjust - Fine-tune thresholds as needed
โ Common Questions¶
Q: Why 60-second debounce?
A: Prevents false triggers from disconnected sensors or electrical noise.
Q: Can I disable debounce?
A: No, it's built-in for reliability.
Q: Multiple rules on same relay?
A: Not allowed - each relay can have only one active rule.
Q: Do rules work offline?
A: Yes, rules run locally on the device.
๐ Next Steps¶
๐ Start automating your world with OceanRemote!