AllThingsTalk ABCL definition for decoding TTN payload

(Danny Engelman) #1

The documentation:

does not specify how to decode the binary payload coming from TTN

So I get:

Before I start digging into custom-payload-conversion-get-started-with-abcl

Has anyone got the ABCL format?


(Eivind Holt) #2

Found anything? I am sending battery voltage as a 2 byte integer. By the debug information in ATT I suspect that it passes the LoRa payload, no matter what I do during decode?

10 8B is my value:
Nothing parsed from payload 10 8b. Errors:

JSON: ‘utf-8’ codec can’t decode byte 0x8b in position 1: invalid start byte

CBOR: ‘int’ object has no attribute ‘items’

ABCL: Offset 4 is not a valid starting boundary

Input not a dict.

(Arjan) #3

Maybe it indeed doesn’t use the result of some TTN Console payload function if that’s what you’re referring to (I remember some discussion on Slack, but it seems that’s no longer to be found in its history). But in case it does: what’s your decoder then? And did you try without such decoder?

Same applies when this is about a decoder at AllThingsTalk.

JSON: ‘utf-8’ codec can’t decode byte 0x8b in position 1: invalid start byte

Given the error I’d assume it’s getting JSON (which it might not get without a payload function?) in which the raw byte values are included as text (while binary content often cannot be expressed as text, and needs something such as Base64 encoding to get proper text instead). But without seeing any code those are just wild guesses.

(Eivind Holt) #4

Sorry about the lack of details, I was hoping for experience from people who have made this integration work. In particular I am wondring if @DannyE has made any progress.

My first attempts involved simple decoders returning straight a 2-byte value (voltage). I realised this made no difference in my simple example and tried disabling the decoder. The error mentioned did not change as far as I noticed.

I then made a decoder looking something like this:

function Decoder(bytes, port) {
var decoded = {};
decoded.value = “asdf”;
return decoded;

and changed the Asset Profile to String.

Still the debug information in ATT mentioned the payload of the actual lora transmission (two bytes) and nothing of the hard coded string.

I have done some experimentation with the “Asset Profile”, based on pieces of information found here and there but I would appreciate feedback from someone with experience.

Will dig into more details next:

(Danny Engelman) #5

Sorry, no help from me on AllThingsTalk

I eventually wrote my own HTTP Integration to my own (MySQL) backend

(Eivind Holt) #6

I would love to use some existing frontend for rapid prototyping. In my experience these “one size fits all”-solutions quickly fall short when going beyond prototyping. I am going the same path as you on other projects, just in the cloud (Azure). I appreciate you sharing your database structure, it is a great starting point for developers doing much of the same thing.

(Eivind Holt) #7

For anyone struggling with this integration I have made some progress. I was trying to define the payload conversion using “ABCL” in my Asset’s Profile. Turns out there is a well hidden menu under Settings -> Payload formats. Looking back at it I can’t understand how I overlooked this menu, but at the same time going back over the documentation I can’t find this mentioned anywhere related to using ABCL.

I now get Parsed {“voltage”: {“value”: 4534}} from payload 11 b6 using ABCL (custom)
Still, no values anywhere else so I am not at a point where I can use it for anything.

Took some screen shots of where I found the settings for conversion:




(Eivind Holt) #8

The last piece of the puzzle was that the conversion definition has an “asset” property that has to match an asset defined on the current device in the Maker-dashboard. So, when “+ New Asset” you have to name it identical to the value defined in the ABCL. In my example: “asset”: “voltage”, means I have to add an asset named “voltage” on my device. Seems kind of obvious in retrospect, but what can you expect when all different dashboards and integrations keep throwing new names for (mostly) the same concepts?

I now receive a push notification on the ATT-app on my phone for each new message, exactly what I am looking for!