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

[fiware-stackoverflow] I cannot properly read Southbound commands through Orion to MQTT devices

    Details

    • Type: Monitor
    • Status: Answered
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: FIWARE-TECH-HELP

      Description

      Created question in FIWARE Q/A platform on 26-11-2022 at 11:11
      Please, ANSWER this question AT https://stackoverflow.com/questions/74581683/i-cannot-properly-read-southbound-commands-through-orion-to-mqtt-devices

      Question:
      I cannot properly read Southbound commands through Orion to MQTT devices

      Description:
      I am trying to send commands in the Southbound direction following this flow:

      The commands supported by the devices are provisioned as follows:
      "services": [
      {
      "apikey": "5jggokgpepnvsb2uv4s40d59ov",
      "cbroker": "'"http://orion:$ORION_PORT"'",
      "entity_type": "Agv",
      "transport": "MQTT",
      "resource": "",
      "commands": [
      {
      "object_id": "AGV_Alarm",
      "name": "AGV_Alarm",
      "type": "command",
      "value":

      { "data": "metadata_for_AGV_Alarm" }

      },
      {
      "object_id": "AGV_Event",
      "name": "AGV_Event",
      "type": "command",
      "value":

      { "data": "metadata_for_AGV_Event" }

      }
      ],

      The request to send the command in the Southbound direction is made through the Orion Context Broker:
      curl -iX PATCH \
      'http://orion:1026/v2/entities/urn:ngsi-ld:Agv:001/attrs' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: openiot' \
      -H 'fiware-servicepath: /' \
      -d '{
      "AGV_Event":

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

      }'

      To simulate actuators the following tool is used which is listening for commands via MQTT:
      docker run -it --rm --name mqtt-subscriber --network fiware_default efrecon/mqtt-client sub -h mosquitto -t "/5jggokgpepnvsb2uv4s40d59ov/agv001/cmd"

      I can receive only a part of the payload of the command:
      ubuntu@ip-172-31-85-246:~/FiwareDockerDevMode$ docker run -it --rm --name mqtt-subscriber --network fiware_default efrecon/mqtt-client sub -h mosquitto -t "/5jggokgpepnvsb2uv4s40d59ov/agv001/cmd"

      {"AGV_Event":""} {"AGV_Event":""} {"AGV_Event":""}

      In the temporary MongoDB, the command status appears as PENDING
      AGV_Event_status: {
      type: 'commandStatus',
      creDate: 1669583822.6813245,
      modDate: 1669584130.4993052,
      value: 'PENDING',
      mdNames: [
      'TimeInstant'
      ],
      md: {
      TimeInstant:

      { type: 'DateTime', value: 1669584130.495 }

      }
      },
      AGV_Event_info:

      { type: 'commandResult', creDate: 1669583822.6813245, modDate: 1669583822.6813245, value: ' ', mdNames: [] }

      ,

      Update
      If, on the other hand, I send the command according to the structure it has in MongoDB:
      curl -iX PATCH \
      'http://orion:1026/v2/entities/urn:ngsi-ld:Agv:001/attrs' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: openiot' \
      -H 'fiware-servicepath: /' \
      -d '{
      "AGV_Event_info":

      { "type": "commandResult", "value": "200" }

      ,
      "AGV_Event_status":

      { "type": "commandStatus", "value": "OK" }

      }'

      Now, nothing is received in the actuator simulator:
      ubuntu@ip-172-31-85-246:~/FiwareDockerDevMode$ docker run -it --rm --name mqtt-subscriber --network fiware_default efrecon/mqtt-client sub -h mosquitto -t "/5jggokgpepnvsb2uv4s40d59ov/agv001/cmd"

      However, the temporary MongoDB is updated properly:
      AGV_Event_status:

      { type: 'commandStatus', creDate: 1669731581.9883916, modDate: 1669733857.6557434, value: 'OK', mdNames: [] }

      ,
      AGV_Event_info:

      { type: 'commandResult', creDate: 1669731581.9883916, modDate: 1669733857.6557305, value: '200', mdNames: [] }

      ,

      The official documentation of the IoTAgent-JSON suggests that when commands are sent in the Southbound direction the actuator will send a response, which would make sense considering that my actuators are dummies.
      Any suggestions on how to receive all the information sent through the Orion Context Broker?

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2023-01-12 05:32|CREATED monitor | # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2023-01-12 05:32|CREATED monitor | # answers= 1, accepted answer= False

          People

          • Assignee:
            jason.fox Jason Fox
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: