Hi,
I cant seem to find an off the shelf decoding for this module.
Is there a great site that will assist me in making sense of this?
This is the payload:
014901240E700100000000
R718N1 0x49 0x01
Battery(1Byte, unit:0.1V)
Current(2Byte
s,Unit:1ma)
Mulitplier(1Byte),the real
current should convert with
Current* Mulitplier
Reserved(4Bytes,fixed
0x00)
Hi @kingswim, your decoder looks functionally correct to me - but only for routine data uplinks on Fport 6. The current Netvox firmware will also generate system uplinks on Fport 7. As your decoder is, it will process these Fport 7 uplinks and produce nonsense.
Depending on how you want to use the data you might want to round the numbers. I would expect to limit the report on amps to 1 decimal place, battery volts to 1 decimal place and watts to be an integer. You are probably billed by the electric utility in KWH so you might want to report the power usage as KW with 1 or 2 decimal places.
Is there a way to confirm the fport (i’ve hacked this to see its in operating mode)?
And then is there a nice way to combine both of these scripts together into the one Application (I guess I dont need to output the individual rating on each circuit - just report the total Watts/Amps. Im not sure if the total amps = the sum of the circuits - i dont think so but it will do for the moment. (or would it make more sense to report 0 on the ‘missing’ phases on the single phase reader?
Device bytes[1] = 74
function Decoder(bytes, port) {
var WorkingMode = bytes[2];
Hi @kingswim, there are people on this forum who are way better than me for the Javascript decoder but here is roughly how I structure this kind of thing on many different sensor types:
function Decoder(bytes, port) {
if (port === 6 && bytes[1] === 74) {
// do stuff for port 6 and msg type 74
}
else if (port === 6 && bytes[1] === 73) {
// do stuff for port 6 and msg type 73
}
else if (port === 7) {
// do stuff for port 7
}
else {
// do stuff for a port that is not 6 or 7
}
return;
}
I think that serious Java programmers would prefer to use case statements rather than long chains of if, else if, else.
I’m not familiar with the Netvox 3-phase sensor so can’t usefully comment on how to use the individual phase values.