Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyValue notification format is not working in custom notifications using ngsi payload #4644

Open
Tracked by #4648
fgalan opened this issue Feb 12, 2025 · 3 comments
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented Feb 12, 2025

Sub

{
  "status": "active",
  "subject": {
    "entities": [
      {
        "idPattern": ".*",
        "type": "WaterMeter"
      }
    ],
    "condition": {
      "attrs": [
        "TimeInstant"
      ],
      "alterationTypes": [
        "entityCreate",
        "entityUpdate",
        "entityChange",
        "entityDelete"
      ],
      "notifyOnMetadataChange": true
    }
  },
  "notification": {
    "timesSent": 29,
    "lastNotification": "2025-02-12T10:59:30.000Z",
    "attrs": [
      "TimeInstant",
      "vol",
      "waterConsumption"
    ],
    "onlyChangedAttrs": false,
    "attrsFormat": "keyValues",
    "httpCustom": {
      "url": "https://webhook.site/xxxx",
      "ngsi": {
        "vol": {
          "type": "Number",
          "value": "${waterConsumption - metadata.waterConsumption.previousValue}",
          "metadata": {
            "evalPriority": {
              "type": "Number",
              "value": 1
            }
          }
        }
      }
    },
    "metadata": [
      "previousValue",
      "*"
    ],
    "lastSuccess": "2025-02-12T10:59:30.000Z",
    "lastSuccessCode": 200,
    "covered": false
  }
}

Entity before update:

{
  "id": "contador1",
  "type": "WaterMeter",
  "TimeInstant": {
    "type": "DateTime",
    "value": "2025-02-10T16:41:00.000Z",
    "metadata": {}
  },
  "waterConsumption": {
    "type": "Number",
    "value": 20,
    "metadata": {}
  }
}

PATCH entity

{
  "TimeInstant": {
    "type": "DateTime",
    "value": "2025-02-10T16:42:00.000Z",
    "metadata": {}
  },
  "waterConsumption": {
    "type": "Number",
    "value": 23,
    "metadata": {}
  }
}

Notification (keyValues is not applied, NOK)

{
  "subscriptionId": "...",
  "data": [
    {
      "id": "contador1",
      "type": "WaterMeter",
      "TimeInstant": {
        "type": "DateTime",
        "value": "2025-02-10T16:42:00.000Z",
        "metadata": {
          "previousValue": {
            "type": "DateTime",
            "value": "2025-02-10T16:41:00.000Z"
          }
        }
      },
      "vol": {
        "type": "Number",
        "value": 3,
        "metadata": {
          "evalPriority": {
            "type": "Number",
            "value": 1
          }
        }
      },
      "waterConsumption": {
        "type": "Number",
        "value": 23,
        "metadata": {
          "previousValue": {
            "type": "Number",
            "value": 20
          }
        }
      },
      "alterationType": {
        "type": "Text",
        "value": "entityChange",
        "metadata": {}
      }
    }
  ]
}
@fgalan
Copy link
Member Author

fgalan commented Feb 26, 2025

Include also a similar test for "attrsFormat": "values" (probably not very used, but part of the API)

@fgalan
Copy link
Member Author

fgalan commented Feb 26, 2025

It seems it only fails in custom notifications using ngsi payloads.

@fgalan fgalan changed the title keyValue notification format is not working in notifications keyValue notification format is not working in custom notifications using ngsi payload Feb 26, 2025
@fgalan fgalan added this to the 4.2.0 milestone Feb 26, 2025
@fgalan
Copy link
Member Author

fgalan commented Feb 27, 2025

Solved by PR #4648

However, let's hold this issue opened for a while for possible testing, until 4.2.0 gets closed.

CC: @danielvillalbamota

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant