-
Notifications
You must be signed in to change notification settings - Fork 408
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
READ RESPONSE with timestamped SenML #1553
Comments
This is another part of LWM2M specification which is unclear to me for which I have been unable to obtain clarification. See relative OMA and Leshan issue about that :
More generally, I tried several times to interact with the OMA authors to find a solution to this global situation where we failed to get an answer to our LWM2M misunderstanding, without success ... I'm not even able to get answer using private mail ... this is like this since several years now and I must confess the situation become really frustrating 😞. Let's try to better understand together what could means supporting Currently, I understand a read request is about sending current value on the device. Do you have use case in mind ? What exactly did IoTerop SDK ? |
(In your log there is something strange : |
This is not bug - this log is from our backend 😉 , but in leshan server we also observing this error:
We agree that specification does not tell anything specific on READ response, excepted a mention that " ...are not supported by the LwM2M Server MUST be silently ignored." But specification in the SenML chapter does not make any difference, and says "When a LwM2M Client is supporting the SenML JSON data format and the format is used to transport Object Instance(s), multiple resource and single resource values for both "Read" and "Write" operations, SenML JSON payload MUST use the format defined in this section. This format MAY be used also for transporting a single value of a Resource." and it does not says that it is forbidden to use "t" or "bt" on READ response, so it should be allowed. |
The whole sentence is : So this talk about optional resource from LWM2M model that server could not know so this is not relevant here.
Even if I understand your argument, it can also be used to say that So from my point of view specification/authors doesn't help us to know if this should be supported and how this should be supported. My current point of view on read is that it doesn't have so much sense but it seems we disagree so I would like to better understand you.
Could you precise the behavior/API changes you would like to see in Leshan ? |
This topis is transferred from Jarek to me 🙂 From Technical point of view: From business case point of view: |
Not exactly true, I think we can consider we have exactly same "question" with old JSON format (
I disagree on that point. 🙂 Now, I understand that we can have different interpretation as the specification is pretty ambiguity and I also understand your use case. So now let's try to imagine how we could add support of that in Leshan So if we read a resource, you get a only 1 With an example with : // A) This is OK, because there is 1 timestamp for the whole node
[
{ "bn":"/6/0/","n":"0","v":-21.0, "bt":1706888656},
{"n":"1","v":141.0},
{"n":"5","v":1706888656}
]
// B) This is not OK because there is several measurement timestamp in the same node :
[
{ "bn":"/6/0/","n":"0","v":-21.0, "bt":1706888656},
{"n":"1","v":141.0, "t":"10"},
{"n":"5","v":1706888656}
] If we want to support A) with current state of Leshan this should be doable. |
I wanted to ask what is your point of view on how to simulate it? |
I'm not sure I get what you mean ? |
I mean what is your opinion on how should I implement it, can I make changes at client side or should I create some test at the begining? |
Should we first agree about what we want to try to implement ?
I understand you want to work on this now ? Does it mean that you will stop to work on write_attribute ? |
Sorry, I didn't mention it earlier. We would like to implement A) - only with 1 timestamp. |
OK so we could try to implement that :
But before to start to work on this, |
Maybe it's good idea. Because of our priorities I'll switch to this issue and when I finish I'll back to write attributes, ok? |
Ok, no problem. |
Is it possible to use LockStepLwM2mClient test without modification at client side? |
|
Can you help me with test read response using LockStepLwM2mClient? I looked through observe and observe composite tests (there is a hack with triggering notification which I can't make in read case). I don't know how to simulate read response with time stamp, could you give me some tips or example? |
I didn't investigate too much but maybe something like : // Do all the stuff about registering
// Server send Read Request
// Wait for server READ request and store CoAP Token and MID
client.expectRequest().storeToken("TKN").storeMID("MID").go();
// Send custom READ Response
// here you need to create the Coap Response and its payload on your own (you can not use LWM2M API)
// I see that maybe it miss a way to add content format an so maybe you need to add it.
client.sendResponse(Type.ACK, ResponseCode.CONTENT).loadMID("MID").loadToken("TKN")
.payload(givenServerEndpointProvider).go(); Let me know if help is enough. |
Hi, Maybe I'm still doing something wrong. |
I look at it and as I explain at #1553 (comment), you should probably first send the Read Request before to call Let me know if this solve your problem. |
Could you take a look at my changes, I think it is almost finished. Here is a link: |
I take a very quick look at it. Some remarks at first sight :
If you want more details review, you can open a PR (but please no merge commit) |
A PR related to that feature is available at : #1610 |
Hi, I'm out of office from 29.04 to 05.05. I'll be back on moday (06.05). |
And me from 29.04 to 01.05 (back 02.05) 😉 |
And re-out of office from 06.05 to 14.05 (back 15.05) |
Co-authored-by: Simon Bernard <[email protected]>
I think we can close this now as this is implemented in |
Thx all for your contributions 🙏 |
To continue some discussion that started here #1612 (comment). This kind of payloads is not accepted in a Read and initial Observe response (with the error: should receive only 1 timestamped node but received 2): [
{"bn":"/3442/0/","n":"120","t":1717150530.123456789,"v":1},
{"n":"110","vs":"a"}
] But it is in a Notify, and is decoded as this ObserveReponse: in M15:
in M14:
|
I guess this is about Read/Observe an object instance /3442/0. Leshan API was thought with idea that when you try to Read/Observe a object instance, you get an But there is another feature in LWM2M called : E.g. :
(you can read : OpenMobileAlliance/OMA_LwM2M_for_Developers#538 (comment)) Leshan API is adapted to support that. And so can handle timestamped value but only for notification. (to support when historical value is used because of In your case [
{"bn":"/3442/0/","n":"120","t":1717150530.123456789,"v":1},
{"n":"110","vs":"a"}
] Leshan understand that it receives a notification with historical value which means : But this is not what the client try to express. From my point of view, that LWM2M client uses badly timestamp in SENML This is what I try to explain before. And I think the fact that some object model has a Timestamp Resource which means :
which is added only for resources which are sensor measurement is a hint that timestamps in SENML in LWM2M should not really used for that. |
in M15:
It seems to me that timestampedValue has not the right value. The javadoc says : /**
* {@inheritDoc}
*
* <p>
* In case where client is using "Notification Storing When Disabled or Offline", the most recent value is returned.
* If you want the full historical timestamped values, you should use use {@link #getTimestampedLwM2mNodes()}.
*/
@Override
public TimestampedLwM2mNode getTimestampedLwM2mNode() {
return super.getTimestampedLwM2mNode();
} And so most recent value (is no timestamp which means now) and so we should have : timestampedValue =
- TimestampedLwM2mNode [timestamp=2024-05-31T10:15:30.123456789Z, node=LwM2mObjectInstance [id=0, resources={120=LwM2mSingleResource [id=120, value=1, type=INTEGER]}]]
+ TimestampedLwM2mNode [timestamp=null, node=LwM2mObjectInstance [id=0, resources={110=LwM2mSingleResource [id=110, value=a, type=STRING]}] I need to investigate that 🕵️ |
@slaft, at #1612 (comment), you said
I can also look if making that check optional is easily doable ? The other solution (called B at #1553 (comment)) which supports :
will probably very impacting and will need maybe a lot of thinking especially how it lives with |
Thanks a lot for the detailed explanations!
Yes
Yes I suppose too
Please allow me some time to confirm this. |
No problem 🙂 |
-fix list order getTimestampedLwM2mNodes when null-timestamp value is used : null-timestamp value should be first (as considered as most recent one) - when "Notification Storing When Disabled or Offline" is used getTimestampedLwM2mNode should return the most recent value. So this could be a null-timestamp one. see : #1553 (comment)
Some clarification about what I think of timestamp usage in LWM2M : #1623 |
-fix list order getTimestampedLwM2mNodes when null-timestamp value is used : null-timestamp value should be first (as considered as most recent one) - when "Notification Storing When Disabled or Offline" is used getTimestampedLwM2mNode should return the most recent value. So this could be a null-timestamp one. see : #1553 (comment)
Hello again Simon, I have one more question, can we do a small fix regarding read and observe composite operation with 1 timestamp for all? |
Hi, I'm not sure I get your point 🤔. Note that I'm currently working on a big rename(#1295), so we can discuss about that but I do not plan to integrate changes during that work. |
I'm talking about method validateNoTimestampedRecord() in LwM2mNodeSenMLDecoder : leshan/leshan-core/src/main/java/org/eclipse/leshan/core/node/codec/senml/LwM2mNodeSenMLDecoder.java Lines 174 to 179 in 2683ca6
When we try do observe with 1 timpestamp, we can't retrive response, because of Exception - "Unable to decode node..." |
OK and so you would like to support to be able to have 1 timestamp like for Simple (not composite) Read and Observe ? So If you do a Composite-Read : // This is OK
[
{ "n":"3/0/1","v":11234, "bt":1706888656 },
{ "bn":"/6/0/","n":"0","v":-21.0 },
{ "n":"1","v":141.0 },
{ "n":"5","v":1706888656 }
]
// This is NOT OK :
[
{ "n":"3/0/1","v":11234, "bt":1706888656 },
{ "bn":"/6/0/","n":"0","v":-21.0 "bt":1706880000 },
{ "n":"1","v":141.0 },
{ "n":"5","v":1706888656 }
] (for same : #1623) |
Version A is fine for us |
OK so probably we need to create a dedicated issue describing the need. |
I forgot to let you know that refactoring is done (#1628) and so you can work on that if wanted. |
I created dedicated issue #1637 |
Question
We have some lwm2m devices using standard IoTerop SDK which are sending a response to a READ using SenML with a timestamp value inside (timestamp from SenML specification).
Leshan server DOES NOT accept this type of responses. Leshan server accept it only from a SEND or a NOTIFY, but not from a READ response:
Is it possible to allow such payload with an embedded timestamp from READ responses ?
The text was updated successfully, but these errors were encountered: