telefonicaid / telefonicaid/iotagent-node-lib

Reverse option sends the notification twice

Open
#1,064 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment: tutorials.IoT-Agent

IoTA version:

{
    "libVersion": "2.15.0",
    "port": "4041",
    "baseRoot": "/",
    "version": "1.16.0"
}

CB version:

{
    "orion": {
        "version": "3.0.0",
        "uptime": "0 d, 1 h, 14 m, 22 s",
        "git_hash": "d6f8f4c6c766a9093527027f0a4b3f906e7f04c4",
        "compile_time": "Mon Apr 12 14:48:44 UTC 2021",
        "compiled_by": "root",
        "compiled_in": "f307ca0746f5",
        "release_date": "Mon Apr 12 14:48:44 UTC 2021",
        "machine": "x86_64",
        "doc": "https://fiware-orion.rtfd.io/en/3.0.0/",
        "libversions": {
            "boost": "1_66",
            "libcurl": "libcurl/7.61.1 OpenSSL/1.1.1g zlib/1.2.11 nghttp2/1.33.0",
            "libmicrohttpd": "0.9.70",
            "openssl": "1.1",
            "rapidjson": "1.1.0",
            "mongoc": "1.17.4",
            "bson": "1.17.4"
        }
    }
}

Device registration with endpoint webhook to test the commands (service group already set):

{
     "devices": [
    {
      "device_id": "tracker005",
      "entity_name": "car:005",
      "entity_type": "Car",
      "protocol": "IoTA-UL",
      "transport": "HTTP",
      "endpoint": "https://webhook.site/d897aa60-2758-43ba-9df7-f16895114220",
      "attributes": [
        {
            "object_id": "t",
            "name":"turn",
            "type":"Text",
            "expression": "${@t}",
            "reverse": [
                {
                "object_id":"t",
                "type": "Text",
                "expression": "${@turn}"
                }
            ]
        }
      ]
    }
  ]
}

When I send data from the CB:

curl --location --request PUT 'http://localhost:1026/v2/entities/car:005/attrs/turn' \
--header 'Fiware-Service: fiware_zone' \
--header 'Fiware-ServicePath: /' \
--header 'X-Auth-Token: null' \
--header 'Content-Type: application/json' \
--data-raw '{
    "value": "left"
}'

The operation sends two different commands (seconds of difference) to the endpoint:

06/07/2021 6:35:17 PM

tracker005@turn|left

06/07/2021 6:35:22 PM

tracker005@t|left

I would expect just one notification from the "reverse" expression, only the last command tracker005@t|left, as it is configured that t is the attribute that understand the "device". But it seems that the agent is also considering the attribute outside the reverse configuration.

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 registration and PUT request in the tutorials.IoT-Agent environment, using the webhook endpoint described in the issue. Trace how the reverse expression and the original attribute produce notifications. Done means the configuration sends only the tracker005@t|left command, with a regression test covering the duplicate notification.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.