Well I have done some tests after the changes in the buffernodes and it works very well. I learned awfully lots about Node-RED and Javscript last weeks. Thank you all!
But there is more. One measurement with strange value, I come to that later.
First a little Modbus RTU RS485 documentation of what I did.
Active import
I had a problem with BigInt, ABB resulst in a number (kWh) with 2 decimals but Javascript BigInt64 refuses to accept this, I decided to convert to number format.
Is there a better method?
Edit function Node active use:
// In case of very Big numbers this BigInt64 conversion to Number may be lossy!
// just remove the divide by 100 and drop last 2 digits in BigInt64 number for ActiveImport
ActiveImport = Number(msg.payload[0]) / 100;
msg.payload = [
{
VerbruikKWH: ActiveImport
},
{
MeterId: 'K03-ID3',
Locatie: 'Grnd-Waterpomp Kelder',
Locatiegroep: 'Huis'
},
{ timestamp: Date.now()}
];
return msg;
Results in:
Voltages
Edit function Node
msg.payload = [
{
VoltageL1: msg.payload[0],
VoltageL2: msg.payload[1],
VoltageL3: msg.payload[2],
Frequentie: msg.payload[3]
},
{
MeterId: 'K03-ID3',
Locatie: 'K03',
Locatiegroep: 'Huis'
},
{ timestamp: Date.now()}
];
return msg;
Results in:
Current/Power
msg.payload = [
{
StroomL1: msg.payload[0],
StroomL2: msg.payload[1],
StroomL3: msg.payload[2],
// StroomN: msg.payload[3],
VermogenT: msg.payload[4],
VermogenL1: msg.payload[5],
VermogenL2: msg.payload[6],
VermogenL3: msg.payload[7],
},
{
MeterId: 'K03-ID3',
Locatie: 'K03',
Locatiegroep: 'Huis'
},
{ timestamp: Date.now()}
];
return msg;
results in:
So all seems wel but there is one value which is very unlikely --> StroomN (this means Current) has a value of 42949672.95 Ampere.
Does anyone of you have any idea what is going on here? I better do correct this now.
This is the result of my message object:
{"topic":"K03-ID3","messageId":"amessageid","payload":[{"StroomL1":1.04,"StroomL2":1.05,"StroomL3":1.04,"VermogenT":271.75,"VermogenL1":96.36,"VermogenL2":91.89,"VermogenL3":83.5},{"MeterId":"K03-ID3","Locatie":"K03","Locatiegroep":"Huis"},{"timestamp":1662737950647}],"queueLengthByUnitId":{"unitId":3,"queueLength":0},"queueUnitId":3,"unitId":3,"modbusRequest":{"value":[0,2302,0,2347,0,2296,0,4014,0,4011,0,4002,0,104,0,105,0,104,65535,65535,0,27175,0,9636,0,9189,0,8350,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,5000,32767,32767,32767,32767,32767,32767,32767,65535,65535,65535,32767,32767,32767,375,32767,32767,32767,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],"unitid":3,"fc":3,"address":23296,"quantity":88,"emptyMsgOnFail":true,"keepMsgProperties":false,"messageId":"631b5e1e1093f9c5335c1472"},"responseBuffer":{"data":[0,2302,0,2347,0,2296,0,4014,0,4011,0,4002,0,104,0,105,0,104,65535,65535,0,27175,0,9636,0,9189,0,8350,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,5000,32767,32767,32767,32767,32767,32767,32767,65535,65535,65535,32767,32767,32767,375,32767,32767,32767,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],"buffer":[0,0,8,254,0,0,9,43,0,0,8,248,0,0,15,174,0,0,15,171,0,0,15,162,0,0,0,104,0,0,0,105,0,0,0,104,255,255,255,255,0,0,106,39,0,0,37,164,0,0,35,229,0,0,32,158,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,19,136,127,255,127,255,127,255,127,255,127,255,127,255,127,255,255,255,255,255,255,255,127,255,127,255,127,255,1,119,127,255,127,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]},"_msgid":"e1fae1b7cf82c08c","originalPayload":[0,2302,0,2347,0,2296,0,4014,0,4011,0,4002,0,104,0,105,0,104,65535,65535,0,27175,0,9636,0,9189,0,8350,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,32767,65535,5000,32767,32767,32767,32767,32767,32767,32767,65535,65535,65535,32767,32767,32767,375,32767,32767,32767,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],"specification":{"options":{"byteSwap":[],"resultType":"value","singleResult":true,"msgProperty":"payload","setTopic":true},"items":[{"type":"uint32be","name":"StroomL1","offset":24,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":0,"scaler":{"operator":"/","operand":100},"value":1.04},{"type":"uint32be","name":"StroomL2","offset":28,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":1,"scaler":{"operator":"/","operand":100},"value":1.05},{"type":"uint32be","name":"StroomL3","offset":32,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":2,"scaler":{"operator":"/","operand":100},"value":1.04},{"type":"uint32be","name":"StroomN","offset":36,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":3,"scaler":{"operator":"/","operand":100},"value":42949672.95},{"type":"uint32be","name":"VermogenT","offset":40,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":4,"scaler":{"operator":"/","operand":100},"value":271.75},{"type":"uint32be","name":"VermogenL1","offset":44,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":5,"scaler":{"operator":"/","operand":100},"value":96.36},{"type":"uint32be","name":"VermogenL2","offset":48,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":6,"scaler":{"operator":"/","operand":100},"value":91.89},{"type":"uint32be","name":"VermogenL3","offset":52,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":7,"scaler":{"operator":"/","operand":100},"value":83.5}]},"values":[1.04,1.05,1.04,42949672.95,271.75,96.36,91.89,83.5],"objectResults":{"StroomL1":{"type":"uint32be","name":"StroomL1","offset":24,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":0,"scaler":{"operator":"/","operand":100},"value":1.04},"StroomL2":{"type":"uint32be","name":"StroomL2","offset":28,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":1,"scaler":{"operator":"/","operand":100},"value":1.05},"StroomL3":{"type":"uint32be","name":"StroomL3","offset":32,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":2,"scaler":{"operator":"/","operand":100},"value":1.04},"StroomN":{"type":"uint32be","name":"StroomN","offset":36,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":3,"scaler":{"operator":"/","operand":100},"value":42949672.95},"VermogenT":{"type":"uint32be","name":"VermogenT","offset":40,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":4,"scaler":{"operator":"/","operand":100},"value":271.75},"VermogenL1":{"type":"uint32be","name":"VermogenL1","offset":44,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":5,"scaler":{"operator":"/","operand":100},"value":96.36},"VermogenL2":{"type":"uint32be","name":"VermogenL2","offset":48,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":6,"scaler":{"operator":"/","operand":100},"value":91.89},"VermogenL3":{"type":"uint32be","name":"VermogenL3","offset":52,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":7,"scaler":{"operator":"/","operand":100},"value":83.5}},"keyvalues":{"StroomL1":1.04,"StroomL2":1.05,"StroomL3":1.04,"StroomN":42949672.95,"VermogenT":271.75,"VermogenL1":96.36,"VermogenL2":91.89,"VermogenL3":83.5},"arrayResults":[{"type":"uint32be","name":"StroomL1","offset":24,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":0,"scaler":{"operator":"/","operand":100},"value":1.04},{"type":"uint32be","name":"StroomL2","offset":28,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":1,"scaler":{"operator":"/","operand":100},"value":1.05},{"type":"uint32be","name":"StroomL3","offset":32,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":2,"scaler":{"operator":"/","operand":100},"value":1.04},{"type":"uint32be","name":"StroomN","offset":36,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":3,"scaler":{"operator":"/","operand":100},"value":42949672.95},{"type":"uint32be","name":"VermogenT","offset":40,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":4,"scaler":{"operator":"/","operand":100},"value":271.75},{"type":"uint32be","name":"VermogenL1","offset":44,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":5,"scaler":{"operator":"/","operand":100},"value":96.36},{"type":"uint32be","name":"VermogenL2","offset":48,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":6,"scaler":{"operator":"/","operand":100},"value":91.89},{"type":"uint32be","name":"VermogenL3","offset":52,"length":1,"offsetbit":0,"scale":"/100","mask":"","id":7,"scaler":{"operator":"/","operand":100},"value":83.5}],"buffer":[0,0,8,254,0,0,9,43,0,0,8,248,0,0,15,174,0,0,15,171,0,0,15,162,0,0,0,104,0,0,0,105,0,0,0,104,255,255,255,255,0,0,106,39,0,0,37,164,0,0,35,229,0,0,32,158,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,127,255,255,255,19,136,127,255,127,255,127,255,127,255,127,255,127,255,127,255,255,255,255,255,255,255,127,255,127,255,127,255,1,119,127,255,127,255,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]}