Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwww committed Jan 16, 2025
1 parent fe92fc7 commit 3e74d08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elkm1_lib/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _is_valid_length_and_checksum(msg: str) -> tuple[bool, str]:
if int(msg[:2], 16) != (len(msg) - 2):
return (
False,
f"Incorrect message length, expected {msg[:2]}, got {len(msg)-2:02X}. Msg {msg}", # noqa: E501
f"Incorrect message length, expected {msg[:2]}, got {len(msg) - 2:02X}. Msg {msg}", # noqa: E501
)
checksum = int(msg[-2:], 16)
for char in msg[:-2]:
Expand Down
2 changes: 1 addition & 1 deletion test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def rx_msg(msg_code: str, msg: str, notifier: Notifier, zeros="00"):
Create a Elk received message, pass it to decode, and
invoke the notifiers which will update the base element.
"""
data = f"{len(msg)+len(zeros)+4:02X}{msg_code}{msg}{zeros}"
data = f"{len(msg) + len(zeros) + 4:02X}{msg_code}{msg}{zeros}"
cksum = (256 - reduce(lambda x, y: x + y, map(ord, data))) % 256
decoded = decode(f"{data}{cksum:02X}")
if decoded:
Expand Down

0 comments on commit 3e74d08

Please sign in to comment.