Let's make a #CBOR Payload Formatter for #TheThingsNetwork
#CBOR works great for compressing Sensor Data sent to #TheThingsNetwork ... But each app needs to decode the CBOR Sensor Data
Thanks to #TheThingsNetwork Payload Formatter, we can decode CBOR in the cloud ... And send JSON to the apps!
Payload Formatters are plain old JavaScript functions (not Node.js) ... That will run on #TheThingsNetwork Servers to decode our #LoRaWAN Message Payload
https://www.thethingsindustries.com/docs/integrations/payload-formatters/javascript/
Top part of our #CBOR Payload Formatter for #TheThingsNetwork is exactly the same as "cbor-js" ... Our special stuffing is below
https://github.com/lupyuen/cbor-the-things-network/blob/master/cbor.js
Remember to handle JavaScript Errors in our #CBOR Payload Formatter for #TheThingsNetwork
https://github.com/lupyuen/cbor-the-things-network/blob/master/cbor.js#L410-L441
Paste our CBOR Payload Formatter JavaScript into #TheThingsNetwork at Application > Payload Formatters > Uplink
https://www.thethingsindustries.com/docs/integrations/payload-formatters/javascript/
#TheThingsNetwork now decodes our #CBOR Payload yay! 🎉
#TheThingsNetwork now returns the Decoded #CBOR Payload to all our apps: Prometheus, Grafana, Roblox, ...
Decoding #CBOR Sensor Data in #TheThingsNetwork with a Payload Formatter ... All shall be explained in this (short) article
What's a Payload Formatter in #TheThingsNetwork?
https://lupyuen.github.io/articles/payload?2#whats-a-payload-formatter
How we decode #CBOR Sensor Data in our Payload Formatter for #TheThingsNetwork
https://lupyuen.github.io/articles/payload?3#cbor-payload-formatter
Installing our #CBOR Payload Formatter into #TheThingsNetwork
https://lupyuen.github.io/articles/payload?4#configure-payload-formatter
Testing our CBOR Payload Formatter for #TheThingsNetwork ... With #PineDio Stack BL604
https://lupyuen.github.io/articles/payload?5#run-payload-formatter
Up next: Prometheus + Grafana with #TheThingsNetwork!
Here's how we decode CBOR Sensor Data inside #TheThingsNetwork ... With a #CBOR Payload Formatter
"cbor-js" is a plain old JavaScript Decoder for #CBOR ... Let's port this to #TheThingsNetwork as Payload Formatter
https://github.com/paroga/cbor-js