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

previousValue metadata is not included in notifications in case of no actual update in subs using entityUpdate alterationType #4643

Open
Tracked by #4648
fgalan opened this issue Feb 12, 2025 · 1 comment
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": 28,
    "lastNotification": "2025-02-12T10:44:50.000Z",
    "attrs": [
      "TimeInstant",
      "vol",
      "waterConsumption"
    ],
    "onlyChangedAttrs": false,
    "attrsFormat": "normalized",
    "httpCustom": {
      "url": "https://webhook.site/xxxxxxxxx",
      "ngsi": {
        "vol": {
          "type": "Number",
          "value": "${waterConsumption - metadata.waterConsumption.previousValue}",
          "metadata": {
            "evalPriority": {
              "type": "Number",
              "value": 1
            }
          }
        }
      }
    },
    "metadata": [
      "previousValue",
      "*"
    ],
    "lastSuccess": "2025-02-12T10:44:50.000Z",
    "lastSuccessCode": 200,
    "covered": false
  }
}

Entity (before update):

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

PATCH entiy

{
  "TimeInstant": {
    "type": "DateTime",
    "value": "2025-02-10T16:41:00.000Z",
    "metadata": {}
  }
}

Notification (vol is null comes, NOK)

{
  "subscriptionId": "....",
  "data": [
    {
      "id": "contador1",
      "type": "WaterMeter",
      "TimeInstant": {
        "type": "DateTime",
        "value": "2025-02-10T16:41:00.000Z",
        "metadata": {
          "previousValue": {
            "type": "DateTime",
            "value": "2025-02-10T16:40:00.000Z"
          }
        }
      },
      "vol": {
        "type": "Number",
        "value": null,
        "metadata": {
          "evalPriority": {
            "type": "Number",
            "value": 1
          }
        }
      },
      "waterConsumption": {
        "type": "Number",
        "value": 20,
        "metadata": {}
      },
      "alterationType": {
        "type": "Text",
        "value": "entityChange",
        "metadata": {}
      }
    }
  ]
}
@fgalan fgalan changed the title previousValue is not included in notifications in case of no actual update in subs using entityUpdate alterationType previousValue metadata is not included in notifications in case of no actual update in subs using entityUpdate alterationType Feb 12, 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