FIWARE / node-red-contrib-FIWARE_official

FIWARE-Node-Red integration supporting NGSI-LD
https://nodered.org/
Apache License 2.0
14 stars 9 forks source link

ContextBroker Node not created #17

Open karikolehmainen opened 3 years ago

karikolehmainen commented 3 years ago

Installing the latest component to with latest NodeRED seems not create ContextBroker node. Only Nodes visible are NGSI Entity, NGSI Dataset, NGSI Update, NGSI Subscription and NGSI v2toLD. ContextBroker is referred in details of NGSI Subscription but such entity is not visible on design view. It is possible to set ContextBroker settings via Subscription node, but deploying Subscription node does not make subscription to Orion so I am thinking that ContextBorker node actually does not get deployed. Any idea what could be wrong, is there something in latest NodeRED that brakes compatibility and if so, what is the latest compatible versions?

fisuda commented 3 years ago

According to the following source code, the Context-Broker node is defined as a configuration node. Please see https://nodered.org/docs/creating-nodes/config-nodes.

https://github.com/FIWARE/node-red-contrib-FIWARE_official/blob/14271fb067ca120ddde56ec903ad176c3fcef9ce/src/nodes/NGSI/contextbroker/contextbroker.html#L20-L25

contextbroke-node

karikolehmainen commented 3 years ago

Thanks for the reply, that explains why it is not visible. Still I am struggling to understand how to get context change events to NodeRED. I do not seem to be able to get any subscriptions registered at Orion nor do I see any traffic at debug view I deploy the flow. I have defined NGSI Subscribe Node as follows: Screenshot 2021-04-29 at 9 31 53 Screenshot 2021-04-29 at 9 31 28 This is an example of an entity I have at Orion: ` {

    "id": "urn:ngsi-ld:NodeSensor:nodeC8-B3-C6-C5-92-B1",
    "type": "NodeSensor",
    "TimeInstant": { "type": "DateTime", "value": "2021-04-29T08:57:43.312Z", "metadata": {}  },
    "humidity": {
        "type": "Number",
        "value": 187,
        "metadata": { "TimeInstant": { "type": "DateTime", "value": "2021-04-29T08:57:43.312Z"  }  }
    },
    "refHome": {
        "type": "Relationship",
        "value": "urn:ngsi-ld:Refinery:001",
        "metadata": { "TimeInstant": { "type": "DateTime", "value": "2021-04-29T08:57:43.312Z"  }  }
    },
    "signal": {
        "type": "Number",
        "value": -44,
        "metadata": {  "TimeInstant": {  "type": "DateTime", "value": "2021-04-29T08:57:43.312Z"  }  }
    },
    "temperature": {
        "type": "Number",
        "value": 206,
        "metadata": {  "TimeInstant": { "type": "DateTime",  "value": "2021-04-29T08:57:43.312Z"   }  }
    }
}`

That was retrieved with command: curl -X GET 'http://localhost:1026/v2/entities' -H 'fiware-service: openiot' -H 'fiware-servicepath: /' | python3 -mjson.tool

Note that entities are NGSI v2 but entity IDs are given with NGSI-LD notation as per FIWARE examples.

kosgobakis commented 2 years ago

Check my pull request. The issue is that you need to add the fiware-servicepath when you declare the Context Broker https://github.com/FIWARE/node-red-contrib-FIWARE_official/pull/20

jason-fox commented 2 years ago

The PR has been merged - does this solve the issue?

johncaipa commented 2 years ago

It has not worked for me, it only works with security enabled? image image My example flow: [{"id":"e2524373.a31728","type":"NGSI-Entity","z":"f6f2187d.f17ca8","name":"","endpoint":"68a1e9ee.287918","protocol":"v2","ldContext":"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld","mode":"keyValues","mimeType":"application/ld+json","attrs":"","x":490,"y":240,"wires":[["6e92558d.758ed4"]]},{"id":"94a57f7a.74bbf","type":"inject","z":"f6f2187d.f17ca8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"urn:ngsi-ld:Store:001","payloadType":"str","x":270,"y":240,"wires":[["e2524373.a31728"]]},{"id":"6e92558d.758ed4","type":"debug","z":"f6f2187d.f17ca8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":240,"wires":[]},{"id":"68a1e9ee.287918","type":"Context-Broker","name":"","endpoint":"http://localhost:1026","service":"openiot","servicepath":"/","idmEndpoint":""}] on postman the test are working image