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.
- What are the timestamps of these events?
- Is the order of events guaranteed to be correct?
- What is the timing of these events? i.e. how fast are they played back?
- While these events are being played back, will new events be appended to the back of the queue?
- Is there a limit to how many events can be queued? And if so, which events are discarded?
- What is the state of the system during playback? e.g. currentState(), lastActivity(), statesSince(), eventsSince(), etc.
Off hand it raises a number of concerns:
- Potential for concurrency issues.
- Out of sync with external events; e.g. I/O that is not on the hub.
- Issues with event handlers running background tasks; e.g. runIn().
- The possibility of event handlers firing things off rapidly; e.g. turning something on/off/on/off may be hard on the equipment.
- 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
"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."