dragino / dragino-end-node-decoder Goto Github PK
View Code? Open in Web Editor NEWdecoder for dragino end node
decoder for dragino end node
Copy and past the decoder in my chirpstack decoder for two Dragino sensor and I received error messaged.
applicationID:"28"
applicationName:"Dragino_Sensor"
deviceName:"TPM117"
devEUI:"a84041e83188144e"
type:"UPLINK_CODEC"
error:"execute js error: js vm error: (anonymous): Line 105:28 Unexpected token ) (and 238 more errors)"
fCnt:45
On PS LB water level sensor, this formula causes all depts to be a 0 cm.
decode.Water_deep_cm= parseFloat(((decode.IDC_intput_mA-4.0)*(bytes[3]*100/16)).toFixed(3));
bytes[3] alwasy return as 0 and. I think during water level calculation this formula can be static value.
//5000 mm is the max distance the sensor can measure
maxSensorRange = 5000;
//Density of water is 1 ton/m3 (1000 kg/m3)
liquidDensity = 0.997;
//The "Current to Voltage" module can only move between 4mA to 20mA which gives it a resolution of 16mA.
maxSensorResolution = 16;
depthChangeStep = ((maxSensorRange / liquidDensity) / maxSensorResolution);
// dept can be measured as mm sensivity
decode.Water_deep_mm= parseFloat(((decode.IDC_intput_mA-4.0)*(depthChangeStep)).toFixed(3));
What is the expected value for bytes[3] ? Am I rigth to calculate like this _
However it can be fixed by just changing all instances of "port" to "fPort" or vice versa
https://github.com/dragino/dragino-end-node-decoder/blob/main/LHT65N/LHT65N-chirpstack%20decoder.txt
string 76:
var poll_message_status=((bytes[6]>>7)&0x01);
should be shift by 6 not 7 like that:
var poll_message_status=((bytes[6]>>6)&0x01);
Same error in other LHT65N decoders (ttn, etc)
Current decode payloads for Chirpstack only work for v3, changes in Chirpstack v4 cause examples to fail due to new func signature changes referenced here. For example a quick fix to LDS02 was to prepend the following:
function decodeUplink(input) {
var sensor_data = Decode(input.fPort, input.bytes);
return {data: sensor_data};
}
// Existing Chirpstack v3 decoder example below...
function Decode(fPort, bytes) {
...
I think the LDDS75 decoder has been saved to the LDDS45 decoder folder.
Hello,
in the decoder "LHT65N/LHT65N Chirpstack 4.0 decoder.txt" for LHT65N the variable port at le line 100
if((port==3)....
should be if((fPort==3)....
Thanks
Jacques
For decode offline data (PollNoneAck mode), needs extend decoder like that:
https://github.com/dragino/dragino-end-node-decoder/blob/main/LHT65N/LHT65N-chirpstack%20decoder.txt
function decodeUplink(input) {
//LT33222-L or LT22222-L Decode
if(input.fPort==0x02)
{
var hardware= (input.bytes[10] & 0xC0)>>6;
var mode0= input.bytes[10] & 0xff;
var mode= input.bytes[10] & 0x3f;
var decode = {};
if(hardware=='0')
{
decode.Hardware_mode="LT33222";
decode.DO3_status=(input.bytes[8] &0x04)? "L":"H";
if(mode0=='1')
{
decode.DI3_status= (input.bytes[8] &0x20)?"H":"L";
}
}
else if(hardware=='1')
{
decode.Hardware_mode= "LT22222";
}
if(mode!=6)
{
decode.DO1_status= (input.bytes[8] &0x01)? "L":"H";
decode.DO2_status= (input.bytes[8] &0x02)? "L":"H";
decode.RO1_status= (input.bytes[8] &0x80)? "ON":"OFF";
decode.RO2_status= (input.bytes[8] &0x40)? "ON":"OFF";
if(mode!=1)
{
if(mode!=5)
{
decode.Count1_times= (input.bytes[0]<<24 | input.bytes[1]<<16 | input.bytes[2]<<8 | input.bytes[3])>>>0;
}
decode.First_status= (input.bytes[8] &0x20)? "Yes":"No";
}
}
if(mode=='1')
{
decode.Work_mode= "2ACI+2AVI";
decode.AVI1_V= parseFloat(((input.bytes[0]<<24>>16 | input.bytes[1])/1000).toFixed(3));
decode.AVI2_V= parseFloat(((input.bytes[2]<<24>>16 | input.bytes[3])/1000).toFixed(3));
decode.ACI1_mA= parseFloat(((input.bytes[4]<<24>>16 | input.bytes[5])/1000).toFixed(3));
decode.ACI2_mA= parseFloat(((input.bytes[6]<<24>>16 | input.bytes[7])/1000).toFixed(3));
decode.DI1_status= (input.bytes[8] &0x08)? "H":"L";
decode.DI2_status= (input.bytes[8] &0x10)? "H":"L";
}
else if(mode=='2')
{
decode.Work_mode= "Count mode 1";
decode.Count2_times= (input.bytes[4]<<24 | input.bytes[5]<<16 | input.bytes[6]<<8 | input.bytes[7]) >>>0;
}
else if(mode=='3')
{
decode.Work_mode= "2ACI+1Count";
decode.ACI1_mA= parseFloat(((input.bytes[4]<<24>>16 | input.bytes[5])/1000).toFixed(3));
decode.ACI2_mA= parseFloat(((input.bytes[6]<<24>>16 | input.bytes[7])/1000).toFixed(3));
}
else if(mode=='4')
{
decode.Work_mode= "Count mode 2";
decode.Acount_times= (input.bytes[4]<<24 | input.bytes[5]<<16 | input.bytes[6]<<8 | input.bytes[7]) >>>0;
}
else if(mode=='5')
{
decode.Work_mode= " 1ACI+2AVI+1Count";
decode.AVI1_V= parseFloat(((input.bytes[0]<<24>>16 | input.bytes[1])/1000).toFixed(3));
decode.AVI2_V= parseFloat(((input.bytes[2]<<24>>16 | input.bytes[3])/1000).toFixed(3));
decode.ACI1_mA= parseFloat(((input.bytes[4]<<24>>16 | input.bytes[5])/1000).toFixed(3));
decode.Count1_times= bytes[6]<<8 | bytes[7];
}
else if(mode=='6')
{
decode.Work_mode= "Exit mode";
decode.Mode_status= input.bytes[9] ? "True":"False";
decode.AV1L_flag= (input.bytes[0] &0x80)? "True":"False";
decode.AV1H_flag= (input.bytes[0] &0x40)? "True":"False";
decode.AV2L_flag= (input.bytes[0] &0x20)? "True":"False";
decode.AV2H_flag= (input.bytes[0] &0x10)? "True":"False";
decode.AC1L_flag= (input.bytes[0] &0x08)? "True":"False";
decode.AC1H_flag= (input.bytes[0] &0x04)? "True":"False";
decode.AC2L_flag= (input.bytes[0] &0x02)? "True":"False";
decode.AC2H_flag= (input.bytes[0] &0x01)? "True":"False";
decode.AV1L_status= (input.bytes[1] &0x80)? "True":"False";
decode.AV1H_status= (input.bytes[1] &0x40)? "True":"False";
decode.AV2L_status= (input.bytes[1] &0x20)? "True":"False";
decode.AV2H_status= (input.bytes[1] &0x10)? "True":"False";
decode.AC1L_status= (input.bytes[1] &0x08)? "True":"False";
decode.AC1H_status= (input.bytes[1] &0x04)? "True":"False";
decode.AC2L_status= (input.bytes[1] &0x02)? "True":"False";
decode.AC2H_status= (input.bytes[1] &0x01)? "True":"False";
decode.DI2_status= (input.bytes[2] &0x08)? "True":"False";
decode.DI2_flag= (input.bytes[2] &0x04)? "True":"False";
decode.DI1_status= (input.bytes[2] &0x02)? "True":"False";
decode.DI1_flag= (input.bytes[2] &0x01)? "True":"False";
}
if(input.bytes.length!=1)
return {
data: decode
};
}
else if(input.fPort==5)
{
var freq_band;
var sub_band;
if(input.bytes[0]==0x01)
freq_band="EU868";
else if(input.bytes[0]==0x02)
freq_band="US915";
else if(input.bytes[0]==0x03)
freq_band="IN865";
else if(input.bytes[0]==0x04)
freq_band="AU915";
else if(input.bytes[0]==0x05)
freq_band="KZ865";
else if(input.bytes[0]==0x06)
freq_band="RU864";
else if(input.bytes[0]==0x07)
freq_band="AS923";
else if(input.bytes[0]==0x08)
freq_band="AS923_1";
else if(input.bytes[0]==0x09)
freq_band="AS923_2";
else if(input.bytes[0]==0x0A)
freq_band="AS923_3";
else if(input.bytes[0]==0x0F)
freq_band="AS923_4";
else if(input.bytes[0]==0x0B)
freq_band="CN470";
else if(input.bytes[0]==0x0C)
freq_band="EU433";
else if(input.bytes[0]==0x0D)
freq_band="KR920";
else if(input.bytes[0]==0x0E)
freq_band="MA869";
if(input.bytes[1]==0xff)
sub_band="NULL";
else
sub_band=input.bytes[1];
var firm_ver= (input.bytes[2]&0x0f)+'.'+(input.bytes[3]>>4&0x0f)+'.'+(input.bytes[3]&0x0f);
var tdc_time= input.bytes[4]<<16 | input.bytes[5]<<8 | input.bytes[6];
decode.FIRMWARE_VERSION = firm_ver;
decode.FREQUENCY_BAND = freq_band;
decode.SUB_BAND = sub_band;
decode.TDC_sec = tdc_time;
return{
data: decode
};
}
}
Cannnot find decoder for LDS01 Door sensor, is the uplink payload the same for LDS02?
LHT65N Internal (Built-in) Temperature/Humidity Readings Upload to Datacake and post properly, but no data is detected when using the external probe (Sensor reading EXT-TempC_SHT).
External Temp Probe readings do post to
See below:
Could you please check the Dragino End Decoder for Chirpstack V4 to ensure that the External Sensor settings is passed to the decoder?
Thanks\
Valid values for Longitude is +/- 180, Latitude range is +/-90.
The payload decoder delivers a "0" for Longitude and Latitude , when there is no connection with GPS providers.
But: this is a valid location in the near of Libreville (Africa). The decoder has to deliver a value out of range, e.g. 255 for Longitude and 128 for Latitude.
So can detected that the GPS-values are invalid data.
Cannot decode any RSSI, cannot find rssi decode entry in file.
The ltc2 decoding does not work correctly with ltc2-ht when they pass 300, TTN show -200, is this normal?
I am waiting for an answer.
Thanks,
LTC2 v1.0 Decode -TTN.txt
https://github.com/dragino/dragino-end-node-decoder/blob/main/LTC2/LTC2%20v1.0%20Decode%20-TTN.txt
TTN Result:
"decoded_payload": {
"BatV": 3.666,
"Ext": 1,
"Systimestamp": 1669729833,
"Temp_Channel1": -225.07,
"Temp_Channel2": -327.67
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.