Skip to content

Commit ef14819

Browse files
authored
Merge pull request #2106 from TCWORLD/patch-1
Gracefully handle SolaX remote control unknown mode
2 parents b6fe65e + 900cc95 commit ef14819

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

custom_components/solax_modbus/plugin_solax.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ def autorepeat_function_remotecontrol_recompute(initval: int, descr: Any, datadi
473473
ap_target = 0 - pv_power
474474
power_control = "Enabled Power Control"
475475

476-
elif power_control == "Disabled":
476+
else:
477+
# Otherwise disabled or unknown mode. Mark as disabled.
478+
power_control = "Disabled"
477479
ap_target = target
478480

479481
# Debug logging: Target calculation
@@ -1056,7 +1058,9 @@ def autorepeat_function_powercontrolmode8_recompute(initval: int, descr: Any, da
10561058
elif power_control == "Enabled Grid Control":
10571059
pushmode_power = pushmode_power + houseload - pv
10581060
pvlimit = setpvlimit
1059-
elif power_control == "Disabled":
1061+
else:
1062+
# Otherwise disabled or unknown mode. Mark as disabled.
1063+
power_control = "Disabled"
10601064
pvlimit = setpvlimit
10611065
# limit import to max import (capacity tarif in some countries)
10621066
old_pushmode_power = pushmode_power

0 commit comments

Comments
 (0)