Skip to content

Commit

Permalink
fix: Entity descs mod overwritten during autodetection
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Dec 8, 2024
1 parent a690b8f commit edcc91f
Showing 1 changed file with 1 addition and 1 deletion.
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_TYPE_DEYE)):
f, m, c = next(iter([AUTODETECTION_TABLE_DEYE[i] for i in AUTODETECTION_TABLE_DEYE if device_type in i]))
if (v := get_addr_value(response, AUTODETECTION_CODE_DEYE, c)) and (t := (v & 0x0F00) // 0x100) and (p := v & 0x000F):
attr[ATTR_TABLE[CONF_MOD]], attr[ATTR_TABLE[CONF_MPPT]], attr[ATTR_TABLE[CONF_PHASE]] = m, min(t, attr[ATTR_TABLE[CONF_MPPT]]), min(p, attr[ATTR_TABLE[CONF_PHASE]])
attr[ATTR_TABLE[CONF_MOD]], attr[ATTR_TABLE[CONF_MPPT]], attr[ATTR_TABLE[CONF_PHASE]] = max(m, attr[ATTR_TABLE[CONF_MOD]]), min(t, attr[ATTR_TABLE[CONF_MPPT]]), min(p, attr[ATTR_TABLE[CONF_PHASE]])
return f
raise Exception("Unable to read Device Type at Modbus register address: 0x0000")

Expand Down

0 comments on commit edcc91f

Please sign in to comment.