This article explores the critical epistemological gap in event-driven IoT systems where reported device state often diverges from physical reality due to network effects and out-of-order event processing. It highlights how implicit assumptions about event ordering lead to "justified wrongness" and proposes a multi-signal arbitration model to establish explicit confidence in device state, crucial for reliable automation and monitoring.
Read original on Dev.to #architectureIn distributed IoT systems, a fundamental challenge arises from the distinction between a justified belief (what the system infers from available data) and a true belief (the actual physical state of a device). Network latency and independent routing paths can cause events, like a disconnect and a subsequent reconnect, to arrive out of order. This leads to scenarios where monitoring systems confidently report an incorrect device status, triggering false alerts or incorrect automation, despite processing all events correctly based on their arrival sequence. This is not a bug, but an architectural flaw rooted in implicit assumptions about event ordering.
The Problem of "Justified Wrongness"
Systems operating on an implicit assumption that event arrival order equals generation order will inevitably make wrong decisions about device state in the presence of network reordering. This "justified wrongness" accumulates at scale and is often incorrectly categorized as normal operational expense rather than a solvable engineering problem.
To accurately determine device state, an arbitration layer needs to go beyond simple event arrival order. It must evaluate multiple signals to establish the true temporal relationship and reliability of events. The article outlines a "five-step multi-signal arbitration model" that considers several critical factors:
By weighting these signals, the system can produce a verdict significantly more likely to correspond to physical reality. This model has been validated in production environments.
The proposed solution involves inserting a device state arbitration layer between the MQTT broker (or similar message broker) and downstream consumers (historian, monitoring, automation). This layer transforms a simple status string into a structured verdict, which includes:
This explicit confidence mechanism ensures that downstream systems understand the reliability of the state information they are consuming, enabling more robust and adaptive responses. This architectural change shifts device state from an assumed truth to an inferred verdict with explicit evidence quality, directly addressing the principle of explicit assumptions in distributed systems.