Sync library with live findings: raw socket docs, wire reply parsing, pack-id BMS, empty-slot guard
This commit is contained in:
1 parent
3d59a75f14
commit
c11188dd0b
6 files changed
+83
-31
No files matched your search
@@ -59,3 +59,17 @@ class TestBmsSoc(unittest.TestCase):
|
||||
data={"id": 2})
|
||||
self.assertEqual(env.to_dict()["dataArea"], {"opt": 0, "id": 2})
|
||||
self.assertEqual(env.cmd_type, 1705)
|
||||
|
||||
def test_empty_pack_slot_skipped(self):
|
||||
from franklinwh_agate_client.battery import _is_empty_pack
|
||||
reply = {"dataArea": {"opt": 0, "result": 0, "id": 0, "batSoc": 0,
|
||||
"batSoh": 0, "batTotalVolt": 0}}
|
||||
self.assertTrue(_is_empty_pack(
|
||||
reply, {"value": 0.0, "source": "batSoc"}))
|
||||
|
||||
def test_genuine_zero_pack_kept(self):
|
||||
from franklinwh_agate_client.battery import _is_empty_pack
|
||||
reply = {"dataArea": {"opt": 0, "result": 0, "id": 1, "batSoc": 0,
|
||||
"batSoh": 96, "batTotalVolt": 512}}
|
||||
self.assertFalse(_is_empty_pack(
|
||||
reply, {"value": 0.0, "source": "batSoc"}))
|
||||
Reference in new issue
Block a user