Skip to content

Commit 29da624

Browse files
authored
Update plugin_solax.py
1 parent 8af718a commit 29da624

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

custom_components/solax_modbus/plugin_solax.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11795,7 +11795,13 @@ def localDataCallback(self, hub: Any) -> bool:
1179511795
)
1179611796
_LOGGER.info(f"Parallel Master: Set {key} limits to ±{system_limit_w}W (inverter_power_kw={hub.inverterPowerKw}kW)")
1179711797

11798-
# For single inverters or if config_max_export is enabled, use config_max_export
11798+
# For single inverters or if config_max_export is enabled, use config_max_export.
11799+
# Parallel Master remote-control limits are handled above using total system power,
11800+
# but export_control_user_limit still needs the configured max export range.
11801+
parallel_master_remotecontrol_keys = {
11802+
"remotecontrol_active_power",
11803+
"remotecontrol_import_limit",
11804+
}
1179911805
config_maxexport_entity = hub.numberEntities.get("config_max_export")
1180011806
if config_maxexport_entity and config_maxexport_entity.enabled:
1180111807
new_max_export = hub.data.get("config_max_export")
@@ -11807,14 +11813,17 @@ def localDataCallback(self, hub: Any) -> bool:
1180711813
"generator_max_charge",
1180811814
]:
1180911815
number_entity = hub.numberEntities.get(key)
11810-
if number_entity and parallel_setting != "Master": # Don't override parallel Master
11811-
number_entity._attr_native_max_value = new_max_export
11812-
# update description also, not sure whether needed or not
11813-
number_entity.entity_description = replace(
11814-
number_entity.entity_description,
11815-
native_max_value=new_max_export,
11816-
)
11817-
_LOGGER.info(f"local data update callback for entity: {key} new limit: {new_max_export}")
11816+
if not number_entity:
11817+
continue
11818+
if parallel_setting == "Master" and key in parallel_master_remotecontrol_keys:
11819+
continue
11820+
number_entity._attr_native_max_value = new_max_export
11821+
# update description also, not sure whether needed or not
11822+
number_entity.entity_description = replace(
11823+
number_entity.entity_description,
11824+
native_max_value=new_max_export,
11825+
)
11826+
_LOGGER.info(f"local data update callback for entity: {key} new limit: {new_max_export}")
1181811827

1181911828
return False
1182011829

0 commit comments

Comments
 (0)