Skip to content

No CMD attributes added when sending push commands (using endpoint) #1559

Open
@mapedraza

Description

@mapedraza

IoT Agent Node Lib version the issue has been seen with

4.1.0

Bound or port used (API interaction)

Southbound (Devices data API), Northbound (Provision API and NGSI Interactions)

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

No _info and _status added to the entity when sending push commands (using endpoint parameter in provision)

Steps to reproduce the problem

Group provision

curl --location 'http://localhost:4041/iot/services' \
--header 'Fiware-Service: test' \
--header 'Fiware-ServicePath: /test240125' \
--header 'X-Auth-Token: null' \
--header 'Content-Type: application/json' \
--data '{
    "services": [
        {
            "resource": "/iot/json",
            "apikey": "123456789100",
            "type": "dev",
            "cbHost": "http://orion:1026",
            "static_attributes": [
                {
                    "name": "operationalStatus",
                    "type": "Text",
                    "value": "ok"
                }
            ],
            "commands": []
        }
    ]
}'

Dev provision

curl --location 'http://localhost:4041/iot/devices' \
--header 'Fiware-Service: test' \
--header 'Fiware-ServicePath: /test240125' \
--header 'X-Auth-Token: null' \
--header 'Content-Type: application/json' \
--data '{
    "devices": [
        {
            "protocol": "IoTA-JSON",
            "explicitAttrs": false,
            "device_id": "dev2",
            "apikey": "123456789100",
            "entity_name": "dev2",
            "entity_type": "Device",
            "transport": "HTTP",
            "lazy": [],
            "commands": [ 
                {
                    "name": "ping",
                    "type": "command"
                }
            ],
            "endpoint": "https://webhook.site/5425edee"
        }
    ]
}'

Triggering cmd

curl -L -X PUT 'http://localhost:1026/v2/entities/dev2/attrs/ping?type=Device' \
-H 'fiware-service: test' \
-H 'fiware-servicepath: /test240125' \
-H 'Content-Type: application/json' \
-d '{
      "type" : "command",
      "value" : "123"
}'

Then, no _info and _status attributes added to CB.

Expected _status = DELIVERED if worked the HTTP request to be included into the entity in order to align with polling commands.

After confirming the command, this means the following request:

curl --location 'http://localhost:7896/iot/json/commands?k=123456789100&i=dev2' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{"ping":"ping_ok"}'

entity is updated with info and status attributes as follows:

    "ping_info": {
      "type": "commandResult",
      "value": "ping_ok",
      "metadata": {
        "TimeInstant": {
          "type": "DateTime",
          "value": "2024-01-25T10:09:23.144Z"
        }
      }
    },
    "ping_status": {
      "type": "commandStatus",
      "value": "OK",
      "metadata": {
        "TimeInstant": {
          "type": "DateTime",
          "value": "2024-01-25T10:09:23.144Z"
        }
      }
    }

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