telefonicaid / telefonicaid/iotagent-node-lib

object_id not recognized if is not equal to the name

Open
#1,621 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug NGSIv2
Dominant language
JavaScript
Stars
62
Forks
90
Avg merge
2h 35m
Merged PRs (30d)
1

Description

IoT Agent Node Lib version the issue has been seen with

4.5.0

Bound or port used (API interaction)

Southbound (Devices data API)

NGSI version

NGSIv2

Are you running a container?

Yes, I am using a contaner (Docker, Kubernetes...)

Image type

normal

Expected behaviour you didn't see

The measure should be updated in orion CB.

Unexpected behaviour you saw

The payload is not filled.
The iotagent takes only all static_attributes when I have active attribute with object_id: '.1.3.6.1.4.1.6302.2.1.2.1.0' in this format.

this fails
 {
            name: 'psBatteryVoltage',
            type: 'Number',
            object_id: '.1.0.0.1'
 }
this works
 {
            name: 'psBatteryVoltage',
            type: 'Number',
            object_id: 'psBattery'
 }
Steps to reproduce the problem
curl  -iX POST 'http://localhost:5004/iot/json?k=<API_KEY>&i=device001
 -d '{ 
    ".1.0.0.1": 23.5
  }'

in this case the payload is filled by static_attributes only.

Configs
environment:
    - "IOTA_CB_HOST=orion"
    - "IOTA_CB_PORT=1026"
    - "IOTA_NORTH_PORT=4041"
    - "IOTA_REGISTRY_TYPE=mongodb"
    - "IOTA_MONGO_HOST=mongodb"
    - "IOTA_MONGO_PORT=27017"
    - "IOTA_MONGO_DB=iotagent-json"
    - "IOTA_HTTP_PORT=7896"
    - "IOTA_PROVIDER_URL=http://iot-agent:4041"
Log output
time=2024-06-20T09:48:28.428Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Request | msg=Options: {
iot-agent  |     "url": "http://orion:1026/v2/entities?options=upsert",
iot-agent  |     "method": "POST",
iot-agent  |     "headers": {
iot-agent  |         "fiware-service": "service",
iot-agent  |         "fiware-servicepath": "/"
iot-agent  |     },
iot-agent  |     "json": {
iot-agent  |         "id": "urn:ngsild:device:4242",
iot-agent  |         "type": "device",
iot-agent  |         "project": {
iot-agent  |             "type": "Text",
iot-agent  |             "value": "1",
iot-agent  |             "metadata": {
iot-agent  |                 "TimeInstant": {
iot-agent  |                     "type": "DateTime",
iot-agent  |                     "value": "2024-06-20T09:48:28.428Z"
iot-agent  |                 }
iot-agent  |             }
iot-agent  |         },
iot-agent  |         "model": {
iot-agent  |             "type": "Text",
iot-agent  |             "value": "device",
iot-agent  |             "metadata": {
iot-agent  |                 "TimeInstant": {
iot-agent  |                     "type": "DateTime",
iot-agent  |                     "value": "2024-06-20T09:48:28.428Z"
iot-agent  |                 }
iot-agent  |             }
iot-agent  |         },
iot-agent  |        
iot-agent  |         "isPhysical": {
iot-agent  |             "type": "Boolean",
iot-agent  |             "value": true,
iot-agent  |             "metadata": {
iot-agent  |                 "TimeInstant": {
iot-agent  |                     "type": "DateTime",
iot-agent  |                     "value": "2024-06-20T09:48:28.428Z"
iot-agent  |                 }
iot-agent  |             }
iot-agent  |         "TimeInstant": {
iot-agent  |             "type": "DateTime",
iot-agent  |             "value": "2024-06-20T09:48:28.428Z"
iot-agent  |         }
iot-agent  |     }
iot-agent  | }
iot-agent  | time=2024-06-20T09:48:28.437Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Request | msg=Response ""
iot-agent  | time=2024-06-20T09:48:28.437Z | lvl=INFO | corr=n/a | trans=n/a | op=IoTAgentNGSI.Entities-v2 | msg=Received the following response from the CB: Value updated successfully

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the southbound JSON request with the shown object_id values and inspect the object_id mapping in the IoT Agent Node.js request handling. Done means a payload using an object_id such as '.1.0.0.1' updates the corresponding measure in Orion, rather than filling only static attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.