Journal

Adaptive Automation Engine: Node-RED Conflict Resolution and Occupancy Learning for Smart Home

Adaptive Automation Engine: Node-RED Conflict Resolution และ Occupancy Learning สำหรับ Smart Home

May 12, 2026 · 1 min read
Adaptive Automation Engine: Node-RED Conflict Resolution and Occupancy Learning for Smart Home

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.

Questions & answers

Is programming knowledge required?
Basic JavaScript for Node-RED function nodes and Flux query language for InfluxDB are needed. Those new to the stack can start with Node-RED visual flow programming before adding custom function nodes for conflict detection.
Can Home Assistant automations replace Node-RED here?
Partially — Home Assistant supports conditions and basic priority, but lacks sophisticated multi-scene conflict detection. For simple homes, HA automation may suffice; for complex multi-scene environments, Node-RED is recommended.
Where is occupancy learning data stored?
In InfluxDB on a local server (Raspberry Pi 5 or Intel NUC). No data leaves the home network. Retention policy: raw events for 90 days, aggregated occupancy profiles for 2 years.

Related reading