-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leshan does not decode SenML-CBOR string value (3) correctly #1654
Comments
Thx for taking to report that. 🙏 I will try to have a look and will let you know what I will find. |
@sbernard31 hi, thanks! But I think I might be doing something wrong, especially if you look at the payload comparison at the bottom of my post. Do you have any idea? |
Ok so this is your payload :
And this is the expected one :
The difference you are using string as key instead of number. I agree that error message is not so good. |
It seems you are absolutely right! I tried using a different CBOR library (for C#) and used integer keys, now it works! Thanks! |
Reading 6. CBOR Representation (application/senml+cbor) :
And examples confirm that. |
I can try to improve a bit the error message. |
Maybe something like :
? |
@kipusoep let me know if you think this is clearer ☝️ (or if you have better idea) |
Yeah I think it is an improvement, although I am afraid I still wouldn't figure it out if I has that error message instead :-P |
Ok so I integrated that changed in
Arf at least it will be easier for Leshan devs to answer to this kind of question. 😁 I think we can close this issue now. |
Version(s)
f0825b5
Which components
leshan client demo
Tested With
No response
What happened
I am trying to PUT SenML_CBOR data from my LWM2M server to the leshan client demo, but I get an error:
Invalid SenML record : record must have a value (v,vb,vlo,vd,vs) : {"3": "hhh", "-2": "/3442/0/110"}
This doesn't make sense to me, as the value (vs) is present in the form of
3
.If I send the same payload in json format it works fine (with bn and vs obviously).
I checked the verbose logs and the client states:
Unable to decode node[path:/3442/0/110] : 81a2613363686868622d326b2f333434322f302f313130
If I take this binary hex and paste it in this online cbor tool, it also shows the correct json:
Looking at the source it tries to find an item with key
3
, but it is present...So I am really confused about what's going on. If I do the same request from the leshan server demo, it works fine, but I'm not sure what the difference is?
Thanks in advance for any help!
Relevant Output
This is the payload from the leshan server demo (left) vs my payload (right), maybe it's helpful?
The text was updated successfully, but these errors were encountered: