Atos-Research-and-Innovation / IoTagent-LoRaWAN

FIWARE IoT Agent for LoRaWAN protocol (with CayenneLpp and CBOR data models)
https://fiware-lorawan.readthedocs.io/en/latest/
Other
34 stars 40 forks source link

Using with Orion v 1.13.0 #64

Closed filgiuff closed 5 years ago

filgiuff commented 5 years ago

I've tried to install the IoTAgent.LoRaWAN within our existing architecture, it uses Orion v 1.13.0 the get devices API http://{{AgentHost}}:{{agent.lora.port.north}}/iot/devices works fine

{ "count": 0, "devices": [] }

but when I try to provision a device, this error appears

{ "name": "ENTITY_GENERIC_ERROR", "message": "Error accesing entity data for device: fake_device of type: LoraDevice" }

On the agent logs there are several errors, including the following:

... iotstack_iotagent-lora.1.e9efq0yu0a8l@xerus-1 | time=2019-05-03T10:06:41.247Z | lvl=ERROR | corr=5c4b7e1d-2d64-4a99-aa80-6632bc966b23 | trans=5c4b7e1d-2d64-4a99-aa80-6632bc966b23 | op=IoTAgentNGSI.DeviceService | srv=n/a | subsrv=n/a | msg=Protocol error connecting to the Context Broker [400]: [object Object] | comp=IoTAgent iotstack_iotagent-lora.1.e9efq0yu0a8l@xerus-1 | time=2019-05-03T10:06:41.248Z | lvl=DEBUG | corr=5c4b7e1d-2d64-4a99-aa80-6632bc966b23 | trans=5c4b7e1d-2d64-4a99-aa80-6632bc966b23 | op=IoTAgentNGSI.DeviceProvisioning | srv=n/a | subsrv=n/a | msg=Device provisioning failed due to the following error: | comp=IoTAgent Error accesing entity data for device: fake_device12 of type: LoraDevice ...

The same flow, using Orion v 2.2.0-next works fine.

Is there a requirement for the minimum version of Orion? Is there a way to make this agent work with Orion v 1.13.0 ?

dcalvoalonso commented 5 years ago

This is caused because by default this agent uses NGSIv2 as you can see in https://github.com/Atos-Research-and-Innovation/IoTagent-LoRaWAN/blob/task/improveDocumentation/docker/config-docker.js#54. It seems that Orion v 1.13.0 did not support some NGSIv2 operations like POST '/v2/entities?options=upsert'. I would recommend you to use a modern version of Orion or to modify the agent configuration to use NGSIv1. To do so, you just need to remove from the configuration file the line 'ngsiVersion: 'v2' or to pass 'v1' to the environment variable 'IOTA_CB_NGSI_VERSION'.

filgiuff commented 5 years ago

Removing the line 'ngsiVersion: 'v2' from the configuration file, solved the issue. Thanks!