Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions custom_components/solax_modbus/plugin_solax.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,14 @@ def autorepeat_function_remotecontrol_recompute(initval, descr, datadict):
# Apply bounds checking based on ap_target sign
old_ap_target = ap_target
if ap_target > 0: # Importing (positive = import)
# Inverter input cannot be more than the import limit less any used by the house load
import_bound = import_limit - house_load
ap_target = min(ap_target, import_bound)
_LOGGER.debug(f"[REMOTE_CONTROL] Import bounds: ap_target={ap_target}W import_bound={import_bound}W import_limit={import_limit}W house_load={house_load}W")
elif ap_target < 0: # Exporting (negative = export)
export_bound = -export_limit + house_load
elif ap_target < 0:
# Exporting (negative = export).
# Inverter output cannot be more than the export limit plus any used by the house load
export_bound = -(export_limit + house_load)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this looks correct. I must have missed testing exporting. I will validate this later today.

ap_target = max(ap_target, export_bound)
_LOGGER.debug(f"[REMOTE_CONTROL] Export bounds: ap_target={ap_target}W export_bound={export_bound}W export_limit={export_limit}W house_load={house_load}W")
# If ap_target = 0, no bounds checking needed
Expand Down