Adaptive Automation Engine: A Self-Learning Smart Home
Manually configured automation scenes inevitably conflict — Movie Mode dims lights while Reading Mode brightens them, or Eco Mode turns off the A/C while Sleep Mode needs it cold. An Adaptive Automation Engine learns household patterns and resolves conflicts automatically.
Three-Layer Architecture
Layer 1: Occupancy Learning Node-RED logs all state changes to InfluxDB. Flux queries over 30-day windows build a Typical Day Profile with time-slot occupancy probabilities, separated by weekday and weekend. The engine uses this profile to anticipate which scenes are likely needed, pre-loading contexts before users trigger them.
Layer 2: Scene Priority Matrix Each scene has a priority score (Security Alert: 100, Sleep Mode: 80, Movie Mode: 60, Reading Mode: 50, Eco Mode: 30) and a domain list specifying which entity types it controls. Conflicts only occur when two active scenes share domain overlap.
Layer 3: Conflict Detection (Node-RED Function Node) A custom function node maintains an active scenes registry. When a new scene activates, it checks for domain overlap with existing scenes. Higher-priority scenes win; lower-priority conflicting scenes are automatically deactivated. Non-overlapping scenes coexist without interference.
Audit Logging
Every activation, deactivation, and conflict resolution is logged to InfluxDB with a boolean tag. A Grafana dashboard displays weekly conflict frequency — the primary KPI for engine tuning.
Learning and Auto-Suggestion
After 30 days the engine analyzes patterns: if users routinely cancel Eco Mode within 10 minutes of activation, it suggests raising its priority or adjusting its schedule. Weekly LINE reports highlight frequent conflicts and propose rule adjustments.
Measured Outcomes
In a 60-day Bangkok pilot: automation conflicts reduced 78%, manual overrides reduced 45%, and self-reported comfort score improved from 7.2/10 to 8.8/10.
