Skip to content

Commit

Permalink
feat: Add V5_DATA and V5_WIFI handling for server mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Dec 22, 2024
1 parent 8b23962 commit 786d135
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion pysolarmanv5/pysolarmanv5.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,15 @@ def _handle_protocol_frame(self, frame):
self.log.debug("[%s] V5_HANDSHAKE: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_HANDSHAKE RESP: %s", self.serial, response_frame.hex(" "))
if frame.startswith(self.v5_start + b"\x01\x00\x10\x47"):
if frame[4] == 0x42:
self.log.debug("[%s] V5_DATA: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_DATA RESP: %s", self.serial, response_frame.hex(" "))
if frame[4] == 0x43:
self.log.debug("[%s] V5_WIFI: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_WIFI RESP: %s", self.serial, response_frame.hex(" "))
if frame[4] == 0x47:
self.log.debug("[%s] V5_HEARTBEAT: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_HEARTBEAT RESP: %s", self.serial, response_frame.hex(" "))
Expand Down
10 changes: 9 additions & 1 deletion pysolarmanv5/pysolarmanv5_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,15 @@ async def _handle_protocol_frame(self, frame):
self.log.debug("[%s] V5_HANDSHAKE: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_HANDSHAKE RESP: %s", self.serial, response_frame.hex(" "))
if frame.startswith(self.v5_start + b"\x01\x00\x10\x47"):
if frame[4] == 0x42:
self.log.debug("[%s] V5_DATA: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_DATA RESP: %s", self.serial, response_frame.hex(" "))
if frame[4] == 0x43:
self.log.debug("[%s] V5_WIFI: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_WIFI RESP: %s", self.serial, response_frame.hex(" "))
if frame[4] == 0x47:
self.log.debug("[%s] V5_HEARTBEAT: %s", self.serial, frame.hex(" "))
response_frame = self._v5_time_response_frame(frame)
self.log.debug("[%s] V5_HEARTBEAT RESP: %s", self.serial, response_frame.hex(" "))
Expand Down

0 comments on commit 786d135

Please sign in to comment.