Skip to content

Commit

Permalink
fix: Number of MPPTs and Phases for newer firmware versions
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Dec 25, 2024
1 parent 7d6f591 commit f4c1e41
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion custom_components/solarman/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def lookup_profile(response, attr):
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(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):
if (v := get_addr_value(response, AUTODETECTION_CODE_DEYE, c)) and (t := (v & 0x0F00) // 0x100) and (p := v & 0x000F) and (t := 2 if t > 12 else t) and (p := 3 if p > 3 else p):
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
raise Exception("Unable to read Device Type at Modbus register address: 0x0000")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ parameters:
registers: [0x0012]
range:
min: 257
max: 2051
validation:
max: 12
default: 2

- name: "Device Phases"
attribute:
Expand All @@ -137,7 +139,9 @@ parameters:
registers: [0x0012]
range:
min: 257
max: 2051
validation:
max: 3
default: 3

- group: Control
update_interval: 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ parameters:
registers: [0x0012]
range:
min: 257
max: 2051
validation:
max: 12
default: 2

- name: "Device Phases"
attribute:
Expand All @@ -135,7 +137,9 @@ parameters:
registers: [0x0012]
range:
min: 257
max: 2051
validation:
max: 3
default: 3

- group: Control
items:
Expand Down
8 changes: 6 additions & 2 deletions custom_components/solarman/inverter_definitions/deye_p3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ parameters:
registers: [0x0016]
range:
min: 257
max: 2051
validation:
max: 12
default: 2

- name: "Device Phases"
attribute:
Expand All @@ -136,7 +138,9 @@ parameters:
registers: [0x0016]
range:
min: 257
max: 2051
validation:
max: 3
default: 3

- name: Device Self-check
attribute:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ parameters:
registers: [0x0012]
range:
min: 257
max: 2051
validation:
max: 12
default: 2

- name: "Device Phases"
attribute:
Expand All @@ -137,7 +139,9 @@ parameters:
registers: [0x0012]
range:
min: 257
max: 2051
validation:
max: 3
default: 3

- group: Control
items:
Expand Down

0 comments on commit f4c1e41

Please sign in to comment.