Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-16014

[fiware-stackoverflow] LoRaWAN IoT Agent commands not properly forwarded

    Details

      Description

      Created question in FIWARE Q/A platform on 12-07-2019 at 12:07
      Please, ANSWER this question AT https://stackoverflow.com/questions/57004964/lorawan-iot-agent-commands-not-properly-forwarded

      Question:
      LoRaWAN IoT Agent commands not properly forwarded

      Description:
      I'm working on WSN prototype using FIWARE to retrieve measurements from sensors and send commands back to actuators.

      I am using Orion as context broker, LoRaWAN IoT Agent for south and north bounds, other components that are not relevant to this issue.

      I am running all components on docker compose.

      I was able to subscribe to MQTT topic and publish data using MQTT.fx to simulate the data traffic coming from the sensors to Orion CB passing by IoT Agent.

      the IoT agent successfully received the message and forwarded it to Orion; I can clearly see the updated value of the attribute in Orion.

      To this point, everything is working just fine, now I want to send commands back to actuators, I have followed this tutorial! step by step I could see the command value being updated in Orion when I update it but I wasn't able to know whether the command was sent back to the actuator through the agent.

      I have registered the agent as a context provider, as explained in the tutorial.

      curl -iX POST \
      'http://localhost:1026/v2/registrations' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: agriculture' \
      -H 'fiware-servicepath: /irrigation' \
      -d '{
      "description": "Pump Commands",
      "dataProvided": {
      "entities": [

      { "id": "urn:ngsi-ld:tempHumid:001", "type": "tempHumid" }

      ],
      "attrs": [ "on", "off" ]
      },
      "provider": {
      "http":

      {"url": "http://orion:1026/v1"}

      ,
      "legacyForwarding": true
      }
      }'

      and update the value of the command,

      curl -iX PATCH \
      'http://localhost:1026/v2/entities/urn:ngsi-ld:tempHumid:001/attrs' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: agriculture' \
      -H 'fiware-servicepath: /irrigation' \
      -d '{
      "on":

      { "type" : "command", "value" : "ONN" }

      }'

      Log from ORION

      fiware-orion | INFO@10:26:33 logMsg.h[1874]: Transaction ended
      fiware-orion | INFO@10:26:42 logMsg.h[1844]: Starting transaction from 172.18.1.1:57492/v2/entities/urn:ngsi-ld:tempHumid:001/attrs
      fiware-orion | INFO@10:26:42 rest.cpp[885]: Service Path 0: '/irrigation'
      fiware-orion | INFO@10:26:42 connectionOperations.cpp[239]: Database Operation Successful (count: { _id.id: "urn:ngsi-ld:tempHumid:001", _id.servicePath:

      { $in: [ /^/irrigation$/ ] }

      })
      fiware-orion | INFO@10:26:42 connectionOperations.cpp[94]: Database Operation Successful (query: { _id.id: "urn:ngsi-ld:tempHumid:001", _id.servicePath:

      { $in: [ /^/irrigation$/ ] }

      })
      fiware-orion | INFO@10:26:42 connectionOperations.cpp[94]: Database Operation Successful (query: { $or: [ { entities.id: "urn:ngsi-ld:tempHumid:001", $or: [

      { entities.type: "tempHumid" }

      , { entities.type:

      { $exists: false }

      } ], entities.isPattern: "false", entities.isTypePattern:

      { $ne: true }

      , expiration:

      { $gt: 1562927202 }

      , status:

      { $ne: "inactive" }

      , servicePath:

      { $in: [ /^$|^/#$|^/irrigation/#$|^/irrigation$/, null ] }

      }, { entities.isPattern: "true", entities.isTypePattern:

      { $ne: true }

      , expiration:

      { $gt: 1562927202 }

      , status:

      { $ne: "inactive" }

      , servicePath:

      { $in: [ /^$|^/#$|^/irrigation/#$|^/irrigation$/, null ] }

      , $where: function(){for (var i=0; i < this.entities.length; i++)

      {if (this.enti... }, { entities.isPattern: "false", entities.isTypePattern: true, expiration: { $gt: 1562927202 }, status: { $ne: "inactive" }, servicePath: { $in: [ /^$|^/#$|^/irrigation/#$|^/irrigation$/, null ] }, $where: function(){for (var i=0; i < this.entities.length; i++) {if (this.enti... }

      , { entities.isPattern: "true", entities.isTypePattern: true, expiration:

      { $gt: 1562927202 }

      , status:

      { $ne: "inactive" }

      , servicePath:

      { $in: [ /^$|^/#$|^/irrigation/#$|^/irrigation$/, null ] }

      , $where: function(){for (var i=0; i < this.entities.length; i++)

      {if (this.enti... }

      ] })
      fiware-orion | INFO@10:26:42 connectionOperations.cpp[449]: Database Operation Successful (update: <{ _id.id: "urn:ngsi-ld:tempHumid:001", _id.type: "tempHumid", _id.servicePath:

      { $in: [ /^/irrigation$/ ] }

      }, { $set: { attrs.on:

      { value: "ONN", type: "command", mdNames: [], creDate: 1562918839, modDate: 1562927202 }

      , modDate: 1562927202, lastCorrelator: "8ae2258a-a48f-11e9-baf2-0242ac120106" }, $unset:

      { location: 1, expDate: 1 }

      }>)
      fiware-orion | INFO@10:26:42 logMsg.h[1874]: Transaction ended

      Querying orion after patch

      {"id":"urn:ngsi-ld:tempHumid:001","type":"tempHumid","TimeInstant":{"type":"DateTime","value":"2019-07-11T18:01:53.00Z","metadata":{}},"deviceState":{"type":"Text","value":" ","metadata":{}},"off_info":{"type":"commandResult","value":" ","metadata":{}},"off_status":{"type":"commandStatus","value":"UNKNOWN","metadata":{}},"on":{"type":"command","value":"ONN","metadata":{}},"on_info":{"type":"commandResult","value":" ","metadata":{}},"on_status":{"type":"commandStatus","value":"UNKNOWN","metadata":{}}}

      nothing was reported in the log of the IoT agent.

      I suppose that I may be able to see something when the command is pushed back to the actuator through the MQTT.fx or in Loraserver as a packet being transmitted.

      Thank you!

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2019-07-12 15:06|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2019-07-12 15:06|CREATED monitor | # answers= 0, accepted answer= False

          People

          • Assignee:
            roberto.castillo Roberto Castillo
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: