Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jblance committed Dec 17, 2022
1 parent 013c2b6 commit 84aeb76
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 5 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test: tests/*.py
coverage html

t: tests/*.py
python3 -m unittest -v
python3 -m unittest

pypi:
rm -rf dist/*
Expand Down
3 changes: 2 additions & 1 deletion mppsolar/protocols/pi30max.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,8 @@ def __init__(self, *args, **kwargs) -> None:
self.COMMANDS.update(SETTER_COMMANDS)
# remove and unwanted pi30 commands
for item in COMMANDS_TO_REMOVE:
self.COMMANDS.pop(item)
if item in self.COMMANDS:
self.COMMANDS.pop(item)
self.STATUS_COMMANDS = ["QPIGS", "QPIGS2"]
self.SETTINGS_COMMANDS = ["QPIRI", "QFLAG"]
self.DEFAULT_COMMAND = "QPI"
Expand Down
2 changes: 1 addition & 1 deletion mppsolar/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.14.9"
__version__ = "0.14.10"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mppsolar"
version = "0.14.9"
version = "0.14.10"
description = "Package to communicate with Solar inverters and BMSs"
authors = ["John Blance"]

Expand Down
57 changes: 56 additions & 1 deletion tests/test_protocol_pi18sv.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def test_pi18sv_PI(self):
}
result = protocol.decode(response, command)
# print(result)

self.assertEqual(result, expected)


Expand Down Expand Up @@ -48,3 +47,59 @@ def test_pi18_fullcommand_ET(self):
expected = b"^P005ET\r"
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_EY(self):
"""test the build of full command EY"""
protocol = pi()
result = protocol.get_full_command("EY2023")
expected = b"^P009EY2023\r"
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_EM(self):
"""test the build of full command EM"""
protocol = pi()
result = protocol.get_full_command("EM202312")
expected = b"^P011EM202312\r"
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_ED(self):
"""test the build of full command ED"""
protocol = pi()
result = protocol.get_full_command("ED20231217")
expected = b"^P013ED20231217\xba\xd2\r"
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_ID(self):
"""test the build of full command ID"""
protocol = pi()
result = protocol.get_full_command("ID")
expected = b"^P005ID\r"
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_VFW(self):
"""test the build of full command VFW"""
protocol = pi()
result = protocol.get_full_command("VFW")
expected = b"^P006VFW\xf6\xe6\r"
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_MCHGCR(self):
"""test the build of full command MCHGCR"""
protocol = pi()
result = protocol.get_full_command("MCHGCR")
expected = b'^P009MCHGCR\xee"\r'
# print(result)
self.assertEqual(result, expected)

def test_pi18_fullcommand_MUCHGCR(self):
"""test the build of full command MUCHGCR"""
protocol = pi()
result = protocol.get_full_command("MUCHGCR")
expected = b"^P010MUCHGCR\xb5\x8b\r"
# print(result)
self.assertEqual(result, expected)

0 comments on commit 84aeb76

Please sign in to comment.