Waziup / WaziGate

Waziup LoRa Edge gateway
21 stars 20 forks source link

XLPP invalid data type: 52 #158

Closed cdupont closed 3 years ago

cdupont commented 3 years ago

Using this code on the WaziDev:

lpp.addString(1, "test");

The data is not received on the gateway. I get this error:

2021-07-12T13:32:19.280673416Z Forwarder AA55A00000000000: LoRa: 868.10 MHz, SF12 BW125 CR4/5, Data: QAAdASYAAAABCV1ZDuiL3vynLeQ=
2021-07-12T13:32:20.669857659Z Received error from [170 85 90 0 38 1 29 0]: invalid data type: 52
2021-07-12T13:32:20.674306182Z DevEUI AA555A0026011D00: AjR0ZXN0AA==
2021-07-12T13:32:20.674493605Z DevEUI AA555A0026011D00 -> Waziup ID 60c770f93dfafc000624cb87
2021-07-12T13:32:20.674657492Z Err The payload was not parsed by Chirpstack
2021-07-12T13:32:37.399287589Z [@] 404, GET /undefined s:19

My device codec is correctly configured: image

Gateway version is 2.1.10.

mojtaba-esk commented 3 years ago

I had faced the exact same error last week. Talked to Johann how to resolve it. It seemed some issues with Redis, but we are not sure about it.

mojtaba-esk commented 3 years ago

For me the forwarder receives the messages, but the messages are not further processed by chirpstack.

cdupont commented 3 years ago

It seems that Chirpstack is stuck with LPP, not XLPP: image

So all XLPP types won't work I suppose. For reference, XLPP types are listed in this doc section: https://github.com/Waziup/xlpp/blob/main/README.md#xlpp-1 LPP types are working (https://github.com/Waziup/xlpp/blob/main/README.md#lpp-types)

cdupont commented 3 years ago

@j-forster any lights on this?

mojtaba-esk commented 3 years ago

@cdupont Did you try if it works with the simple JSON format?

j-forster commented 3 years ago

From this line

2021-07-12T13:32:20.674657492Z Err The payload was not parsed by Chirpstack

I can conclude that the Wazigate-LoRa version you are using is an older version that relies on Chirpstack (with LPP) to parse he payload.

The latest version simply forwards the raw (binary) payload to wazigate edge, internally triggering the device codec (e.g. XLPP) that you set correctly.

Right now I can not find the new Waziga-LoRa code on GitHub - maybe I forgot to push some changes..? I will follow up this message tomorrow.

j-forster commented 3 years ago

The code has been published to https://github.com/Waziup/wazigate-lora/tree/v2-test. It relies on the Wazigate-Edge to support codecs, and ignores the ChirpStack internal codecs.

cdupont commented 3 years ago

Thanks Johann

cdupont commented 3 years ago

For future reference, WaziGate V2.1.10 should be used only with the following LPP functions (no XLPP):

// Original LPPv1 data types
    void addDigitalInput(uint8_t channel, uint8_t value);
    void addDigitalInput(uint8_t value);

    void addDigitalOutput(uint8_t channel, uint8_t value);
    void addDigitalOutput(uint8_t value);

    void addAnalogInput(uint8_t channel, float value);
    void addAnalogInput(float value);

    void addAnalogOutput(uint8_t channel, float value);
    void addAnalogOutput(float value);

    void addLuminosity(uint8_t channel, uint16_t value);
    void addLuminosity(uint16_t value);

    void addPresence(uint8_t channel, uint8_t value);
    void addPresence(uint8_t value);

    void addTemperature(uint8_t channel, float value);
    void addTemperature(float value);

    void addRelativeHumidity(uint8_t channel, float value);
    void addRelativeHumidity(float value);

    void addAccelerometer(uint8_t channel, float x, float y, float z);
    void addAccelerometer(float x, float y, float z);

    void addBarometricPressure(uint8_t channel, float value);
    void addBarometricPressure(float value);

    void addGyrometer(uint8_t channel, float x, float y, float z);
    void addGyrometer(float x, float y, float z);

    void addGPS(uint8_t channel, float latitude, float longitude, float altitude);
    void addGPS(float latitude, float longitude, float altitude);

XLPP fonctions should not be used with this version. For instance, void addVoltage(uint8_t channel, float value); should not be used.

cdupont commented 3 years ago

Thanks Johann We need to write a test case for this... I believe in the integration tests: https://github.com/Waziup/waziup-tests/blob/main/IntegrationTests/integration-tests.py Could you investigate how to write the test? Let's not close before it's properly tested