Lock-in to break-out

Forward the data to where it is needed

In many cases IoT devices are transmitting their data to an service in the cloud. But not for all use-cases that service may offer the right functionality. In such cases it’s a brilliant idea to forward that data to an other service with that intended functionality.

That’s exactly, what the newest version of Californium[1] has improved a lot. You may remember my article[2] some weeks ago about using CoAP/DTLS 1-2 CID for efficient and reliable cellular device communication. The charts offered there are very simple. And to focus on the device communication, everything else is left out by intention.

cloudcoap sensors

If you now need more function, then the solution is to just forward the data to an other service. Maybe a “low code platform” as “blynk”, “datacake”, or “tago.io”. Or an use-case specific application-backend. As long as that supports REST (http), it’s pretty easy. Other protocols are not impossible, but will take some more time.

But stop, why then that CoAP thing at all? Why not using that other service directly? The answer is simple. If your device sends the data via https, including a TLS handshake, you will need to exchange up to 20 messages. If you use CoAP/DTLS 1.2 CID then in quite a lot cases only two messages are exchanged. That is ways more efficient. And ways more reliable. Bandwidth and data loss is mainly a topic for the cellular link from the device to the cloud. For the link from cloud to cloud it’s usually much less challenging.

Therefore first use CoAP and then forward the data with HTTP.

To enable that in the open source CoAP-S3-proxy, extend the device configuration:

cali.352656100985434=Demo
.label=Thingy:91 to Tago.io 
.rpk=MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEg7kXirJFD6tg2BWLxrP+dzv/2rzcviq12MAGC+dkmjbbJK9I7RvkZB+Cw31FOJFi/ipP+NfnqsFLUKza9Rvmlw==
.fdest=https://api.tago.io/data
.fauth=Header device-token: 26??????-b???-4???-a???-43??????????
.fdevid=NONE
.fresp=.*"status":\s*true,.*

That’s it. Everything else will then be needed to be done in the target service.

[1] Eclipse/Californium - CoAP-S3-Proxy

[2] Cloudcoap - Because it Works