Eclipse Ditto is a framework for providing the "Digital Twin" pattern for IoT applications in order to interact with IoT devices.
That means that Ditto mirrors physical devices as digital representations in the cloud.
As a web or mobile app developer you can interact with those digital twins as if they were any other web service, that's why Ditto enables a "device as a service" paradigm.
A few of the main features are access control, a search over all twin data and push notifications.
There are various APIs in order to interact with the devices: an HTTP and WebSocket API, additionally the capability to integrate with other systems via AMQP, MQTT and Apache Kafka.
Ditto scales horizontally, so managing millions of twins is what it is designed for.
The benefit when developing IoT applications or solutions is that no own backend must be implemented, the focus can be set on the use case: for example device integration and app or web UI implementation.
IoT solutions have to interact with a heterogeneous set of device types, device protocols and communication patterns.
To bring back simplicity to IoT developers, Eclipse Ditto exposes a unified resource-based API that can be used to interact with devices, abstracting from the complexity of different device types and how devices are connected. It helps to structure the devices into their distinct aspects of functionality and can optionally enforce data types and data validation based on a formal device meta model (Eclipse Vorto).
As devices are equipped with a public API (potentially public on the Internet), it is crucial to define on a device level which individuals are allowed interact with the devices. Ditto ensures that access to the device API is only granted for authorized individuals. Authentication is not scope of Ditto and delegated to existing identity providers.
With this approach your devices are turned into services with a hosted, always accessible and available API.
Devices managed by Ditto are usable as easy as any of the other services (like weather, maps, ...) within your application.
State management for Digital Twins
A digital representation of physical devices consists at its heart of the state these devices.
For IoT solutions the following information regarding state is most relevant:
- Device and sensor properties like temperature, location, level, fault information, etc.
- Configuration properties of sensors and actors like thresholds, intervals, ranges, toggles and limits, etc.
A good representation of this state in a Digital Twin should support different perspectives for these properties:
- Reported property values based on the last transmission to the back end
- Desired target property value for configuration properties
- Live perspective reflecting the properties values at the current point of time
The state management provides access to all three different perspectives and helps in synchronizing between them.
Organize your set of Digital Twins
When interacting with huge amounts of devices, it can get difficult to keep track of which devices and devices types are there and how they are related (e.g. spatially).
It is wise to add meta data like e.g. manufacturer, model information, static geographic location, serial number or software version to devices in order to find them again later.
That meta data as well as the state data is automatically indexed by Ditto which leads to fast search responses provided by the search API, even when there are millions of devices to search in.
When working with sets of devices authorization information is used to determine the visibility of devices to individuals and control who can change device data.
Features at a glance
The described functionality is offered by Ditto in form of the following features:
- Unified resource-based HTTP JSON API representing devices
- Definition of a simple "Digital Twin State Management Protocol" using JSON for command- and events-based interaction with devices
- Websocket API based on this protocol in addition to the resource-based HTTP API
- Establishing and maintaining connections to AMQP 0.9.1, AMQP 1.0, MQTT and Apache Kafka endpoints
- Managing device meta data via APIs
- Optionally configure and enforce a schema for device state (via Eclipse Vorto)
- Schema evolution support for schema based device state
- Accessing and setting different state perspectives
- Notification about changes of device resources via HTTP Server-sent events (SSE)
- Authorization/Access control at device API enforcing that only allowed individuals may read/write
- Search HTTP API accepting predicate-based query language
- Emit events resulting from state changes of devices which can be used
- for building up a "transaction log" (e.g. using Apache Kafka)
- as source for stream processing (e.g. via Apache Spark Streaming)
- for building up additional persistence representations (e.g. into an InfluxDB providing optimized access to the history of a device's state properties)
- for transmitting data into data analytic tools (e.g. into an Apache Hadoop HDFS)
- Out-of-box integration with Eclipse Hono for communication with devices using standard or custom device protocols
Integrate Ditto in a IoT landscape
Ditto is especially useful in the context of a larger IoT landscape. In this landscape the other important aspects of a IoT solution like device communication or data analytics are covered by distinct components.
The following diagram shows a typical landscape for IoT solutions where Ditto brings in its functionality:
The most important integration aspect is the device communication. This is essential for the Digital Twins to really be twins of real-world physical devices.
In addition to provide a custom device communication layer Ditto will provide an out-of-the-box integration with Eclipse Hono to support device communication.
In this scenario Ditto uses Eclipse Hono in order to receive messages (e.g. state changes) from devices and to send messages (e.g. configuration changes) to devices.