Skip to content

Commit

Permalink
fix: Detection of Ethernet Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Feb 9, 2025
1 parent 02d7a4f commit c1185ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion custom_components/solarman/pysolarman/pysolarman.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _time_response_frame(self, frame: bytes) -> bytearray:
return response_frame + self._protocol_trailer(response_frame)

def _received_frame_is_valid(self, frame: bytes) -> bool:
if not frame.startswith(PROTOCOL.START) or not frame.endswith(PROTOCOL.END):
if not frame.startswith(PROTOCOL.START):
_LOGGER.debug("[%s] PROTOCOL_MISMATCH: %s", self.serial, frame.hex(" "))
return False
if frame[5] != self.sequence_number:
Expand All @@ -123,6 +123,9 @@ def _received_frame_is_valid(self, frame: bytes) -> bool:
return True
_LOGGER.debug("[%s] SEQ_NO_MISMATCH: %s", self.serial, frame.hex(" "))
return False
if not frame.endswith(PROTOCOL.END):
_LOGGER.debug("[%s] PROTOCOL_MISMATCH: %s", self.serial, frame.hex(" "))
return False
return True

def _received_frame_response(self, frame: bytes) -> tuple[bool, bytearray]:
Expand Down

0 comments on commit c1185ed

Please sign in to comment.