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

[fiware-stackoverflow] Does the Fiware JSON IoT Agent expect an answer from devices?

    Details

    • Type: Monitor
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2021
    • Component/s: FIWARE-TECH-HELP
    • Labels:

      Description

      Created question in FIWARE Q/A platform on 29-03-2019 at 12:03
      Please, ANSWER this question AT https://stackoverflow.com/questions/55416887/does-the-fiware-json-iot-agent-expect-an-answer-from-devices

      Question:
      Does the Fiware JSON IoT Agent expect an answer from devices?

      Description:
      I'm running the Fiware IoT Agent example locally. The plan is to hook this up to some sort of Device and make a demo. I'm using request bin to inspect the requests sent from the IoT Agent.

      After starting the environment with ./services start I'm calling this shell script to register a bell device in the agent and then trigger the "ring" command.

      curl -iX POST \
      'http://localhost:4041/iot/devices' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: openiot' \
      -H 'fiware-servicepath: /' \
      -d '{
      "devices": [
      {
      "device_id": "bell001",
      "entity_name": "urn:ngsi-ld:Bell:001",
      "entity_type": "Bell",
      "protocol": "PDI-IoTA-UltraLight",
      "transport": "HTTP",
      "endpoint": "https://requestbin.fullcontact.com/zhygotzh/iot/bell001",
      "commands": [

      { "name": "ring", "type": "command" }

      ],
      "static_attributes": []
      }
      ]
      }
      '

      curl -iX POST \
      'http://localhost:4041/v1/updateContext' \
      -H 'Content-Type: application/json' \
      -H 'fiware-service: openiot' \
      -H 'fiware-servicepath: /' \
      -d '{
      "contextElements": [
      {
      "type": "Bell",
      "isPattern": "false",
      "id": "urn:ngsi-ld:Bell:001",
      "attributes": [

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

      ],
      "static_attributes": []
      }
      ],
      "updateAction": "UPDATE"
      }'

      This works well, I'm getting a 200 response and I can see the request in request bin.

      $ ./setup-ul.sh
      HTTP/1.1 201 Created
      X-Powered-By: Express
      Fiware-Correlator: 8298b65a-8550-4b6e-8a4d-21bc32abdf8a
      Content-Type: application/json; charset=utf-8
      Content-Length: 2
      ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
      Date: Fri, 29 Mar 2019 11:34:05 GMT
      Connection: keep-alive

      {}HTTP/1.1 200 OK
      X-Powered-By: Express
      Fiware-Correlator: c79a1146-05d8-4eb1-8e1c-bf19661cb403
      Content-Type: application/json; charset=utf-8
      Content-Length: 208
      ETag: W/"d0-6+Ce6hwRVmP90ZI667iON6zHtdA"
      Date: Fri, 29 Mar 2019 11:34:07 GMT
      Connection: keep-alive

      {"contextResponses":[{"contextElement":{"attributes":[

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

      ],"id":"urn:ngsi-ld:Bell:001","isPattern":false,"type":"Bell"},"statusCode":{"code":200,"reasonPhrase":"OK"}}]}

      However, the request is in the Ultra Light format. I would prefer the JSON format. So I figured I'd just replace the image in the docker compose file.

      iot-agent:
      image: fiware/iotagent-ul:1.8.0
      hostname: iot-agent

      Gets changed to

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

      in docker-compose.yml.

      Now when I try the same thing with the updated docker-compose file I get the following result:

      $ ./setup.sh
      HTTP/1.1 201 Created
      X-Powered-By: Express
      Fiware-Correlator: 69d6a6ad-a44a-4e57-87dd-4e512d499fee
      Content-Type: application/json; charset=utf-8
      Content-Length: 2
      ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
      Date: Fri, 29 Mar 2019 11:44:36 GMT
      Connection: keep-alive

      {}HTTP/1.1 400 Bad Request
      X-Powered-By: Express
      Fiware-Correlator: 6c9a28b5-0505-456c-bcdb-841df2bc6f62
      Content-Type: application/json; charset=utf-8
      Content-Length: 388
      ETag: W/"184-RqfzTJc6iD9nXX3kAbxZqwruJC0"
      Date: Fri, 29 Mar 2019 11:44:37 GMT
      Connection: keep-alive

      {"contextResponses":[{"contextElement":{"contextElements":[{"type":"Bell","isPattern":"false","id":"urn:ngsi-ld:Bell:001","attributes":[

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

      ],"static_attributes":[]}],"updateAction":"UPDATE"},"statusCode":{"code":400,"reasonPhrase":"HTTP_COMMAND_RESPONSE_ERROR","details":"There was an error in the response of a device to a command [400 ]:null"}}]}

      This seems to be the relevant part: There was an error in the response of a device to a command [400 ]:null. Does this mean that the IoT Agent was expecting some more specific response from the "device"?

      The request can be seen in request bin, so it worked that far. But why does the agent think there was a problem? Does it expect some specific response format?

      I've tried chaing the "protocol" in the device registration step to "PDI-IoTA-JSON" as well. That didn't help.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        4d 19h 59m 1 Backlog Manager 03/Apr/19 12:06 PM
        In Progress In Progress Closed Closed
        2h 59m 1 Backlog Manager 03/Apr/19 3:06 PM
        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2019-04-03 15:06|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2019-04-03 15:06|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 -

        2019-04-03 12:06|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2019-04-03 12:06|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 ]
        fla Fernando Lopez made changes -
        HD-Enabler IDAS [ 10884 ]
        Description
        Created question in FIWARE Q/A platform on 29-03-2019 at 12:03
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/55416887/does-the-fiware-json-iot-agent-expect-an-answer-from-devices


        +Question:+
        Does the Fiware JSON IoT Agent expect an answer from devices?

        +Description:+
        I'm running the Fiware IoT Agent example locally. The plan is to hook this up to some sort of Device and make a demo. I'm using request bin to inspect the requests sent from the IoT Agent.

        After starting the environment with ./services start I'm calling this shell script to register a bell device in the agent and then trigger the "ring" command.

        curl -iX POST \
          'http://localhost:4041/iot/devices' \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: openiot' \
          -H 'fiware-servicepath: /' \
          -d '{
          "devices": [
            {
              "device_id": "bell001",
              "entity_name": "urn:ngsi-ld:Bell:001",
              "entity_type": "Bell",
              "protocol": "PDI-IoTA-UltraLight",
              "transport": "HTTP",
              "endpoint": "https://requestbin.fullcontact.com/zhygotzh/iot/bell001",
              "commands": [
                { "name": "ring", "type": "command" }
               ],
               "static_attributes": []
            }
          ]
        }
        '

        curl -iX POST \
          'http://localhost:4041/v1/updateContext' \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: openiot' \
          -H 'fiware-servicepath: /' \
          -d '{
            "contextElements": [
                {
                    "type": "Bell",
                    "isPattern": "false",
                    "id": "urn:ngsi-ld:Bell:001",
                    "attributes": [
                        { "name": "ring", "type": "command", "value": "" }
                    ],
                    "static_attributes": []
                }
            ],
            "updateAction": "UPDATE"
        }'


        This works well, I'm getting a 200 response and I can see the request in request bin.

        $ ./setup-ul.sh
        HTTP/1.1 201 Created
        X-Powered-By: Express
        Fiware-Correlator: 8298b65a-8550-4b6e-8a4d-21bc32abdf8a
        Content-Type: application/json; charset=utf-8
        Content-Length: 2
        ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
        Date: Fri, 29 Mar 2019 11:34:05 GMT
        Connection: keep-alive

        {}HTTP/1.1 200 OK
        X-Powered-By: Express
        Fiware-Correlator: c79a1146-05d8-4eb1-8e1c-bf19661cb403
        Content-Type: application/json; charset=utf-8
        Content-Length: 208
        ETag: W/"d0-6+Ce6hwRVmP90ZI667iON6zHtdA"
        Date: Fri, 29 Mar 2019 11:34:07 GMT
        Connection: keep-alive

        {"contextResponses":[{"contextElement":{"attributes":[{"name":"ring","type":"command","value":""}],"id":"urn:ngsi-ld:Bell:001","isPattern":false,"type":"Bell"},"statusCode":{"code":200,"reasonPhrase":"OK"}}]}


        However, the request is in the Ultra Light format. I would prefer the JSON format. So I figured I'd just replace the image in the docker compose file.

          iot-agent:
            image: fiware/iotagent-ul:1.8.0
            hostname: iot-agent


        Gets changed to

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


        in docker-compose.yml.

        Now when I try the same thing with the updated docker-compose file I get the following result:

        $ ./setup.sh
        HTTP/1.1 201 Created
        X-Powered-By: Express
        Fiware-Correlator: 69d6a6ad-a44a-4e57-87dd-4e512d499fee
        Content-Type: application/json; charset=utf-8
        Content-Length: 2
        ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
        Date: Fri, 29 Mar 2019 11:44:36 GMT
        Connection: keep-alive

        {}HTTP/1.1 400 Bad Request
        X-Powered-By: Express
        Fiware-Correlator: 6c9a28b5-0505-456c-bcdb-841df2bc6f62
        Content-Type: application/json; charset=utf-8
        Content-Length: 388
        ETag: W/"184-RqfzTJc6iD9nXX3kAbxZqwruJC0"
        Date: Fri, 29 Mar 2019 11:44:37 GMT
        Connection: keep-alive

        {"contextResponses":[{"contextElement":{"contextElements":[{"type":"Bell","isPattern":"false","id":"urn:ngsi-ld:Bell:001","attributes":[{"name":"ring","type":"command","value":""}],"static_attributes":[]}],"updateAction":"UPDATE"},"statusCode":{"code":400,"reasonPhrase":"HTTP_COMMAND_RESPONSE_ERROR","details":"There was an error in the response of a device to a command [400 ]:null"}}]}


        This seems to be the relevant part: There was an error in the response of a device to a command [400 ]:null. Does this mean that the IoT Agent was expecting some more specific response from the "device"?

        The request can be seen in request bin, so it worked that far. But why does the agent think there was a problem? Does it expect some specific response format?

        I've tried chaing the "protocol" in the device registration step to "PDI-IoTA-JSON" as well. That didn't help.
        Created question in FIWARE Q/A platform on 29-03-2019 at 12:03
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/55416887/does-the-fiware-json-iot-agent-expect-an-answer-from-devices


        +Question:+
        Does the Fiware JSON IoT Agent expect an answer from devices?

        +Description:+
        I'm running the Fiware IoT Agent example locally. The plan is to hook this up to some sort of Device and make a demo. I'm using request bin to inspect the requests sent from the IoT Agent.

        After starting the environment with ./services start I'm calling this shell script to register a bell device in the agent and then trigger the "ring" command.

        curl -iX POST \
          'http://localhost:4041/iot/devices' \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: openiot' \
          -H 'fiware-servicepath: /' \
          -d '{
          "devices": [
            {
              "device_id": "bell001",
              "entity_name": "urn:ngsi-ld:Bell:001",
              "entity_type": "Bell",
              "protocol": "PDI-IoTA-UltraLight",
              "transport": "HTTP",
              "endpoint": "https://requestbin.fullcontact.com/zhygotzh/iot/bell001",
              "commands": [
                { "name": "ring", "type": "command" }
               ],
               "static_attributes": []
            }
          ]
        }
        '

        curl -iX POST \
          'http://localhost:4041/v1/updateContext' \
          -H 'Content-Type: application/json' \
          -H 'fiware-service: openiot' \
          -H 'fiware-servicepath: /' \
          -d '{
            "contextElements": [
                {
                    "type": "Bell",
                    "isPattern": "false",
                    "id": "urn:ngsi-ld:Bell:001",
                    "attributes": [
                        { "name": "ring", "type": "command", "value": "" }
                    ],
                    "static_attributes": []
                }
            ],
            "updateAction": "UPDATE"
        }'


        This works well, I'm getting a 200 response and I can see the request in request bin.

        $ ./setup-ul.sh
        HTTP/1.1 201 Created
        X-Powered-By: Express
        Fiware-Correlator: 8298b65a-8550-4b6e-8a4d-21bc32abdf8a
        Content-Type: application/json; charset=utf-8
        Content-Length: 2
        ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
        Date: Fri, 29 Mar 2019 11:34:05 GMT
        Connection: keep-alive

        {}HTTP/1.1 200 OK
        X-Powered-By: Express
        Fiware-Correlator: c79a1146-05d8-4eb1-8e1c-bf19661cb403
        Content-Type: application/json; charset=utf-8
        Content-Length: 208
        ETag: W/"d0-6+Ce6hwRVmP90ZI667iON6zHtdA"
        Date: Fri, 29 Mar 2019 11:34:07 GMT
        Connection: keep-alive

        {"contextResponses":[{"contextElement":{"attributes":[{"name":"ring","type":"command","value":""}],"id":"urn:ngsi-ld:Bell:001","isPattern":false,"type":"Bell"},"statusCode":{"code":200,"reasonPhrase":"OK"}}]}


        However, the request is in the Ultra Light format. I would prefer the JSON format. So I figured I'd just replace the image in the docker compose file.

          iot-agent:
            image: fiware/iotagent-ul:1.8.0
            hostname: iot-agent


        Gets changed to

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


        in docker-compose.yml.

        Now when I try the same thing with the updated docker-compose file I get the following result:

        $ ./setup.sh
        HTTP/1.1 201 Created
        X-Powered-By: Express
        Fiware-Correlator: 69d6a6ad-a44a-4e57-87dd-4e512d499fee
        Content-Type: application/json; charset=utf-8
        Content-Length: 2
        ETag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
        Date: Fri, 29 Mar 2019 11:44:36 GMT
        Connection: keep-alive

        {}HTTP/1.1 400 Bad Request
        X-Powered-By: Express
        Fiware-Correlator: 6c9a28b5-0505-456c-bcdb-841df2bc6f62
        Content-Type: application/json; charset=utf-8
        Content-Length: 388
        ETag: W/"184-RqfzTJc6iD9nXX3kAbxZqwruJC0"
        Date: Fri, 29 Mar 2019 11:44:37 GMT
        Connection: keep-alive

        {"contextResponses":[{"contextElement":{"contextElements":[{"type":"Bell","isPattern":"false","id":"urn:ngsi-ld:Bell:001","attributes":[{"name":"ring","type":"command","value":""}],"static_attributes":[]}],"updateAction":"UPDATE"},"statusCode":{"code":400,"reasonPhrase":"HTTP_COMMAND_RESPONSE_ERROR","details":"There was an error in the response of a device to a command [400 ]:null"}}]}


        This seems to be the relevant part: There was an error in the response of a device to a command [400 ]:null. Does this mean that the IoT Agent was expecting some more specific response from the "device"?

        The request can be seen in request bin, so it worked that far. But why does the agent think there was a problem? Does it expect some specific response format?

        I've tried chaing the "protocol" in the device registration step to "PDI-IoTA-JSON" as well. That didn't help.
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        Hide
        backlogmanager Backlog Manager added a comment -

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

        Show
        backlogmanager Backlog Manager added a comment - 2019-03-29 15:06|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: