Skip to content

Commit

Permalink
Fixes wrong behaviour of CO2Sensor._checksum should ignore byte on po…
Browse files Browse the repository at this point in the history
…sition 0.
  • Loading branch information
fdobrovolny committed Apr 22, 2023
1 parent 8a99ccd commit 09274b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mh_zxx/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _checksum(data: Union[bytes, List[int]]) -> int:
"""
Calculate _checksum of the command.
"""
return 0xFF - (sum(data) % 256) + 1
return 0xFF - (sum(data[1:]) % 256) + 1

def _write_command(self, command: List[int]):
"""
Expand Down

0 comments on commit 09274b2

Please sign in to comment.