Skip to content

Commit

Permalink
fix: Number of Phases by Rated Phases - Deye Hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Dec 9, 2024
1 parent dc12385 commit 2637e03
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/solarman/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def lookup_profile(response, attr):
if response and (device_type := get_addr_value(response, *AUTODETECTION_DEVICE_DEYE)):
f, m, c = next(iter([AUTODETECTION_DEYE[i] for i in AUTODETECTION_DEYE if device_type in i]))
if (t := get_addr_value(response, *AUTODETECTION_TYPE_DEYE)) and device_type in (0x0003, 0x0300):
attr[ATTR_[CONF_PHASE]] = min(t if t == 1 else 3, attr[ATTR_[CONF_PHASE]])
attr[ATTR_[CONF_PHASE]] = min(1 if t <= 2 or t == 8 else 3, attr[ATTR_[CONF_PHASE]])
if (v := get_addr_value(response, AUTODETECTION_CODE_DEYE, c)) and (t := (v & 0x0F00) // 0x100) and (p := v & 0x000F):
attr[ATTR_[CONF_MOD]], attr[ATTR_[CONF_MPPT]], attr[ATTR_[CONF_PHASE]] = max(m, attr[ATTR_[CONF_MOD]]), min(t, attr[ATTR_[CONF_MPPT]]), min(p, attr[ATTR_[CONF_PHASE]])
return f
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ parameters:
rule: 1
registers: [0x0008]
lookup:
- key: 1
- key: [0, 1, 2]
value: "Single-Phase"
- key: 2
- key: 3
value: "Three-Phase"
- key: 8
value: "Single-Phase Storage"

- name: "Device Chip Type"
attribute:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ parameters:
rule: 1
registers: [0x0008]
lookup:
- key: 1
- key: [0, 1, 2]
value: "Single-Phase"
- key: 2
- key: 3
value: "Three-Phase"
- key: 8
value: "Single-Phase Storage"

- name: "Device Chip Type"
attribute:
Expand Down

0 comments on commit 2637e03

Please sign in to comment.