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

JEXL expressions are not working in simplifiedKeyValues, keyValues and values notifications #4645

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

Comments

@fgalan
Copy link
Member

fgalan commented Feb 12, 2025

Subs

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

Entity before update:

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

PATCH entity

{\n  "TimeInstant": {\n    "type": "DateTime",\n    "value": "2025-02-10T16:43:00.000Z",\n    "metadata": {}\n  },\n  "waterConsumption": {\n    "type": "Number",\n    "value": 25,\n    "metadata": {}\n  }\n}

Notification (JEXL expression is not evaluated, NOK)

{
  "id": "contador1",
  "type": "WaterMeter",
  "TimeInstant": "2025-02-10T16:43:00.000Z",
  "vol": "${waterConsumption - metadata.waterConsumption.previousValue}",
  "waterConsumption": 25,
  "alterationType": "entityChange"
}
@fgalan
Copy link
Member Author

fgalan commented Feb 26, 2025

It was not working also in keyValues and values modes

@fgalan fgalan changed the title JEXL expressions are not working in simplifiedKeyValues notifications JEXL expressions are not working in simplifiedKeyValues, keyValues and values notifications 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