flownexus-lwm2m / flownexus

IoT server with LwM2M support
https://flownexus-lwm2m.github.io/flownexus
Apache License 2.0
3 stars 2 forks source link

leshan: fix subscribing to single resource #56

Closed jonas-rem closed 3 months ago

jonas-rem commented 4 months ago

Subscribe to a single resource by explicitly using all 3 parameters (ObjectID/ObjectInstanceID/ResourceID).

I noticed this when I tested with the simulation and the M5 node.

Kappuccino111 commented 4 months ago

@jonas-rem what does this exactly do ? Was there an overlap of resources while only using 2 parameters ?? Could you please explain this a bit ?

jonas-rem commented 3 months ago

Did you saw my commit message? It gives a brief explanation.

I thought that it is possible to subscribe to ObjectID/ResourceID and ignore the ObjectInstanceID (subscribe to all instances). However that seems not possible. It think it makes more sense to explicitly subscribe to ObjectID/ObjectInstanceID/ResourceID. Usually when updating sensor values, the ObjectInstanceID always remains 0 and Lwm2m notifies about an update of that instance.

We have to check later when implementing SenML, if this way is still valid. But for now this is perfectly fine for single instances and allows us to test everything.

jonas-rem commented 3 months ago

Draft for now, I will update this later and add a way to subscribe either to objectIDs or to explicit resources.

Kappuccino111 commented 3 months ago

Did you saw my commit message? It gives a brief explanation.

I thought that it is possible to subscribe to ObjectID/ResourceID and ignore the ObjectInstanceID (subscribe to all instances). However that seems not possible. It think it makes more sense to explicitly subscribe to ObjectID/ObjectInstanceID/ResourceID. Usually when updating sensor values, the ObjectInstanceID always remains 0 and Lwm2m notifies about an update of that instance.

We have to check later when implementing SenML, if this way is still valid. But for now this is perfectly fine for single instances and allows us to test everything.

Yep @jonas-rem I had gone through the commit message, but was unsure why we changed it to 3 params. Got it now 👍😁

jonas-rem commented 3 months ago

Draft for now, I will update this later and add a way to subscribe either to objectIDs or to explicit resources.

@Kappuccino111 The additional idea that I had does not work and I will leave it as is. Ready for review.