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

Error decoding CaynneLPP message:Error: Invalid CayennLpp buffer size #99

Closed jfernandz closed 4 years ago

jfernandz commented 4 years ago

I've posted this question in StackOverflow with more details. I could reproduce in here if necessary, but essentially I'm trying to provisioning my IoTAgent with this HTTP POST request (the {{whatever}} are stored in Postman environment)

{
  "devices": [
    {
      "device_id": "{{node}}",
      "entity_name": "LORA-N-0",
      "entity_type": "LoraDevice",
      "timezone": "Europe/Madrid",
      "attributes": [
        {
          "object_id": "potVal",
          "name": "Pot_Value",
          "type": "Number"
        }
      ],
      "internal_attributes": {
        "lorawan": {
          "application_server": {
            "host": "eu.thethings.network",
            "username": "{{TTN_app_id}}",
            "password": "{{TTN_app_pw}}",
            "provider": "TTN"
          },
          "dev_eui": "{{TTN_dev_eui}}",
          "app_eui": "{{TTN_app_eui}}",
          "application_id": "{{TTN_app_id}}",
          "application_key": "{{TTN_app_skey}}"
        }
      }
    }
  ]
}

And it's apparently doing it because I'm able to retrieve the device info when I do the GET request to http://localhost:4061/iot/devices but I'm having the following error messages in the docker logs:

fiware-iot-agent | {"timestamp":"2020-06-23T12:55:18.324Z","level":"info","message":"New message in topic"}
fiware-iot-agent | {"timestamp":"2020-06-23T12:55:18.325Z","level":"info","message":"IOTA provisioned devices:"}
fiware-iot-agent | {"timestamp":"2020-06-23T12:55:18.326Z","level":"info","message":"Decoding CaynneLPP message:+XQ="}
fiware-iot-agent | {"timestamp":"2020-06-23T12:55:18.326Z","level":"error","message":"Error decoding CaynneLPP message:Error: Invalid CayennLpp buffer size"}
fiware-iot-agent | {"timestamp":"2020-06-23T12:55:18.326Z","level":"error","message":"Could not cast message to NGSI"}

Could you point me to the right way? What I'm doing wrong?

avbentem commented 4 years ago

See my response in one of the other places you posted this: https://www.thethingsnetwork.org/forum/t/cayennelpp-and-fiware-iot-agent-for-lorawan/38052

jfernandz commented 4 years ago

So ... according to @avbentem is a encoding problem, I must encode my payload using CayenneLPP library instead of arduino-lmic function.

Thank you again @avbentem :+1: