Skip to content

Commit

Permalink
Merge branch 'davidrapan:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyUs3r authored Jan 24, 2025
2 parents c60f56d + 704718a commit 30a5af9
Show file tree
Hide file tree
Showing 15 changed files with 3,295 additions and 2,368 deletions.
2 changes: 1 addition & 1 deletion custom_components/solarman/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def modify(source: dict):
if not "platform" in item:
item["platform"] = "sensor" if not "configurable" in item else "number"
item["key"] = entity_key(item)
bulk_inherit(item, group, *(REQUEST_UPDATE_INTERVAL, REQUEST_CODE) if "registers" in item else REQUEST_UPDATE_INTERVAL)
bulk_inherit(item, group, *(REQUEST_UPDATE_INTERVAL, CONF_PACK, REQUEST_CODE, "hidden") if "registers" in item else REQUEST_UPDATE_INTERVAL)
if not REQUEST_CODE in item and (r := item.get("registers")) is not None and (addr := min(r)) is not None:
item[REQUEST_CODE] = table.get(addr, code)
modify(item)
Expand Down
1 change: 1 addition & 0 deletions custom_components/solarman/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
vol.Optional(CONF_MOD, default = DEFAULT_[CONF_MOD], description = {SUGGESTED_VALUE: DEFAULT_[CONF_MOD]}): bool,
vol.Optional(CONF_MPPT, default = DEFAULT_[CONF_MPPT], description = {SUGGESTED_VALUE: DEFAULT_[CONF_MPPT]}): vol.All(vol.Coerce(int), vol.Range(min = 1, max = 12)),
vol.Optional(CONF_PHASE, default = DEFAULT_[CONF_PHASE], description = {SUGGESTED_VALUE: DEFAULT_[CONF_PHASE]}): vol.All(vol.Coerce(int), vol.Range(min = 1, max = 3)),
vol.Optional(CONF_PACK, default = DEFAULT_[CONF_PACK], description = {SUGGESTED_VALUE: DEFAULT_[CONF_PACK]}): vol.All(vol.Coerce(int), vol.Range(min = 0, max = 8)),
vol.Optional(CONF_BATTERY_NOMINAL_VOLTAGE, default = DEFAULT_[CONF_BATTERY_NOMINAL_VOLTAGE], description = {SUGGESTED_VALUE: DEFAULT_[CONF_BATTERY_NOMINAL_VOLTAGE]}): cv.positive_int,
vol.Optional(CONF_BATTERY_LIFE_CYCLE_RATING, default = DEFAULT_[CONF_BATTERY_LIFE_CYCLE_RATING], description = {SUGGESTED_VALUE: DEFAULT_[CONF_BATTERY_LIFE_CYCLE_RATING]}): cv.positive_int,
vol.Optional(CONF_MB_SLAVE_ID, default = DEFAULT_[CONF_MB_SLAVE_ID], description = {SUGGESTED_VALUE: DEFAULT_[CONF_MB_SLAVE_ID]}): cv.positive_int
Expand Down
4 changes: 3 additions & 1 deletion custom_components/solarman/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
CONF_MOD = "mod"
CONF_MPPT = "mppt"
CONF_PHASE = "phase"
CONF_PACK = "pack"
CONF_BATTERY_NOMINAL_VOLTAGE = "battery_nominal_voltage"
CONF_BATTERY_LIFE_CYCLE_RATING = "battery_life_cycle_rating"
CONF_MB_SLAVE_ID = "mb_slave_id"
Expand All @@ -51,6 +52,7 @@
CONF_MOD: False,
CONF_MPPT: 4,
CONF_PHASE: 3,
CONF_PACK: 0,
CONF_BATTERY_NOMINAL_VOLTAGE: 48,
CONF_BATTERY_LIFE_CYCLE_RATING: 6000,
UPDATE_INTERVAL: 60,
Expand All @@ -70,7 +72,7 @@

PROFILE_REDIRECT = { "sofar_hyd3k-6k-es.yaml": "sofar_hyd-es.yaml", "hyd-zss-hp-3k-6k.yaml": "zcs_azzurro-hyd-zss-hp.yaml", "solis_1p8k-5g.yaml": "solis_1p-5g.yaml" }

ATTR_ = { CONF_MOD: CONF_MOD, CONF_MPPT: CONF_MPPT, CONF_PHASE: "l" }
ATTR_ = { CONF_MOD: CONF_MOD, CONF_MPPT: CONF_MPPT, CONF_PHASE: "l", CONF_PACK: CONF_PACK }

AUTO_RECONNECT = True

Expand Down
Loading

0 comments on commit 30a5af9

Please sign in to comment.