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

[fiware-askbot] Tourguide App: problem sending data to sensor

    Details

      Description

      Created question in FIWARE Q/A platform on 19-01-2017 at 09:01
      Please, ANSWER this question AT https://ask.fiware.org/question/704/tourguide-app-problem-sending-data-to-sensor/

      Question:
      Tourguide App: problem sending data to sensor

      Description:
      Hello,

      In the Tourguide App documentation, I can't see the attributes of the created sensor when following Manage IoT Data section.

      I just tried with a clean install of the tutorial, and this is what I get:

      (if you, or anybody else, can tell me how I can make the json format look nicer in markdown syntax, any hint would be welcome... I'll update the code below)

      I post following request to create the IDAS service:

      curl -X POST -H "Content-Type: application/json" -H "fiware-service: tourguide" -H "fiware-servicepath: /Franchise1" -H "Cache-Control: no-cache" -H "Postman-Token: 72a15f7f-33a4-65a0-3ab9-a8efa3926ba2" -d '{
      "services": [

      { "apikey": "tourguide-devices", "cbroker": "http://orion:1026", "resource": "/iot/d", "entity_type": "Restaurant" }

      ]
      }' "http://localhost:4041/iot/services"

      with header:
      Content-Type:application/json
      fiware-service:tourguide
      fiware-servicepath:/Franchise1

      then I registered the sensor as following with the same headers

      {
      "devices": [
      {
      "device_id": "myRestaurant-sensor-0115206c51f60b48b77e4c937835795c33bb953f",
      "protocol": "UL20",
      "entity_name": "0115206c51f60b48b77e4c937835795c33bb953f",
      "entity_type": "Sensor",
      "attributes": [

      { "object_id": "mt", "name": "myTemperature", "type": "number" }

      ]
      }
      ]
      }

      (both requests return 200 and 201 with {}, so it looks fine)

      Then querying the entity to see if the attributes are there with:

      curl -X GET -H "Accept: application/json" -H "fiware-service: tourguide" -H "fiware-servicepath: /Franchise1" -H "Cache-Control: no-cache" -H "Postman-Token: 53553316-1502-b818-99eb-449c0b00105a" "http://localhost:1026/v2/entities/0115206c51f60b48b77e4c937835795c33bb953f?options=keyValues&type=Restaurant"

      gives me this answer:

      {
      "id": "0115206c51f60b48b77e4c937835795c33bb953f",
      "type": "Restaurant",
      "address":

      { "streetAddress": "Cuesta de las Cabras Aldapa 2", "addressRegion": "Araba", "addressLocality": "Alegría-Dulantzi", "postalCode": "01240" }

      ,
      "aggregateRating":

      { "reviewCount": 1, "ratingValue": 4 }

      ,
      "capacity": 120,
      "department": "Franchise1",
      "description": "Restaurante de estilo sidrería ubicado en Alegria-Dulantzi. Además de su menú del día y carta, también ofrece menú de sidrería. El menú del día cuesta 9 euros. Los fines de semana la especialidad de la casa son las alubias con sacramentos. En lo que a bebidas se refiere, hay una amplia selección además de la sidra. Cabe destacar que se puede hacer txotx. La capacidad del establecimiento es de 50 personas pero la sidrería no dispone de aparcamiento.%5cn%5cnHORARIO: %5cn%5cnLunes a domingo: 9:00-17:00 y 19:00-23:00.",
      "location": "42.8404625, -2.5123277",
      "name": "Elizalde",
      "occupancyLevels": 0,
      "priceRange": 0,
      "telephone": "945 400 868"
      }

      --> So no sign of the added attribute... Why is that?

      If I do the request without "type=Restaurant" i get:

      { "error": "TooManyResults", "description": "More than one matching entity. Please refine your query" }

      Why are there more than one result on a request specifying an entity with a unique id?

        Activity

        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        fla Fernando Lopez made changes -
        HD-Enabler Orion [ 10875 ]
        Description
        Created question in FIWARE Q/A platform on 19-01-2017 at 09:01
        {color: red}Please, ANSWER this question AT{color} https://ask.fiware.org/question/704/tourguide-app-problem-sending-data-to-sensor/


        +Question:+
        Tourguide App: problem sending data to sensor

        +Description:+
        Hello,

        In the Tourguide App documentation, I can't see the attributes of the created sensor when following Manage IoT Data section.

        I just tried with a clean install of the tutorial, and this is what I get:

        (if you, or anybody else, can tell me how I can make the json format look nicer in markdown syntax, any hint would be welcome... I'll update the code below)

        I post following request to create the IDAS service:


        curl -X POST -H "Content-Type: application/json" -H "fiware-service: tourguide" -H "fiware-servicepath: /Franchise1" -H "Cache-Control: no-cache" -H "Postman-Token: 72a15f7f-33a4-65a0-3ab9-a8efa3926ba2" -d '{
            "services": [
                {
                    "apikey": "tourguide-devices",
                    "cbroker": "http://orion:1026",
                    "resource": "/iot/d",
                    "entity_type": "Restaurant"
                }
            ]
        }' "http://localhost:4041/iot/services"


        with header:
        Content-Type:application/json
        fiware-service:tourguide
        fiware-servicepath:/Franchise1

        then I registered the sensor as following with the same headers

        {
          "devices": [
            {
              "device_id": "myRestaurant-sensor-0115206c51f60b48b77e4c937835795c33bb953f",
              "protocol": "UL20",
              "entity_name": "0115206c51f60b48b77e4c937835795c33bb953f",
              "entity_type": "Sensor",
              "attributes": [
                {
                  "object_id": "mt",
                  "name": "myTemperature",
                  "type": "number"
                }
              ]
            }
          ]
        }

        (both requests return 200 and 201 with {}, so it looks fine)

        Then querying the entity to see if the attributes are there with:

        curl -X GET -H "Accept: application/json" -H "fiware-service: tourguide" -H "fiware-servicepath: /Franchise1" -H "Cache-Control: no-cache" -H "Postman-Token: 53553316-1502-b818-99eb-449c0b00105a" "http://localhost:1026/v2/entities/0115206c51f60b48b77e4c937835795c33bb953f?options=keyValues&type=Restaurant"

        gives me this answer:

        {
            "id": "0115206c51f60b48b77e4c937835795c33bb953f",
            "type": "Restaurant",
            "address": {
                "streetAddress": "Cuesta de las Cabras Aldapa 2",
                "addressRegion": "Araba",
                "addressLocality": "Alegría-Dulantzi",
                "postalCode": "01240"
            },
            "aggregateRating": {
                "reviewCount": 1,
                "ratingValue": 4
            },
            "capacity": 120,
            "department": "Franchise1",
            "description": "Restaurante de estilo sidrería ubicado en Alegria-Dulantzi. Además de su menú del día y carta, también ofrece menú de sidrería. El menú del día cuesta 9 euros. Los fines de semana la especialidad de la casa son las alubias con sacramentos. En lo que a bebidas se refiere, hay una amplia selección además de la sidra. Cabe destacar que se puede hacer txotx. La capacidad del establecimiento es de 50 personas pero la sidrería no dispone de aparcamiento.%5cn%5cnHORARIO: %5cn%5cnLunes a domingo: 9:00-17:00 y 19:00-23:00.",
            "location": "42.8404625, -2.5123277",
            "name": "Elizalde",
            "occupancyLevels": 0,
            "priceRange": 0,
            "telephone": "945 400 868"
        }

        --> So no sign of the added attribute... Why is that?

        If I do the request without "type=Restaurant" i get:

        {
          "error": "TooManyResults",
          "description": "More than one matching entity. Please refine your query"
        }

        Why are there more than one result on a request specifying an entity with a unique id?
        Created question in FIWARE Q/A platform on 19-01-2017 at 09:01
        {color: red}Please, ANSWER this question AT{color} https://ask.fiware.org/question/704/tourguide-app-problem-sending-data-to-sensor/


        +Question:+
        Tourguide App: problem sending data to sensor

        +Description:+
        Hello,

        In the Tourguide App documentation, I can't see the attributes of the created sensor when following Manage IoT Data section.

        I just tried with a clean install of the tutorial, and this is what I get:

        (if you, or anybody else, can tell me how I can make the json format look nicer in markdown syntax, any hint would be welcome... I'll update the code below)

        I post following request to create the IDAS service:


        curl -X POST -H "Content-Type: application/json" -H "fiware-service: tourguide" -H "fiware-servicepath: /Franchise1" -H "Cache-Control: no-cache" -H "Postman-Token: 72a15f7f-33a4-65a0-3ab9-a8efa3926ba2" -d '{
            "services": [
                {
                    "apikey": "tourguide-devices",
                    "cbroker": "http://orion:1026",
                    "resource": "/iot/d",
                    "entity_type": "Restaurant"
                }
            ]
        }' "http://localhost:4041/iot/services"


        with header:
        Content-Type:application/json
        fiware-service:tourguide
        fiware-servicepath:/Franchise1

        then I registered the sensor as following with the same headers

        {
          "devices": [
            {
              "device_id": "myRestaurant-sensor-0115206c51f60b48b77e4c937835795c33bb953f",
              "protocol": "UL20",
              "entity_name": "0115206c51f60b48b77e4c937835795c33bb953f",
              "entity_type": "Sensor",
              "attributes": [
                {
                  "object_id": "mt",
                  "name": "myTemperature",
                  "type": "number"
                }
              ]
            }
          ]
        }

        (both requests return 200 and 201 with {}, so it looks fine)

        Then querying the entity to see if the attributes are there with:

        curl -X GET -H "Accept: application/json" -H "fiware-service: tourguide" -H "fiware-servicepath: /Franchise1" -H "Cache-Control: no-cache" -H "Postman-Token: 53553316-1502-b818-99eb-449c0b00105a" "http://localhost:1026/v2/entities/0115206c51f60b48b77e4c937835795c33bb953f?options=keyValues&type=Restaurant"

        gives me this answer:

        {
            "id": "0115206c51f60b48b77e4c937835795c33bb953f",
            "type": "Restaurant",
            "address": {
                "streetAddress": "Cuesta de las Cabras Aldapa 2",
                "addressRegion": "Araba",
                "addressLocality": "Alegría-Dulantzi",
                "postalCode": "01240"
            },
            "aggregateRating": {
                "reviewCount": 1,
                "ratingValue": 4
            },
            "capacity": 120,
            "department": "Franchise1",
            "description": "Restaurante de estilo sidrería ubicado en Alegria-Dulantzi. Además de su menú del día y carta, también ofrece menú de sidrería. El menú del día cuesta 9 euros. Los fines de semana la especialidad de la casa son las alubias con sacramentos. En lo que a bebidas se refiere, hay una amplia selección además de la sidra. Cabe destacar que se puede hacer txotx. La capacidad del establecimiento es de 50 personas pero la sidrería no dispone de aparcamiento.%5cn%5cnHORARIO: %5cn%5cnLunes a domingo: 9:00-17:00 y 19:00-23:00.",
            "location": "42.8404625, -2.5123277",
            "name": "Elizalde",
            "occupancyLevels": 0,
            "priceRange": 0,
            "telephone": "945 400 868"
        }

        --> So no sign of the added attribute... Why is that?

        If I do the request without "type=Restaurant" i get:

        {
          "error": "TooManyResults",
          "description": "More than one matching entity. Please refine your query"
        }

        Why are there more than one result on a request specifying an entity with a unique id?
        backlogmanager Backlog Manager made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        fla Fernando Lopez made changes -
        Component/s FIWARE-TECH-HELP [ 10278 ]
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        fla Fernando Lopez made changes -
        Field Original Value New Value
        Assignee Jose Manuel Cantera [ jmcantera ]
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            jmcantera Jose Manuel Cantera
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: