Skip to content

Commit

Permalink
refactor: Force autodetection for Deye profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Dec 4, 2024
1 parent 78818a0 commit 3a25c36
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/solarman/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def load(self, name, mac, path, file, attr):
self.name = name

try:
if not file or file == DEFAULT_LOOKUP_FILE:
if not file or file == DEFAULT_LOOKUP_FILE or file in AUTODETECTION_REDIRECT_TABLE:
file, attr[ATTR_MPPT], attr[ATTR_PHASE] = lookup_profile(await self.get(requests = [set_request(*AUTODETECTION_REQUEST_DEYE)]), attr[ATTR_MPPT], attr[ATTR_PHASE])
except BaseException as e:
raise UpdateFailed(f"[{self.serial}] Device autodetection failed. [{format_exception(e)}]") from e
Expand Down
1 change: 1 addition & 0 deletions custom_components/solarman/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
DEFAULT_REGISTERS_MAX_SIZE = 125
DEFAULT_DIGITS = 6

AUTODETECTION_REDIRECT_TABLE = ["deye_string.yaml", "deye_hybrid.yaml", "deye_micro.yaml", "deye_4mppt.yaml", "deye_2mppt.yaml", "deye_sg04lp3.yaml", "deye_sg01hp3.yaml"]
AUTODETECTION_CODE_DEYE = 0x03
AUTODETECTION_REQUEST_DEYE = (AUTODETECTION_CODE_DEYE, 0x00, 0x16)
AUTODETECTION_TYPE_DEYE = (AUTODETECTION_CODE_DEYE, 0x00)
Expand Down

0 comments on commit 3a25c36

Please sign in to comment.