Skip to content

Differences between explicitAttrs behaviour at lib and at agent level #782

Open
@mapedraza

Description

@mapedraza

IoT Agent JSON version the issue has been seen with

latest

Bound or port used (API interaction)

Southbound (Devices data API)

NGSI version

NGSIv2

Are you running a container?

No, I am running it natively

Image type

None

Expected behaviour you didn't see

When using provisioning a group like this:

{
    resource: '/iot/json',
    apikey: globalEnv.apikey,
    entity_type: globalEnv.entity_type,
    explicitAttrs:
        "(a&&b)?['attr_a','attr_b']:a?['attr_a','static_b']:b?[{object_id:'b'},'c']:['static_a','static_b','d','c']",
    commands: [],
    lazy: [],
    attributes: [
        {
            name: 'attr_a',
            object_id: 'a',
            type: 'Number'
        },
        {
            name: 'attr_b',
            object_id: 'b',
            type: 'Number'
        },
        {
            object_id: 'c',
            type: 'Number'
        }
    ],
    static_attributes: [
        {
            name: 'static_a',
            type: 'Number',
            value: 3
        },
        {
            name: 'static_b',
            type: 'Number',
            value: 4
        }
    ]
}

sending:

{
    c: 3,
    d: 4
}

Unexpected behaviour you saw

It sends to CB (red is not expected)

{
      id: globalEnv.entity_name,
      type: globalEnv.entity_type,
      static_a: {
          value: 3,
          type: 'Number'
      },
      static_b: {
          value: 4,
          type: 'Number'
      }
-    c: {
-        type: 'Number'
-        value: 3
-   }
}

Since c is not provisioned, should not pass to the CB

Instead, in IoTA Node Lib, the behaviour is the oposite (c attribute does not appears)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions