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

[fiware-stackoverflow] iotagent-json using MQTT not publishing anything when command is sent

    Details

      Description

      Created question in FIWARE Q/A platform on 21-12-2017 at 17:12
      Please, ANSWER this question AT https://stackoverflow.com/questions/47928899/iotagent-json-using-mqtt-not-publishing-anything-when-command-is-sent

      Question:
      iotagent-json using MQTT not publishing anything when command is sent

      Description:
      On my server I have Orion context broker and an IoT agent working in docker containers. I can register and update my entity using MQTT protocol no problem. But I would like to be able to send command to my device using the command system in the IoT Agent. In the Documentation, it says that when a command is registered, the IoT agent publish something in /apiKey/EntityID/cmd. However, when I do so, I don't have anything published. The entity is updated properly (I can see the status of the command going to PENDING, and positive LOG telling me that everything is OK. But nothing is published on my MQTT topic.

      Here is my docker-compose.yml file:

      version: '3.3'
      services:
      iot-mongo:
      image: mongo:3.2
      ports:

      • "27017:27017"
        volumes:
      • ./data/mongo:/data/db

      iot-agent:
      image: fiware/iotagent-json
      ports:

      • "4041:4041"
        links:
      • iot-mongo
      • orion
      • mosquitto
        volumes:
      • ./config.js:/opt/iotajson/config.js
        mosquitto:
        image: toke/mosquitto
        ports:
      • "1883:1883"
      • "9001:9001"
        orion:
        image: fiware/orion:1.9.0
        links:
      • iot-mongo
        ports:
      • "1026:1026"
        command: -dbhost iot-mongo

      I create my entity like this :

      curl -X POST http://127.23.64.163:4041/iot/devices \
      -i \
      -H "Content-Type: application/json" \
      -H "Fiware-Service: proj" \
      -H "Fiware-ServicePath: /proj" \
      -d ' { "devices": [
      { "device_id": "iotsensor10", "entity_name": "iotsensor10", "entity_type": "sensorping", "timezone": "America/Santiago",
      "commands": [

      { "name": "ping", "type": "command", "value": ""}

      ],
      "attributes": [

      { "object_id": "title", "name": "title", "type": "Text" }

      ,

      { "object_id": "percentage", "name": "percentage", "type": "Text" }

      ],
      "static_attributes": [

      { "name": "att_name", "type": "string", "value": "value" }

      ] }
      ]
      }'

      I can update my entity with the following command:

      mosquitto_pub -h 127.23.64.163 -t /1234/iotsensor10/attrs -m '

      {"title": "mqtttitle", "percentage": "31.5"}

      '

      and create a command like this :

      curl --request POST http://127.23.64.163:1026/v1/updateContext \
      -i \
      -H "Content-Type: application/json" \
      -H "Accept: application/json" \
      -H "Fiware-Service: proj" \
      -H "Fiware-ServicePath: /proj" \
      -d ' {"updateAction": "UPDATE", "contextElements": [
      {"id": "iotsensor10", "type": "sensorping", "isPattern": "false",
      "attributes": [

      {"name": "ping", "type": "command", "value": "ALIVE" }

      ]
      }
      ]}'

      and I subscribe with :

      mosquitto_sub -h 127.23.64.163 -t /# -v

      But I see nothing coming when I create a command.

      However, if I run :

      mosquitto_pub -h 127.23.64.163 -t /1234/iotsensor10/cmdexe -m '

      {"ping": "kebab"}

      '

      I can validate the command and watch the result on my entity. The only problem I have is that nothing is published when the command is created when I expect something to be published on /apikey/sensor10/cmd . Any idea why and how to fix it?

      Update 1

      I tried to do the same manipulations with the image fiware/iotagent-ul but I have the exact same result. Nothing is published.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        4d 19h 17m 1 Backlog Manager 17/Jan/18 3:05 PM
        In Progress In Progress Closed Closed
        2h 59m 1 Backlog Manager 17/Jan/18 6:05 PM
        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        fla Fernando Lopez made changes -
        HD-Enabler IDAS [ 10884 ]
        HD-Chapter IoT [ 10839 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-17 18:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-17 18:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True
        backlogmanager Backlog Manager made changes -
        Resolution Done [ 10000 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-17 15:05|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-17 15:05|UPDATED status: transition Answer| # answers= 1, accepted answer= True
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        fla Fernando Lopez made changes -
        Assignee Jose Gato Luis [ josegato ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 19:48|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 19:48|CREATED monitor | # answers= 0, accepted answer= False
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            josegato Jose Gato Luis
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: