Skip to content

Incorrect BATCAP values from serial output #4

@ProtoFoo

Description

@ProtoFoo

I implemented a Python shutdown service based on the example code in this repository. Sometimes a low battery state was reported unexpectedly and the system would shut down.

Because of this, I started logging changes to the BATCAP value. It seems that sometimes wrong values are sent by the UPS. After the dash is the raw serial string from the UPS. The leading value of BATCAP sometimes gets cut off:

[2020-04-29 00:34:04] Battery capacity  82 % - $ SmartUPS V1.00,Vin NG,BATCAP 82,Vout 5136 $
[2020-04-29 00:34:33] Battery capacity  81 % - $ SmartUPS V1.00,Vin NG,BATCAP 81,Vout 5136 $
[2020-04-29 00:34:49] Battery capacity   8 % - $ SmartUPS V1.00,Vin NG,BATCAP 8,Vout 5136 $
[2020-04-29 00:34:50] Battery capacity  81 % - $ SmartUPS V1.00,Vin NG,BATCAP 81,Vout 5136 $
[2020-04-29 00:35:04] Battery capacity  80 % - $ SmartUPS V1.00,Vin NG,BATCAP 80,Vout 5136 $

[2020-04-29 01:07:49] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5146 $
[2020-04-29 02:45:51] Battery capacity  10 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 10,Vout 5144 $
[2020-04-29 02:45:52] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5144 $
[2020-04-29 04:04:52] Battery capacity   0 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 00,Vout 5144 $
[2020-04-29 04:04:53] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5144 $
[2020-04-29 06:59:24] Battery capacity  10 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 10,Vout 5144 $
[2020-04-29 06:59:25] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5144 $
[2020-04-29 10:02:31] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5144 $
[2020-04-29 10:23:57] Battery capacity   0 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 00,Vout 5144 $
[2020-04-29 10:23:58] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5143 $
[2020-04-29 10:36:57] Battery capacity   0 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 00,Vout 5144 $
[2020-04-29 10:36:58] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5144 $
[2020-04-29 15:20:31] Battery capacity  10 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 10,Vout 5144 $
[2020-04-29 15:20:32] Battery capacity 100 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 100,Vout 5144 $
[2020-04-30 15:46:52] Battery capacity  72 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 72,Vout 5138 $
[2020-04-30 15:52:39] Battery capacity   7 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 7,Vout 5138 $
[2020-04-30 15:52:40] Battery capacity  72 % - $ SmartUPS V1.00,Vin GOOD,BATCAP 72,Vout 5138 $

As you can see, in a line like SmartUPS V1.00,Vin GOOD,BATCAP 00,Vout 5144 there is clearly a character cut off from the BATCAP value.

This might be a bug in the firmware on the Nuvoton N76E003 AT20 microcontroller. Can you provide a fixed firmware for flashing or maybe the source code for the board, so I can fix it myself?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions