Git Product home page Git Product logo

Comments (10)

AlvaroVega avatar AlvaroVega commented on August 12, 2024 1

Not sure if is a corner case or what should be the right behaviour. At the second step device named Sensor01 with an entityType and entityName is already found and then used.

If your add an static attribute to each group then the resulting entity has both static attributes.

Maybe the bug is that at second step Sensor01 device should be updated with new provided entityName and entityType?

from iotagent-node-lib.

AlvaroVega avatar AlvaroVega commented on August 12, 2024 1

entity_name and entity_type are fields of device to link a device with a CB entity (which has id ant type), but are not a key in Devices model and typically are inhered from Group (as apikey) when autoprovision.

from iotagent-node-lib.

AlvaroVega avatar AlvaroVega commented on August 12, 2024

Maybe (or not) before second step (send second measure) you can update provisioned device to ensure entityName and entityType are updated on Sensor01 device and then send the measure.

from iotagent-node-lib.

tudamp avatar tudamp commented on August 12, 2024

Hi Alvaro, thank you for your reply.

According to the documentation about service groups:
They are identified by an apikey and a resource and mapped to a particular entity type. [...]
For every config group, the pair (resource, apikey) must be unique (as it is used to identify which group to assign to which device).

From my point of view, once a measurement is 'identified' with a specific apikey and resource, it cannot be mapped to a different entity that belongs to a different group. Probably the main problem is that the agent seems to ignore the entity type, which is instead important when talking to the context broker.

There are probably two solutions:

  • take the entity type into account when defining a device uniquely
  • return an error when a device with the same ID is 'found outside' the service group.

The second solution, however, seems to me to contradict what is written in the documentation.

from iotagent-node-lib.

AlvaroVega avatar AlvaroVega commented on August 12, 2024

Currently is not possible provision two devices in the same service/subservice with the same id but different apikey. And apikey at device level is mandatory since not along ago

from iotagent-node-lib.

tudamp avatar tudamp commented on August 12, 2024

Perhaps this should be made clearer in the documentation, because at present it seems to describe a different behaviour (at least in my interpretation of the text).

The problem I see is that the definition of uniqueness within the agent and the CB is different. This causes confusion as there is a 1:1 logical mapping between the device in the iot agent and the CB.
Do you think it makes sense to also include the device type in the uniqueness definition to standardise the behaviour with the CB?

Regardless of these considerations in the roadmap, given the current definition of uniqueness, I think the current behaviour may not be correct and the second measurement should be rejected.

from iotagent-node-lib.

fgalan avatar fgalan commented on August 12, 2024

Perhaps this should be made clearer in the documentation, because at present it seems to describe a different behaviour (at least in my interpretation of the text).

Maybe you could do a pull request with a proposal of change to the documentation to make things clearer, based in your experience with this issue, please? Thanks in advance!

from iotagent-node-lib.

fgalan avatar fgalan commented on August 12, 2024

Do you think it makes sense to also include the device type in the uniqueness definition to standardise the behaviour with the CB?

As far as I understand "type" is a concept used in CB associated to entities but it doesn't have an equivalent at device level at IOTA. In sum:

  • At CB level we have: entity id and entity type
  • At IOTA level we have: device id

The mapping between both worlds (entity_id+entity_type <-> device_id) is done by IOTA, either by explicit provision or by autoprovision.

Please @AlvaroVega provide feedback if I'm wrong.

from iotagent-node-lib.

fgalan avatar fgalan commented on August 12, 2024

PR #1592 should fix this issue, allowing several devices with same device_id in the same service and subservice (as long as they are using different apikeys).

@tudamp could you test again, please? You can get the latest iotagent-json docker container from dockerhub at telefonicaiot/iotagent-json:latest. Thanks in advance!

from iotagent-node-lib.

fgalan avatar fgalan commented on August 12, 2024

Release 4.4.0 including this fix has been released today, so we are going to close this issue.

@tudamp of course it can reopened if needed, if you provided feedback at the end.

from iotagent-node-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.