milesight-iot / sensordecoders Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://www.milesight-iot.com
License: GNU General Public License v3.0
Home Page: https://www.milesight-iot.com
License: GNU General Public License v3.0
In the documentation of the Milesight V121 the Payload definition says:
FF: firmware_version -> 0xFF 0x0A [4bytes ] Unit:
The channel type 0x0A
is not correct here. The VS121_TTN.js parser uses the channel type 0x1f
to decode the Fireware Version.
I'm located in California, near 38.169N and 122.137W. By convention, southern latitudes and western longitudes are given a negative sign, so this should be:
38.169, -122.137
However, the AT101 payload and decoded value shows 38.169, 122.137.
If I give this string to Google Maps, it shows the correct location in California:
However, the AT101 payload and decoded value shows 38.169, 122.137, which is in the sea between China and Korea:
Perhaps the decoder should multiply the longitude by -1 ?
The UC51x decoder is structured with if {} else if {} else if {} else break. We had a older decoder installed on ChirpStack and did not realize it. Newer UC51x v3 has new data items that the decoder does not recognize, which fall down to the break - meaning a single new data item in a payload stops decoding the remainder of the payload.
Suggest removing the 'else break' and just test for each known data item. Unknown/new data items (like in UC51x v4) should be ignored without terminating decoding.
We are looking for the encoder for the WT201 to write data such as the temperature set point, fan speed and mode. Is there an encoder available Will the encore for the WT30x work?
I am trying to activate WS202 on helium and Datacake integration, but I get integration response error in helium console. I tried both TTN and Chirpstack codes but unfortunately they both give the same error.
Hi there,
I tried to upload the codec from UC_Series/UC50x/UC50x_Decoder.js and it doesn't work instead it logs me out of ChirpStack.
Ended up having to clean the script to allow it to save into ChirpStack v4.
HI, we are integrating this EM300-DI device into Chirpstack 4.8.1, after loading the decode that you have published.
I have a configuration where the totalizer of a water meter is sent every minute.
And I get these error messages randomly due to decoding failure.
Here is an image of a UP that cannot decode
And here is an image of a UP that decodes correctly
I am attaching a more complete log where you can see UP messages correctly decoded and others that are not.
What could be happening?
thanks for your help
As payload for the EM-300-TH sensor I am receiving:
0367AD00046873
Per the decoder in github, the temperature and humidity can be decoded, but it seems that the payloadstring lacks the battery value.
Is the payload format changed with firmware 1.2, so that battery is no longer a part of the payload?
I am trouble pulling the battery level from the device. I used the code as given here but only gets 4 values from the object.
data:"AwEABMgAAAAABQEABsgAAAAA"
objectJASON: 4keys{}
valve1:"off"
valve1_pulse:0
valve2:"off"
valve2_pulse:0
Please assist
We have a thousands of units thats been configured to have an hourly measurement.
But the sensors keeps sending blank payloads 2 times every hour, and the measurement once an hour.
Measurements are sent on Port 85 as described in documentation.
However the blank payloads are sent on application port 0 and is nowhere to be found in documentation.
We are considered that this will cost battery lifetime.
We do not see this type of behavior on other provider of sensors or in EM500.
The Things Stack uses ECMAScript 5 and Template Literal (`) was introduced in ECMAScript 6, as a result this decoder errors out when used with The Things Stack.
https://www.thethingsindustries.com/docs/integrations/payload-formatters/javascript/
The UC511-DI-868M controller sends the battery reading every 6 hours, as an integer value:
"battery":5,"valve1":"off","valve1_pulse":0,"valve2":"off","valve2_pulse":0 - "2022-10-12 14:00:53"
"battery":5,"valve1":"off","valve1_pulse":0,"valve2":"off","valve2_pulse":0 - "2022-10-12 20:20:32"
"battery":5,"valve1":"off","valve1_pulse":0,"valve2":"off","valve2_pulse":0 - "2022-10-13 02:20:32"
"battery":0,"valve1":"on","valve1_pulse":0,"valve2":"off","valve2_pulse":0 - "2022-10-13 08:20:31"
I assumed that the integer is the voltage, however after receiving the 0 value, the controller is still transmitting messages. Can you please share how to translate the battery levels from the integer (0, 5) to either a voltage, or percentage value?
Hi,
Payload definition of TS30x doesn't say that "magnet_chn1_alarm" exists but in the decoder.js it does exist. (line 109)
line 108 data.magnet_chn1 = readInt16LE(bytes.slice(i, i + 2)) === 0 ? "closed" : "opened";
line 109 data.magnet_chn1_alarm = "threshold";
line 110 break;
Is this correct or should this be a different property?
Hi,
In the specification you wrote the following: "If the device fails toget GNSSdata, the latitude or longitude will show FFFFFFFF."
Then how do you encode the negative coorinates (for example any south 0.000001° or west 0.000001° coordinates)?
It seems that the decoder in the following lines simply ignoring these "error" values and generating valid coordinates for the int -1 (FFFFFFFF) values.
SensorDecoders/AT_Series/AT101/AT101_Chirpstack.js
Lines 30 to 37 in 5911981
Or simply do not put any device to that 2 (~20 cm width, ~40.000 km long) circles? :)
Hi
can you please provide a decoder for AM300_Series for the helium console as well? @Milesight-IoT @Ursalink-CN
22fb20cb827a5c40: Little endian (little Endian), 0x405c7a82cb20fb22, the data is of double type, needs to be converted to floating point number, longitude value: 113.9142330000000 (dd.dddd format); (Double type, need change the data to Floating point)
21ea3e00a9953640: Little endian (little Endian), 0x403695a9003eea21, the data is of double type, needs to be converted to floating point number, longitude value: 22.5846100000000 (dd.dddd format); (Double type, need change the data to Floating point)
According to the IEEE 754 standard, a double precision float has the following structure:
1 bit for the sign
11 bits for the exponent
52 bits for the significand (mantissa)
I use this code, but it unable to decoded.
function hexArrayToDouble(hexArray) {
var buffer = new ArrayBuffer(8);
var uint8Array = new Uint8Array(buffer);
for (var i = 0; i < hexArray.length; i++) {
uint8Array[i] = hexArray[i];
}
var dataView = new DataView(buffer);
var doubleValue = dataView.getFloat64(0, false);
return doubleValue;
}
var hexArray = [0x40, 0x5c, 0x7a, 0x82, 0xcb, 0x20, 0xfb, 0x22];
var doubleValue = hexArrayToDouble(hexArray); //113.914233
Occurred Error:
js vm error: ReferenceError: 'ArrayBuffer' is not defined
js vm error: ReferenceError: 'Uint8Array' is not defined
js vm error: ReferenceError: 'DataView' is not defined
Dears
I am trying the decoder function but in response, I am getting below error packet:
Error:”js vm error: ReferenceError: ‘Decode’ is not defined”,
Also I have noted that the sensor is not sending Battery information in the packet.
See the below packet details:
Payload(hex): 0167100102683f
Can you please post the encoder for the WT101 to allow writing of target temperature, control mode and position?
There's no need for two different decoders, especially since this creates the chance of error where the actual payload decoding does not match.
Chirpstack v3 calls this function:
// Decode decodes an array of bytes into an object.
// - fPort contains the LoRaWAN fPort number
// - bytes is an array of bytes, e.g. [225, 230, 255, 0]
// - variables contains the device variables e.g. {"calibration": "3.5"} (both the key / value are of type string)
// The function must return an object, e.g. {"temperature": 22.5}
function Decode(fPort, bytes, variables) {
return {};
}
Chirpstack v4 calls this function:
// Decode uplink function.
//
// Input is an object with the following fields:
// - bytes = Byte array containing the uplink payload, e.g. [255, 230, 255, 0]
// - fPort = Uplink fPort.
// - variables = Object containing the configured device variables.
//
// Output must be an object with the following fields:
// - data = Object representing the decoded payload.
function decodeUplink(input) {
return {
data: {
temp: 22.5
}
};
}
A single decoder file may contain both functions, which call a single actual decoding code.
Thus a single file will serve for both v3 and v4, allowing MileSight to make changes to a single file and users to use a single file, preventing errors.
Hello,
I'm testing the UG56 GW, to get data from em300-DI sensors, with custom decoder (copied from this github repo).
My system/application receive the data through the MQTT interface in the gateway.
the issue is that the received MQTT message is the same as the decoder output which does not include the devEUI.
so my question, is there a way to read/know the devEUI within the decoder, so we can add it to the output message?
Im looking for a decoder for WT201-915 Thermostat. Any chance any of the current WT101 TTN code will work?
Would be possible to add a payload decoder for Actility?
https://resources.lora-alliance.org/document/ts013-1-0-0-payload-codec-api
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.