How to get historical sensor data of a registered Hono Device

404 Views Asked by At

I am trying to send the below sensor values from the registered device in Hono to Ditto in order to form the digital twin of the registered device.

I am using the below command.

curl -X POST -i -u sensor10@tenantAllAdapters:mylittlesecret -H 'Content-Type: application/json' -d '{"temp": 2307, "hum": 40000}' http://localhost:8080/telemetry
HTTP/1.1 202 Accepted
content-length: 0

I am able to receive the data in Ditto. How can I get to know the all the historical values that are send from the device to Ditto over a period of time.

1

There are 1 best solutions below

4
On BEST ANSWER

In Eclipse Ditto, you can't get historical data. Ditto is about representing the current state of the digital twin or for communicating directly with the real device both by applying authorization.

Historical values are not persisted in Ditto.

If you have the need to access historical data (which is completely understandable, very normal use case), you would - for example - add a connection in Ditto to an Apache Kafka which gets all twin change events and from that Kafka you can put the historical data somewhere better suited for persisting and querying such data, e.g. into a time series database like InfluxDB.

That's also how it's done (put the data in an optimized service for historical data) in the commercial solution which builds on Eclipse Ditto from Bosch, the Bosch IoT Suite.