Quote from: lox on December 01, 2015, 04:10:38 AM
Hi,
I don't seem to find how to get my battery % (I have a wizbang) from modbus, I can get the load on the battery (negative or positive at address 4371) without an issue, but I don't find the modbus address for battery percentage and remaining Ah.
Anyone ?
Thank you.
Here is a code snip from my android app, the soc is at 4372 and the remaining amps is 4376
if (foundWhizBangJr) {
Register[] registers2 = modbusMaster.readMultipleRegisters(4360, 22);
if (registers2 != null && registers2.length == 22) {
Integer val = ((registers2[5].getValue() << 16) + registers2[4].getValue());
readings.set(RegisterName.PositiveAmpHours, val);
val = (registers2[7].getValue() << 16) + registers2[6].getValue();
readings.set(RegisterName.NegativeAmpHours, Math.abs(val));
val = (registers2[9].getValue() << 16) + registers2[8].getValue();
readings.set(RegisterName.NetAmpHours, val);
readings.set(RegisterName.ShuntTemperature, ((short)registers2[11].getValue() & 0x00ff) -50.0f);
Register a = registers2[10];
readings.set(RegisterName.WhizbangBatCurrent, a.toShort() / 10.0f);
Register soc = registers2[12];
short socVal = soc.toShort();
readings.set(RegisterName.SOC, socVal);
readings.set(RegisterName.RemainingAmpHours, registers2[16].toShort());
readings.set(RegisterName.TotalAmpHours, registers2[20].toShort());
} else {
Log.w(getClass().getName(), String.format("Modbus failed to read 4360 readMultipleRegisters returned null"));
throw new ModbusException("Failed to read data from modbus 4360");
}
}
Graham.
Thanks a lot. Those are undocumented ...
WbJrPercentLeft is 4373
WbJrRemainingAmpHours is 4377
WbJrTotalAmpHours is 4381