Hub - Event Playback Queue

Today I had a question about the HUB going offline and was happy to find the SmartThings HUB FAQ had a section addressing it; (see url and quote at the end of text below). After reading it, I had a number of questions about the queued events being sent.

  1. What are the timestamps of these events?
  2. Is the order of events guaranteed to be correct?
  3. What is the timing of these events? i.e. how fast are they played back?
  4. While these events are being played back, will new events be appended to the back of the queue?
  5. Is there a limit to how many events can be queued? And if so, which events are discarded?
  6. What is the state of the system during playback? e.g. currentState(), lastActivity(), statesSince(), eventsSince(), etc.

Off hand it raises a number of concerns:

  1. Potential for concurrency issues.
  2. Out of sync with external events; e.g. I/O that is not on the hub.
  3. Issues with event handlers running background tasks; e.g. runIn().
  4. The possibility of event handlers firing things off rapidly; e.g. turning something on/off/on/off may be hard on the equipment.
  5. Logic issues with the state of the system; e.g. currentState().

Thus, I thought I’d see if the community could help put some of this in perspective.

Granted, internet issues may not be frequent; but I’d like to set some expectations for when they do occur. I’m sure there are many drivers and apps that it won’t be much of an issue. But I anticipate some cases where the logic should be updated to handle these situations a little better.

I welcome your input. -RF


SMARTTHINGS HUB FAQ

https://docs.smartthings.com/en/latest/sept-2015-faq.html#samsung-smartthings-hub-faq

"What happens when the internet to the Hub goes out?

Provided there is still power to the Hub (wired or battery), any SmartApps that are able to execute locally will still run without an internet connection. The mobile app will report the Hub is offline, and because there are no events being sent to the SmartThings cloud, notifications will not work.

The radios in the Hub will still function without internet. Events to the cloud will be queued, and sent when the internet is restored."