Tekelek TEK766 payload format

At a commercial level, companies can try to offload their support to the reseller - I personally don’t as I try to make my documentation so clear that we get very few support issues and then only deal with the ‘interesting’ issues.

It does seem unusual that there are no documents on their website to help with this.

But they have asked you to go back to the people who sold it to you - what do they say?

Hi Nick.

Thank you for the response.

The company is a distributer, and I bought from Germany, so waiting a response from them. That was a few days ago.

Tekelek only asked who did I buy the product from, and what support agreements do I have with them… to which I replied accordingly. “none” the company is wholesale, much like RS Components or CPC. Interestingly and prior to this, I asked to purchase the devices from the company them selves, to be told no, go through their distributor. The contact given didnt get back to me, so searched and bought elsewhere.

Strange the company dont have any documentation, but I suspect they want people to use them for services and charge for thier time/portal etc, so as to generate income fro doing so.

Cheers

Just a wild idea, if no description is to be found anywhere: any chance it’s sending ASCII text…? (An example payload might easily confirm or confute that.)

It’s not text: https://codereview.stackexchange.com/questions/225928/driver-for-sensor-payload-decoder (not production ready code, I’d say).

I will capture the daya off the payload and see if there is any commonality.

I shall get data and let you see.

Thank you

See https://github.com/faithhunja/Tekelek-Ultrasonic-LoraWAN-Level-Sensor

Strong is your GoogleFu master @arjanvanb!

And taking your cue of using the part number, I found this:

1 Like

Hi, this is the decode i use for the meter. hope it helps.

function Decode(fPort, bytes) {
  if(fPort == 16){
    
    var L1 = 0;
    var L2 = 0;
    var L3 = 0;
    var L4 = 0;
    
    var temp1 = 0;
    var temp2 = 0;
    var temp3 = 0;
    var temp4 = 0;
    
    var TotL =  287+5; //// Total height of the tank cm
    //var TotL =  228+8;
    var TotLL = 83000; //// Total liter of the tank L
    
    var LLeft1 = 0;
    var LLeft2 = 0;
    var LLeft3 = 0;
    var LLeft4 = 0;
    
    L1 = ((bytes[4] * 256) + bytes[5]);
    L2 = ((bytes[8] * 256) + bytes[9]);
    L3 = ((bytes[12] * 256) + bytes[13]);
    L4 = ((bytes[16] * 256) + bytes[17]);
    
    L1 = TotL - L1;
    LLeft1 = (L1/TotL)*100;
    LLeft1 = 100/LLeft1;
    LLeft1 = TotLL/LLeft1;
    LLeft1 = LLeft1.toFixed(2);

    L2 = TotL - L2;
    LLeft2 = (L2/TotL)*100;
    LLeft2 = 100/LLeft2;
    LLeft2 = TotLL/LLeft2;
    LLeft2 = LLeft2.toFixed(2);
    
    L3 = TotL - L3;
    LLeft3 = (L3/TotL)*100;
    LLeft3 = 100/LLeft3;
    LLeft3 = TotLL/LLeft3;
    LLeft3 = LLeft3.toFixed(2);
    
    L4 = TotL - L4;
    LLeft4 = (L4/TotL)*100;
    LLeft4 = 100/LLeft4;
    LLeft4 = TotLL/LLeft4;
    LLeft4 = LLeft4.toFixed(2);
    
    temp1 = bytes[6];
    temp2 = bytes[10];
    temp3 = bytes[14];
    temp4 = bytes[18];
    
    return {L1:L1,L2:L2,L3:L3,L4:L4,T1:LLeft1,T2:LLeft2,T3:LLeft3,T4:LLeft4,Temp1:temp1,Temp2:temp2,Temp3:temp3,Temp4:temp4};
    
  }
  if(fPort == 48){
    
    var Bat = 0;
    
    Bat = bytes[10];
    
    return {Bat:Bat};
    
  }  
  
}
2 Likes

Nice, thanks for sharing!

Just some minor asides:

Note that toFixed returns a string, but you may want a number.

Beware that these do not support negative temperatures. According to some documentation it’s actually a signed integer:

Please share! And what decoder did you end up with?

1 Like

Thanks for the advice, will defn change them to integer :wink:

Do you have any example payloads for different temperatures, especially values of 33°C and above?

The two example values in the documentation (0x1B being 27°C, and 0xF2 being -14°C), happen to be regular signed integers. But the “greater than 32” (rather than 127) in the following surprises me:

Temperature ranges -20°C to +50°C (Variable range -127 → 127)

  • - ([256 or 0] - Byte)
  • If the decimal conversion of the byte is greater than 32 then the number required for the formula is 256 otherwise the number required for the formula is 0.

That makes me wonder how temperatures of 33°C and above would be sent. I don’t think that’s possible at all with this formula?

The decoder that @descartes found also assumes a standard signed integer. (Note that var temp0 = p.readInt8(6) is not supported in the JavaScript version that TTN Payload Formats use.) And another decoder uses the value 50, rather than 32, which probably works as the documented range is -20°C to +50°C. But for a standard signed integer, it should really be 127 (or, when using bitwise operators, if (value & 0x80) ...).

I’d assume that the following should do:

// Sign-extend a single byte to 32 bits to make JavaScript understand
// negative values, by shifting 24 bits to the left, followed by a
// sign-propagating right shift of the same number of bits.
temp1 = bytes[6]<<24>>24;
temp2 = bytes[10]<<24>>24;
temp3 = bytes[14]<<24>>24;
temp4 = bytes[18]<<24>>24;
1 Like

Here is payload data that will definately have temperatures above 33DegC however, the distance will be very small, because its been sitting in a small area in a warm place.

incoming_014.txt (108.5 KB)

Hi,

Thanks for this, I found it really helpful. I am using it in Chirpstack and it seems to be working fine.

I just wanted to ask if this was your final version? Also, why are there 4 level values and 4 temp values?

Apologies if this is covered somewhere, but I am finding it incredibly difficult to find any documentation on this. If anyone can point me in the direction of where I can see it, that would be great.

Keep running into this issue with various manufacturers… Annoying. Decoders should be readily available on their support/website.

At least a description of the payload format with examples.

… And a description which is accurate :frowning:

Hello, I have tried to copy and paste the js script in TTN Payload Converter section, but i t doesn’t work (ReferenceError: module is not defined at :151:1(15)) I have tried to test it with the string “1000000001121B7701131BAA01121BA90114F274”. Someone can help me ? Kind Regards, Marco.

Which script exactly?

None of the ones linked above are v3 ready.

Hi Nick, after some try and errors, I have been able to write a working decoder for the TEK 766 Sensor. Here below the code. With a Input “30000001010836008A00630168060070FFAA” (port:48) the output is :
{
“temperature”: -1,
“ullage”: 112
}

function decodeUplink(input) {
var data = {};
var temp = 0.0;
var offset = 0;
if (input.fPort==16)
{
data.ullage = (input.bytes[4] << 8) + input.bytes[5];
temp=input.bytes[6]
if (temp>50)
{
offset=256;
}
else
{
offset=0;
}
data.temperature = -(offset-temp);
}

if (input.fPort==48)
{
data.ullage = (input.bytes[14] << 8) + input.bytes[15];
temp=input.bytes[16]
if (temp>50)
{
offset=256;
}
else
{
offset=0;
}
data.temperature = -(offset-temp);
}

return {
data: data
};
}

I created an extended version of the payload decoder:

1 Like

Thanks for sharing - I’m sure some users will find of benefit… :slight_smile: