mkjanke / ThornwavePy

Python scripts to read data from Thornwave battery monitor
GNU General Public License v3.0
5 stars 0 forks source link

New Version #1

Open tgalarneau opened 1 year ago

tgalarneau commented 1 year ago

Have been able to get the data for ChargeMeter and PowerMeter. They follow after watts and work with 2 int64 (qq). The problem for me was discovering that if flip sign is set in settings they won't work.

Guess would need to know function Thornwave uses to make the flip happen. But as I use the data for Grafana I make my sign switch in software before sending to database.

mkjanke commented 1 year ago

I updated the script and README.

Perhaps one of the undecoded bytes is used for tracking the sign on the meters?

tgalarneau commented 1 year ago

Problem is I can't decode the int64 if sign flipped.

mkjanke commented 1 year ago

Your are correct - with 'flip sign' enabled, the 'qq' format doesn't work.

Before:
00 08 31 02 23 5f 6c ad 63 01 01 01 25 dc 5a 57 41 8e 3a 57 41 65 be 9c be 88 db 83 c0 d6 ff ff ff ff ff ff ff c0 fd ff ff ff ff ff ff a8 87 88 40 01 01 01 01 00
00 08 31 02 23 af 6d ad 63 01 01 01 25 e0 64 57 41 4c 58 57 41 91 7c d2 be 8f 19 b1 c0 b3 ff ff ff ff ff ff ff f0 fb ff ff ff ff ff ff 83 50 89 40 01 01 01 01 00
00 08 31 02 23 c1 71 ad 63 01 01 01 25 35 a3 57 41 4f 82 57 41 f8 b0 b3 be 2f 5c 97 c0 48 ff ff ff ff ff ff ff 49 f6 ff ff ff ff ff ff c1 6c 90 40 01 01 01 01 00
00 08 31 02 23 bb 78 ad 63 01 01 01 25 40 6b 57 41 17 52 57 41 73 12 d8 be 04 d2 b5 c0 8f fe ff ff ff ff ff ff a5 ec ff ff ff ff ff ff 87 dd 95 40 01 01 01 01 00

After:
00 08 31 02 23 3f 1d b0 63 01 01 01 12 bf 84 57 41 e4 69 57 41 a9 59 bd 3e 7c 68 9f 40 09 01 01 01 01 01 01 02 81 01 01 01 01 01 01 05 e5 3d 75 bf 01 03 fe ff 00
00 08 31 02 23 ec 1e b0 63 01 01 01 12 8d 7d 57 41 2c 5a 57 41 98 e2 b2 3e 09 94 96 40 34 01 01 01 01 01 01 03 bb 02 01 01 01 01 01 05 88 fa 67 bf 01 03 fe ff 00

 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
               |---------|             |---------| |---------| |---------| |---------| |---------------------| |---------------------| |---------|
                Date/Time                  V1          V2        Current      Power        PowerMeter               ChargeMeter          Temp (C)