Why Do Smart Home Scenes Finish in Different Orders Under MQTT Redelivery?

Eva Wong is the Technical Writer and resident tinkerer at ZimaSpace. A lifelong geek with a passion for homelabs and open-source software, she specializes in translating complex technical concepts into accessible, hands-on guides. Eva believes that self-hosting should be fun, not intimidating. Through her tutorials, she empowers the community to demystify hardware setups, from building their first NAS to mastering Docker containers.

Smart home scenes can finish in different orders because MQTT preserves only limited delivery ordering while redelivery, concurrency, and device execution add separate timelines.

A scene may publish light, blind, speaker, and thermostat commands before a Wi-Fi interruption. After reconnection, an unacknowledged QoS message can be delivered again while later commands or other topics continue through different queues. Broker order, subscriber concurrency, retained state, duplicate handling, and each device’s physical completion time determine the order the household finally observes.

MQTT Orders Packets Within a Narrow Protocol Scope

TCP preserves bytes on one connection, and MQTT defines ordered handling for flows under specific QoS and in-flight conditions. It does not create one global order across publishers, topics, broker routes, subscribers, and device controllers.

MQTT Receive Maximum explains how MQTT 5 Receive Maximum limits unacknowledged QoS 1 and QoS 2 publishes. Setting a window of one strengthens ordered processing on a connection, while larger windows permit more throughput and more concurrent in-flight work.

A scene spread across several topics therefore has no universal sequence merely because its publish calls were issued in order. One subscriber may process serially while another dispatches callbacks concurrently, and their acknowledgments describe message transfer rather than completed physical action.

Redelivery Reintroduces an Earlier Command Into a Later State

QoS 1 provides at-least-once delivery, so an unacknowledged PUBLISH may appear again with its duplicate flag after reconnect. QoS 2 adds a handshake to deliver once to the receiving application, but session loss or application-level retries can still create new logical commands.

at-least-once delivery compares QoS 0, 1, and 2 and shows how acknowledgment exchanges trade throughput for delivery assurance. The key scene consequence is that reliability level governs message transfer, not whether a device operation is current or safe to repeat.

If command A is redelivered after command B already changed the device, the final state can regress. Commands need scene ID, step ID, desired-state version, expiry, and idempotent application so a late duplicate can be recognized rather than executed as fresh intent.

Device Completion Order Is Separate From Message Arrival Order

A bulb may acknowledge immediately, a blind may move for twenty seconds, and a thermostat bridge may queue work internally. Parallel subscribers, protocol bridges, sleeping devices, and rate limits can reorder completion even when MQTT delivery is perfectly serialized.

persistent session queues describes persistent sessions and queued messages that allow a broker to retain subscription and QoS state while a client is offline. Recovery improves continuity, but the queued work can represent old desired states unless the application attaches expiry and version semantics.

The failure boundary is demanding strict global order from MQTT alone. Serializing every message can reduce protocol reordering but cannot synchronize physical devices or undo stale commands. A scene engine must track desired state and completion conditions above the transport layer.

-15% OFF
Single board computer zimaboard2

Trace One Scene Across Disconnect and Redelivery

Publish a scene with numbered commands across one topic and then across several topics. Disconnect before acknowledgment, reconnect with different Receive Maximum values, and run subscribers in serial and concurrent modes while recording packet IDs, duplicate flags, scene versions, arrivals, acknowledgments, and device completion.

Use the event-time distinction in smart-home event time to compare broker order, subscriber order, and physical completion order. Add expiry and idempotency, then verify that a late duplicate cannot restore an older desired state. This distinction remains visible during later household testing.

Require global ordering only for steps whose dependency truly demands it. For independent devices, preserve concurrency and define a scene completion barrier; for dependent steps, use one authoritative state machine rather than assuming transport QoS is a workflow engine.

Tech & AI HUB

More to Read

Get More Builds Like This

Stay in the Loop

Get updates from Zima - new products, exclusive deals, and real builds from the community.

Stay in the Loop preferences

We respect your inbox. Unsubscribe anytime.