Skip to content

Conversation

AlvaroVega
Copy link
Member

@AlvaroVega AlvaroVega commented Jan 25, 2024

This PR does not modify current commands based on CB registrations. It's backward compatible and adds a new way of receive command through a CB notification.
related and needs telefonicaid/iotagent-node-lib#1560

@AlvaroVega
Copy link
Member Author

AlvaroVega commented Jan 25, 2024

Example of NGSIv2 Notification command:

curl -i -X POST http://localhost:4052/notify -d '{
    "subscriptionId": "60b0cedd497e8b681d40b58e",
    "data": [{
   	 "id": "123456abcdefg",
   	 "type": "switchOnOffExecution",
   	 "targetEntityId": {
   		 "type": "Text",
   		 "value": "ENT-LUM-001",
   		 "metadata": {}
   	 },
   	 "targetEntityType": {
   		 "type": "Text",
   		 "value": "StreetLight",
   		 "metadata": {}
   	 },
   	 "execTs": {
   		 "type": "DateTime",
   		 "value": "2020-05-27T00:00:00.000Z",
   		 "metadata": {}
   	 },
   	 "cmd": {
   		 "type": "Text",
   		 "value": "switchOnOff",
   		 "metadata": {}
   	 },
   	 "params": {
   		 "type": "Text",
   		 "value": "on",
   		 "metadata": {}
   	 },
   	 "status": {
   		 "type": "Text",
   		 "value": "FORWARDED",
   		 "metadata": {}
   	 },
   	 "info": {
   		 "type": "Text",
   		 "value": null,
   		 "metadata": {}
   	 },
   	 "onDelivered": {
   		 "type": "Request"
     	 },
   	 "onOk": {
   		 "type": "Request"
   	 },
   	 "onError": {
   		 "type": "Request"
   	 },
   	 "onInfo": {
   		 "type": "Request"
   	 },
   	 "cmdExecution": {
   		 "type": "value",
   		 "value": true,
   		 "metadata": {}
   	 },
   	 "dateExpiration": {
   		 "type": "DateTime",
   		 "value": "2020-05-27T20:00:00.000Z",
   		 "metadata": {}
   	 }
    }]
}' -H 'content-type: application/json' -H 'fiware-service: smartcity' -H 'fiware-servicepath: /'

@AlvaroVega AlvaroVega changed the title [WIP] fix default notificationHandler [WIP] allow receive command notifications from CB Jan 31, 2024
@AlvaroVega AlvaroVega marked this pull request as ready for review February 5, 2024 15:49
@AlvaroVega AlvaroVega changed the title [WIP] allow receive command notifications from CB allow receive command notifications from CB Feb 5, 2024
@AlvaroVega AlvaroVega requested a review from fgalan May 8, 2025 07:21
@fgalan
Copy link
Member

fgalan commented May 22, 2025

LGTM

@fgalan fgalan merged commit 206d0d1 into master May 22, 2025
10 of 13 checks passed
@fgalan fgalan deleted the task/set_default_notification_handler branch May 22, 2025 16:31
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

Successfully merging this pull request may close these issues.

2 participants