1
votes

I'm having a problem with some entities to make the subscriptions. The subcriptions are well done (orion responds ok. Status 201) but the url subscribed never receive any update.

I have fiware-orion launched with docker over a Centos 7.

This is an example of the entity.

{
        "id": "urn:ngsi-ld:ParkingGroup:Cervantes",
        "type": "ParkingGroup",
        "allowedVehicleType": {
            "type": "Property",
            "value": "car",
            "metadata": {}
        },
        "availableSpotNumber": {
            "type": "Property",
            "value": 59,
            "metadata": {}
        },
        "category": {
            "type": "Property",
            "value": [
                "offstreet",
                "feeCharged"
            ],
            "metadata": {}
        },
        "chargeType": {
            "type": "Property",
            "value": [
                "temporatyPrice"
            ],
            "metadata": {}
        },
        "description": {
            "type": "Property",
            "value": "Calle CervantesMálaga",
            "metadata": {}
        },
        "location": {
            "type": "GeoProperty",
            "value": {
                "type": "Point",
                "coordinates": [
                    "-4.4119148",
                    "36.7208633"
                ]
            },
            "metadata": {}
        },
        "name": {
            "type": "Text",
            "value": "Cervantes",
            "metadata": {}
        },
        "occupancyDetectionType": {
            "type": "Property",
            "value": "none",
            "metadata": {}
        },
        "permitActiveHours": {
            "type": "Property",
            "value": "",
            "metadata": {}
        },
        "requiredPermit": {
            "type": "Property",
            "value": "noPermitNeeded",
            "metadata": {}
        },
        "totalSpotNumber": {
            "type": "Property",
            "value": "414",
            "metadata": {}
        }
    }

I try different ways of subscriptions that all of them are accepted by orion like this:

{
  "description": "Notificar cambios en Aparcamientos",
  "subject": {
    "entities": [
      {
        "idPattern": ".*",
        "type":"ParkingGroup"

      }
    ],
     "condition": {
      "attrs": [
        "availableSpotNumber"
      ]
    }
  },
  "notification": {
    "attrs" : ["availableSpotNumber"],
    "http": {
      "url": "https://webhook.site/925f3290-07af-4dc9-88d2-27bcba693be5"
    }

  }
}

When I update the data with this through postman in mode PUT:

http://{{orion}}/v2/entities/urn:ngsi-ld:ParkingGroup:Cervantes/attrs/availableSpotNumber/value

and Body (text/plain) with value 2

The data is well ubdate when I make in postman in mode GET: http://{{orion}}/v2/entities/urn:ngsi-ld:ParkingGroup:Cervantes/attrs/availableSpotNumber

It returns:

{
    "type": "Property",
    "value": 2,
    "metadata": {}
}

But url of the subscription never receives anything

what is wrong? How can I solve it? How could I debug Orion to understand why it doesn't update the subscriptors?

The idea is to subscribe later cygnus. I have read that I must add the attrsFormat for it in this way:

"notification": {
    "http": {
      "url": "https://webhook.site/925f3290-07af-4dc9-88d2-27bcba693be5"
    },
    "attrs" : ["availableSpotNumber"],
    "attrsFormat": "legacy"
  }

Thanks in advance

2
I also tried submiting the value between quotes "2" but the same result (nothing) – David Bueno Vallejo

2 Answers

1
votes

Solved. After two days fighting with the problem and having some entities that worked, I realized that when I made the subscriptions Postman added (because of the tutorials) the headers: - fiware-service openiot - fiware-servicepath /

Now it works fine.

Thanks to Jason Fox who has been trying to help me!

1
votes

be careful about how do you encode location. in Ngsi v2 you need type geo:json and coordinates must be numbers not strings. in Ngsi-ld you need GeoProperty but your example entity is encoded in ngsiv2