Internet of Things Patterns
This is an excerpt of the pattern that was first published in [1].

Device Shadow

Icon of the Device Shadow pattern

Some device are only intermittently online. To allow other components to interact with them regardless of their connection state, store a persistent virtual representation of the devices online. Use this representation for all communication and synchronize it with the device once it is back online.

Aliases:

Thing Shadow, Virtual Device

Context:

Devices, such as Constrained Devices, Semi-Constrained Devices, and Unconstrained Devices, are often Normally-Sleeping Devices or Always-On Devices. Either because of their operation modes or because of external circumstances, these devices might be offline at various times.

Problem:

Some devices will be only intermittently online in order to save energy or because of network outages. Other components want to interact with them but do not know when they will be reachable.

Forces:

  • Availability: Sending commands to or reading state from offline devices is not possible.

  • Timeliness: Waiting for currently offline device to come online again to send or receive data in a synchronous fashion can lead to long idle times and should be avoided.

  • Consistency: Often a slightly out-of-date state is better than no state.

Solution:

Store a persistent virtual representation of each device on some backend server. Include the latest received state from the device, as well as commands not yet sent to the device. Do all communication from and to the device through this virtual version. Synchronize the virtual representation with the actual device state when the device is online.

Solution sketch of the Factory Bootstrap pattern

Solution Details:

This is an excerpt of a previously published pattern. The full pattern can be found in [1].


Benefits:
Drawbacks:

Variants:

Related Patterns:

Known Uses:

  1. L. Reinfurt, U. Breitenbücher, M. Falkenthal, F. Leymann, and A. Riegg, “Internet of Things Patterns,” in Proceedings of the 21st European Conference on Pattern Languages of Programs (EuroPLoP), ACM, 2016. Available at http://dl.acm.org/citation.cfm?id=3011789