5

This question is very similar to Missing attributes on Orion CB Entity when registering device through IDAS but found no definitive answer there.

I have been trying FiWare to get UL2.0 via IDAS to the Orion CB working in the Fiware-Lab env:

I have a FI-WARE Lab account with token generated. Adapted the config.ini file:

[user]
# Please, configure here your username at FIWARE Cloud and a valid Oauth2.0 TOKEN for your user (you can use get_token.py to obtain a valid TOKEN).
username=MY_USERNAME
token=MY_TOKEN

[contextbroker]
host=130.206.80.40
port=1026
OAuth=no
# Here you need to specify the ContextBroker database you are querying.
# Leave it blank if you want the general database or the IDAS service if you are looking for IoT devices connected by you.
# fiware_service=
fiware_service=bus_auto
fiware-service-path=/

[idas]
host=130.206.80.40
adminport=5371
ul20port=5371
OAuth=no
# Here you need to configure the IDAS service your devices will be sending data to.
# By default the OpenIoT service is provided.
# fiware-service=fiwareiot
fiware-service=bus_auto
fiware-service-path=/
#apikey=4jggokgpepnvsb2uv4s40d59ov
apikey=4jggokgpepnvsb2uv4s40d59ov

[local]
#Choose here your System type. Examples: RaspberryPI, MACOSX, Linux, ...
host_type=MACOSX
# Here please add a unique identifier for you. Suggestion: the 3 lower hexa bytes of your Ethernet MAC. E.g. 79:ed:af
# Also you may use your e-mail address.
host_id=a0:11:00

I used the SENSOR_TEMP template, adding the 'protocol' field (PDI-IoTA-UltraLight which as the first problem I stumbled upon):

{
 "devices": [
    { "device_id": "DEV_ID",
      "entity_name": "ENTITY_ID",
      "entity_type": "thing",
      "protocol": "PDI-IoTA-UltraLight",
      "timezone": "Europe/Amsterdam",
"attributes": [
        { "object_id": "otemp",
          "name": "temperature",
          "type": "int"
        } ],
 "static_attributes": [
        { "name": "att_name",
          "type": "string",
          "value": "value"
        }
       ]
      }
     ]
    }

Now I can Register the device ok. Like

python RegisterDevice.py SENSOR_TEMP NexusPro Temp-Otterlo

and see it in Device List:

python ListDevices.py

I can send Observations like

python SendObservation.py Temp-Otterlo 'otemp|17'

But in the ContextBroker I see the Entity but never the measurements, e.g.

python GetEntity.py Temp-Otterlo

Gives

* Asking to http://130.206.80.40:1026/ngsi10/queryContext
* Headers: {'Fiware-Service': 'bus_auto', 'content-type': 'application/json', 'accept': 'application/json', 'X-Auth-Token': 'NULL'}
* Sending PAYLOAD:
{
    "entities": [
        {
            "type": "",
            "id": "Temp-Otterlo",
            "isPattern": "false"
        }
    ],
    "attributes": []
}

...

* Status Code: 200
* Response:
{
  "contextResponses" : [
    {
      "contextElement" : {
        "type" : "thing",
        "isPattern" : "false",
        "id" : "Temp-Otterlo",
        "attributes" : [
          {
            "name" : "TimeInstant",
            "type" : "ISO8601",
            "value" : "2015-10-03T14:04:44.663133Z"
          },
          {
            "name" : "att_name",
            "type" : "string",
            "value" : "value",
            "metadatas" : [
              {
                "name" : "TimeInstant",
                "type" : "ISO8601",
                "value" : "2015-10-03T14:04:44.663500Z"
              }
            ]
          }
        ]
      },
      "statusCode" : {
        "code" : "200",
        "reasonPhrase" : "OK"
      }
    }
  ]
}

I get an TimeInstant attribute strangely. I tried playing with settings of the .ini like fiware-service=fiwareiot, but to no avail. I am out of ideas. The documentation at the catalogue. for IDAS4 is talking about observations to be sent to port 8002 and setting "OpenIoT" service, but that failed as well.

Any help appreciated.

Community
  • 1
  • 1
  • Have you tried using a different Orion Context Broker? (for example, your own). – LeandroGuillen Oct 05 '15 at 15:31
  • No not yet, also since it may be a common problem (see http://stackoverflow.com/questions/31051501/missing-attributes-on-orion-cb-entity-when-registering-device-through-idas). Could e.g. the OCB version matter? – Just van den Broecke Oct 07 '15 at 12:55
  • It could definitely be it. Try using the latest version of OCB (0.24 as of today). – LeandroGuillen Oct 07 '15 at 13:48
  • Yes, I have it working now using the latest OCB+IoTAgentCPP images within a Docker setup using the docker-compose method as described here: https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus/tree/develop/docker – Just van den Broecke Oct 30 '15 at 21:35

1 Answers1

0

You should run "python SendObservation.py NexusPro 'otemp|17'" instead of "python SendObservation.py Temp-Otterlo 'otemp|17'".

The reason is that you are providing an observation at the southbound and then, the DEV_ID should be used.

The entity does not include an attribute until an observation is received so then it is normal you are not able to see it. Once you try the one above it should all work.

Cheers,

Carlos Ralli
  • 316
  • 1
  • 3