Other question:
every 30 seconds there is a too small packet with 58 bytes.
I need a function to filter this packet from udp in.
Is that possible?
If packet size == 608 bytes then let through e.g.
I rebuilt Steve's speedwiredecoder myself in a very easy way and without generating CPU load.
Question:
Is there a way to change all values of an object like this:
var a = Number (msg.payload.W_bez);
a = a / 3600000;
msg.payload = a;
return msg;
the output are bigint (from counters) in Ws, I need kWh.
somebody showed me a function for rounding:
Object.entries(msg.payload).forEach((v) =>{
msg.payload[v[0]] = Math.round(v[1]);
})
return msg;
maybe like this
This is the new flow with just 2 Buffer Parser:
[
{
"id": "6fa3a49d.1e4bec",
"type": "udp in",
"z": "4726af68.c62a98",
"name": "SMA EM",
"iface": "",
"port": "9522",
"ipv": "udp4",
"multicast": "true",
"group": "239.12.255.254",
"datatype": "buffer",
"x": 200,
"y": 20,
"wires": [
[
"e6588919.6def9",
"72ebe599718bdb9a",
"612794d01b5cb9ad"
]
]
},
{
"id": "72ebe599718bdb9a",
"type": "buffer-parser",
"z": "4726af68.c62a98",
"name": "Messwerte",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "uint32be",
"name": "P_bez",
"offset": 32,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "P_ein",
"offset": 52,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q_ind",
"offset": 72,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q_kap",
"offset": 92,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S_bez",
"offset": 112,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S_ein",
"offset": 132,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "cos_phi",
"offset": 152,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "Hz",
"offset": 160,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "P1_bez",
"offset": 168,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "P1_ein",
"offset": 188,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q1_ind",
"offset": 208,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q1_kap",
"offset": 228,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S1_bez",
"offset": 248,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S1_ein",
"offset": 268,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "I1",
"offset": 288,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "U1",
"offset": 296,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "cos_phi1",
"offset": 304,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "P2_bez",
"offset": 312,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "P2_ein",
"offset": 332,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q2_ind",
"offset": 352,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q2_kap",
"offset": 372,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S2_bez",
"offset": 392,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S2_ein",
"offset": 412,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "I2",
"offset": 432,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "U2",
"offset": 440,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "cos_phi2",
"offset": 448,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "P3_bez",
"offset": 456,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "P3_ein",
"offset": 476,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q3_ind",
"offset": 496,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "Q3_kap",
"offset": 516,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S3_bez",
"offset": 536,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "S3_ein",
"offset": 556,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "uint32be",
"name": "I3",
"offset": 576,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "U3",
"offset": 584,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
},
{
"type": "uint32be",
"name": "cos_phi3",
"offset": 592,
"length": 1,
"offsetbit": 0,
"scale": "0.001",
"mask": ""
}
],
"swap1": "",
"swap2": "",
"swap3": "",
"swap1Type": "swap",
"swap2Type": "swap",
"swap3Type": "swap",
"msgProperty": "payload",
"msgPropertyType": "str",
"resultType": "keyvalue",
"resultTypeType": "output",
"multipleResult": false,
"fanOutMultipleResult": false,
"setTopic": true,
"outputs": 1,
"x": 610,
"y": 740,
"wires": [
[
"6da45803f5650ecc"
]
]
},
{
"id": "612794d01b5cb9ad",
"type": "buffer-parser",
"z": "4726af68.c62a98",
"name": "Zähler",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "biguint64be",
"name": "W_bez",
"offset": 40,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_ein",
"offset": 60,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q_ind",
"offset": 80,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q_kap",
"offset": 100,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S_bez",
"offset": 120,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S_ein",
"offset": 140,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W1_bez",
"offset": 176,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W1_ein",
"offset": 196,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q1_ind",
"offset": 216,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q1_kap",
"offset": 236,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S1_bez",
"offset": 256,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S1_ein",
"offset": 276,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W2_bez",
"offset": 320,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W2_ein",
"offset": 340,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q2_ind",
"offset": 360,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q2_kap",
"offset": 380,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S2_bez",
"offset": 400,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S2_ein",
"offset": 420,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W3_bez",
"offset": 464,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W3_ein",
"offset": 484,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q3_ind",
"offset": 504,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_Q3_kap",
"offset": 524,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S3_bez",
"offset": 544,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "biguint64be",
"name": "W_S3_ein",
"offset": 564,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
}
],
"swap1": "",
"swap2": "",
"swap3": "",
"swap1Type": "swap",
"swap2Type": "swap",
"swap3Type": "swap",
"msgProperty": "payload",
"msgPropertyType": "str",
"resultType": "keyvalue",
"resultTypeType": "output",
"multipleResult": false,
"fanOutMultipleResult": false,
"setTopic": true,
"outputs": 1,
"x": 590,
"y": 800,
"wires": [
[
"6da45803f5650ecc"
]
]
},
{
"id": "6da45803f5650ecc",
"type": "debug",
"z": "4726af68.c62a98",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 760,
"wires": []
}
]
you can try it with:
[83,77,65,0,0,4,2,160,0,0,0,1,2,76,0,16,96,105,1,116,113,89,181,228,114,77,104,54,0,1,4,0,0,0,21,132,0,1,8,0,0,0,0,6,234,67,77,216,0,2,4,0,0,0,0,0,0,2,8,0,0,0,0,14,179,233,174,120,0,3,4,0,0,0,0,0,0,3,8,0,0,0,0,0,19,192,28,136,0,4,4,0,0,0,38,183,0,4,8,0,0,0,0,16,59,174,224,112,0,9,4,0,0,0,44,75,0,9,8,0,0,0,0,13,184,120,144,184,0,10,4,0,0,0,0,0,0,10,8,0,0,0,0,17,122,101,181,224,0,13,4,0,0,0,1,230,0,14,4,0,0,0,195,67,0,21,4,0,0,0,6,61,0,21,8,0,0,0,0,3,244,74,170,184,0,22,4,0,0,0,0,0,0,22,8,0,0,0,0,10,227,85,224,24,0,23,4,0,0,0,0,0,0,23,8,0,0,0,0,0,32,71,176,216,0,24,4,0,0,0,15,118,0,24,8,0,0,0,0,6,33,39,47,40,0,29,4,0,0,0,16,172,0,29,8,0,0,0,0,5,207,168,226,24,0,30,4,0,0,0,0,0,0,30,8,0,0,0,0,11,222,209,21,32,0,31,4,0,0,0,7,179,0,32,4,0,0,3,130,247,0,33,4,0,0,0,1,118,0,41,4,0,0,0,11,250,0,41,8,0,0,0,0,3,2,226,230,184,0,42,4,0,0,0,0,0,0,42,8,0,0,0,0,2,202,42,245,64,0,43,4,0,0,0,0,0,0,43,8,0,0,0,0,0,11,235,1,248,0,44,4,0,0,0,10,198,0,44,8,0,0,0,0,3,17,113,225,152,0,49,4,0,0,0,16,28,0,49,8,0,0,0,0,4,90,175,235,96,0,50,4,0,0,0,0,0,0,50,8,0,0,0,0,2,235,203,92,128,0,51,4,0,0,0,7,117,0,52,4,0,0,3,129,252,0,53,4,0,0,0,2,231,0,61,4,0,0,0,3,77,0,61,8,0,0,0,0,2,46,20,112,240,0,62,4,0,0,0,0,0,0,62,8,0,0,0,0,3,65,103,150,24,0,63,4,0,0,0,0,0]