Nke Watteco ModBUS


Does anyone have experience to get that Modbus Bridge running with Chirpstack.


I like to read some given Modbus Register to a influxdb…

Thanks in advance…

No, but thank you for posting the link - very interesting!

1 Like

Me again…

In the meantime, I have had the Watteco Modbus adapter integrated with a commercial provider. He wrote drivers for it, written in Golang,afaik. Who could help to encode the data with the builtin function of Chirpstack?? The provider can only offer its own platform, which I can’t use in the test phase yet.

If I copy the output from Devicedata and paste it here, I already get data. For example, the correct Modbus address is there to see. Output: " EQqABwABQRE3Aw5fQF8AADNxtgsOAKUAIw== "

`{“version”: “NKE_Frame_Codec_v_1.0.svn5087”, “TimeStamp”: “2022-11-22 09:48:53.471599”}
“EndPoint”: 0,
“Report”: “Standard”,
“CommandID”: “ReportAttributes”,
“ClusterID”: “SerialMasterSlave”,
“AttributeID”: “Answer”,
“AttributeType”: “ByteString”,
“Data”: {
“ModBusAnswer”: {
“SlaveID”: 55,
“FcntID”: 3,
“DataSize”: 14,
“Data”: “5f405f00003371b60b0e00a50023”

The content of “Data” at the end is then certainly the data, which is available as a hex value, I assume.

There are a few JavaScript examples on the manufacturer’s website, but none of them work.

How do I get there? Who could help.?

Btw. I’m still using V3, but would go to V4 if the rollout to three datacenter will start…

Thanks in advance


The “5f405f00003371b60b0e00a50023” is the modbus register which depends of your slave. So you need to know the format of registers of your slave to decode this data.

best regards,

Hi Mathieu

Yes, and i know this. And when i put the received payload from Chipstack


to this site


i get that to hex data decoded. But how to do this with a JS decoder?

This is what i’ve written down to do the decoding and calculating by hand…

5f00 5f00 0033 7139 0979 00a3 0031

Reg: Hex: Dez:
1081 5f00 24320 / 1984 = 12,25 Volt
1082 5f00 24320
1083H 0033 51
1083L 7139 28985
1084 0979 2450
1085 00a3 163
1068 0031 49

Hi Rudi,

I think that’s what you’re looking for: Codec-Report-Standard-Javascript/decodeZCL.js at main · Watteco/Codec-Report-Standard-Javascript · GitHub

node decodeZCL.js 125 110a80070001411137030e5f405f00003371b60b0e00a50023

lora: {
port: 125,
payload: ‘110A80070001411137030E5F405F00003371B60B0E00A50023’,
date: ‘2022-12-07T14:51:59.605Z’
zclheader: {
report: ‘standard’,
endpoint: 0,
cmdID: ‘0x0A’,
clusterdID: ‘0x8007’,
attributID: ‘0x0001’
data: {
payload: ‘37030E5F405F00003371B60B0E00A50023’,
modbus_payload: ‘5F405F00003371B60B0E00A50023’,
size: 17,
modbus_float: 0,
modbus_address: 55,
modbus_commandID: 3,
modbus_size: 14

“custom java script field” inside Chirpstack?

Afaik i already have tried this… But gave my only errors…

But yes, i think that files has to be modified. Especialy that part:

			if (  (clusterdID === 0x8007 ) & (attributID === 0x0001)) 
				decoded.data.payload = "";
				decoded.data.modbus_payload = "";
				decoded.data.size = bytes[index]; 
				decoded.data.modbus_float = 0; // 0: pas de décodage float 1: décodage float 2: décodage float 2word inversé
				for( var j = 0; j < decoded.data.size; j++


Hi Rudi,

Here’s what I have with a modified codec into chirpstack V4…


Could you explain that a little more. I currently have a (dockerized) Chipstack V3. Should that make a difference? What decoder did you use?

… same codec unmodified with V3


this is the codec I used for your test: lorawan-devices/modbus-sensor.js at master · TheThingsNetwork/lorawan-devices · GitHub

… this is the result with the modified codec in v3:


WTF, that means, it depends on v3 vs v4. But why should that happen??

On my production v3 i can’t switch to v4 so fast… So much customising with influx, telegraf and so on.

But i could install a new v4 in a vhost and connect my GW to it… Maybe. But to be honest, it would be better to understand, why this happens…

Thanks for your tests and support…

Keep in mind… Main features and changes with 4.0.0

JavaScript codec engine

The JavaScript codec engine is based on QuickJS, which is an embeddable JavaScript engine which supports the ES2020 specification.

1 Like


Have changed to v4. Install on Debian11…

Added one of my gateway and the device. User the codec from here.



You made some mods??

changes to apply at the end of the codec:

//function decodeUplink(input) {
// const decodedInput = {
// data: Decoder(input.bytes, input.fPort),
// warnings: [],
// errors: []
// };
// return decodedInput.data.data
// }

function decodeUplink(input) {
return {
data: {
bytes: Decoder(input.bytes, input.fPort)
warnings: [], // optional
errors: [] // optional (if set, the decoding failed)

Yeah, that’s it. Now the codec is decoding to the hex payload… Thanks for your support.

The next step would be to convert the individual hex bytes to decimal and do the math to have the analog value. Am I right that this is also done in the JS code and do you know a source with an example?

Cheers, Rüdiger

Hi Rudi,

I need more details concerning the slave behind these number:


…also I think this codec make more sense: Codec-Report-Standard-Javascript/decodeZCL.js at main · Watteco/Codec-Report-Standard-Javascript · GitHub

with these modifications:

//var argv= process.argv.slice(2);
//obj = Decoder(Buffer.from(argv[1],‘hex’),parseInt(argv[0], 10 ));

function decodeUplink(input) {
const decodedInput = {
data: Decoder(input.bytes, input.fPort),
warnings: [],
errors: []
return {data: decodedInput.data};


Yes, sorry. I had not finished that listing at that time…

5f00 5f00 0033 7139 0979 00a3 0031
Reg: Hex: Dez:
1081 0x5f00 24320 / 1984 = 12,25 Volt Batt voltage loaded
1082 0x5f00 24320 / 1984 = 12,25 Volt Batt voltage unloaded
1083H 0x00 0 / 15.26 = 0 Ampere Solar panel current
1083L 0x33 51 / 158,39 = 0,32 A. LED current
1084 0x7139 28985 / 4744,35 = 6,10 V. LED voltage
1085 0x0907 2311 / 2949,69 = 0,78 W. Power consumption (w)
1068 0x00a3 (163 / 2) -60 = 21,5 °C Temperature °C
1087 0x0031 Operational state (see table)

Test is running. Have to wait for the next LoRa package…

OK, it is working. Now i would like to understand, how to do the calculation, to have the messurments under “object”



What about something like this