Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant retrieve an Attribute #89

Open
fermenreq opened this issue Aug 24, 2017 · 0 comments
Open

Cant retrieve an Attribute #89

fermenreq opened this issue Aug 24, 2017 · 0 comments

Comments

@fermenreq
Copy link

Hi all

I cant recover an attribute that I include in my device.

First I create a service:

(curl localhost:4041/iot/services -s -S --header 'Content-Type: application/json' \
  --header 'Accept: application/json' --header 'fiware-service: Weather' --header 'fiware-servicepath: /baloons' \
  -d @- | python -mjson.tool) <<EOF
{
  "services": [
    {
      "resource": "/weatherBaloon",
      "apikey": "",
      "type": "WeatherBaloon",
      "commands": [],
      "lazy": [
        {
          "name": "Longitude",
          "type": "double"
        },
        {
          "name": "Latitude",
          "type": "double"
        },
        {
          "name": "Temperature Sensor",
          "type": "degrees"
        }
      ],
      "active": [
        {
          "name": "Power Control",
          "type": "Boolean"
        }
      ]
    }
  ]
}
EOF

The IotAgent response:

time=2017-08-24T09:49:47.295Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IOTAgent.LWM2MHandlers | msg=Device register not found. Creating new device.
time=2017-08-24T09:49:47.296Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IOTAgent.LWM2MHandlers | msg=Mapping device found to NGSI register
time=2017-08-24T09:49:47.299Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.DeviceService | msg=Registering device into NGSI Service:
{
    "id": "weather1",
    "name": "weather1:WeatherBaloon",
    "type": "WeatherBaloon",
    "service": "Weather",
    "subservice": "/baloons",
    "lazy": [
        {
            "type": "double",
            "name": "Longitude"
        },
        {
            "type": "double",
            "name": "Latitude"
        },
        {
            "type": "degrees",
            "name": "Temperature Sensor"
        },
        {
            "name": "Latitude",
            "type": "String",
            "operations": "R"
        },
        {
            "name": "Longitude",
            "type": "String",
            "operations": "R"
        },
        {
            "name": "Altitude",
            "type": "String",
            "operations": "R"
        },
        {
            "name": "Uncertainty",
            "type": "String",
            "operations": "R"
        },
        {
            "name": "Velocity",
            "type": "Opaque",
            "operations": "R"
        },
        {
            "name": "Timestamp",
            "type": "Time",
            "operations": "R"
        },
        {
            "name": "Temperature Sensor#0",
            "type": "string"
        },
        {
            "name": "Power Control#0",
            "type": "string"
        }
    ],
    "active": [
        {
            "type": "Boolean",
            "name": "Power Control"
        }
    ],
    "internalId": 3
}

Before that I created 3 objects like the guide said.

I want to read Latitude attribute so I did a POST request like that:

curl http://localhost:1026/v1/queryContext -s -S --header 'Content-Type: application/json' \
 --header 'Accept: application/json' --header 'fiware-service: Weather' --header 'fiware-servicepath: /baloons' \
 -d '
{
    "entities": [
        {
            "type": "WeatherBaloon",
            "isPattern": "false",
            "id": "weather1:WeatherBaloon"
        }
    ],
    "attributes" : [
        "Latitude"
    ]    
}' 

but the response is :

{
"errorCode" : {
"code" : "404",
"reasonPhrase" : "No context element found"
}
}

Need Help !

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant