dasdigidings / the_things_stack_v3_tabs_decoder

Decoder in javascript for the family of tabs sensors for the things stack v3
GNU Affero General Public License v3.0
14 stars 8 forks source link

Questions to Browan tabs Water Leak Sensor #4

Closed toki4 closed 3 years ago

toki4 commented 3 years ago

At first thank you for that script. I have a Browan tabs Water Leak Sensor. In the things network I get the following message:

"decoded_payload": {
        "battery": 3.6,
        "bytes": [
          1,
          11,
          56,
          53,
          55
        ],
        "capacity": 0,
        "humidity": 53,
        "humidityError": false,
        "port": 106,
        "temperature": 24,
        "temperatureEnvironment": 23
      }

Now I have some questions to the values. battery: Is the value for voltage. Unit of measurement: V bytes: What are these values? capacity: What is that value? humidity: Is the humidity for the air. Unit of measurement: % humidityError: What is this value? My sensor shows always "false". port: What does this value mean? temperature: Is the temperature for the air. Unit of measurement: °C temperatureEnvironment: What is the difference to temperature? Unit of measurement: °C

What is the value for water leakage?

Thank you in advance for answering the questions.

Drasek commented 3 years ago

Hi toki4,

battery = Voltage from the battery, 3.6V = full for a lithium battery - if it decreases to low (close to 3V) its time to change the battery bytes = the original payload in bytes (can be ignored if the values are plausible, helps to debug) capaticy = should be the value for the leakage sensor, try to test it by placing the sensor in a glas of water and the value should change - i do not own this special sensor so i can not test it. humidity = air humidity (relativ) humidityError = read error from the sensor - good if it is always false ;-) port = port which lorawan used to send the data, think of it like ports from tcp (yeah lorawan is not tcp ip based i know), you handle different hardware/payloads by choosing different ports to send the data, so you can handle the decoding based on the port you receive it from. temperature = temp on the pcb/board temperatureEnviroment = temp in the air

toki4 commented 3 years ago

Thank you for the extensive answer. The "capacity" of my sensor is always 0, regardless of whether the sensor is dipped in to water or not. But the values "bytes" are changing. Does this mean my sensor is out of order or should the script corrected? Is there a difference in content between decodeUplink.js and decodeUplink.min.js?

toki4 commented 3 years ago

I have some more information getting from my salesperson. The payload is "frm_payload": "AQs3MDc=" base64: AQs3MDc= -> HEX: 010b373037

I attach the Reference Manual: RM_Water leak Sensor_20200205_v2.pdf

It seems, that the script has to be changed for correct working for the Water Leak Sensor. Could you please fix it. Thank you very much.

The answer from my salesperson:

Wenn ich mir den Payload gemäß der Doku anschaue, zeigt dieser ein Wasserleck, 
was allerdings schon länger besteht. In Hex-Zahlen hat der Sensor folgenden Payload 
gesendet: 010b373037. Entscheidend für die Leckageerkennung ist das erste Byte 01. 
In der Binären Darstellung ist das 00000001. Gemäß der Doku haben die Bits folgende Bedeutungen:
Sensors status
Bit [0]     1 – Water leakage detected, 0 – Dry
Bits [3:1]  RFU
Bits[4]     1 - Water leakage Interrupt
Bits[5]     1 - Temperature status is changed ( 2℃ delta)
Bits[6]     1 - RH status is changed (5% RH delta)
Bits[7]     RFU
Das Bit[0] ist an dieser Stelle 1, das heißt es ist ein Wasserleck da. Da das Bit[4] jedoch 0 ist das Leck 
vermutlich nicht neu.
Drasek commented 3 years ago

Ok found it!

Thank you for providing the documentation. If you try the newest version you get a status back "waterLeakage" which could be true or false depending on the status bit.

PS: The .min.js is the minified version from the source code, it was of use for a while because TTN allowed only payload decoders under 4k size for a while, but they changed it and you best use the plain text version!

Cheers

Caspar