1515# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
1717__author__ = "Tobias Kraft"
18- __version__ = "1.98 "
18+ __version__ = "1.100 "
1919
2020import time
2121from requests .sessions import Session
@@ -181,7 +181,7 @@ def SetLimitMixedModeWithPriority(pLimit):
181181 SetLimitMixedModeWithPriority .LastLimitAck = True
182182 min_watt_all_inverters = GetMinWattFromAllInverters ()
183183 if (CastToInt (pLimit ) <= min_watt_all_inverters ):
184- pLimit = 0 # set only minWatt for every inv.
184+ pLimit = min_watt_all_inverters # set only minWatt for every inv.
185185 PublishGlobalState ("limit" , min_watt_all_inverters )
186186 else :
187187 PublishGlobalState ("limit" , CastToInt (pLimit ))
@@ -191,7 +191,7 @@ def SetLimitMixedModeWithPriority(pLimit):
191191 if RemainingLimit >= GetMaxInverterWattFromAllNonBatteryInverters ():
192192 nonBatteryInvertersLimit = GetMaxInverterWattFromAllNonBatteryInverters ()
193193 else :
194- nonBatteryInvertersLimit = RemainingLimit
194+ nonBatteryInvertersLimit = RemainingLimit - GetMinWattFromAllBatteryInverters ()
195195
196196 for i in range (INVERTER_COUNT ):
197197 if not AVAILABLE [i ] or HOY_BATTERY_MODE [i ]:
@@ -635,6 +635,14 @@ def GetMinWattFromAllInverters():
635635 minWatt = minWatt + GetMinWatt (i )
636636 return minWatt
637637
638+ def GetMinWattFromAllBatteryInverters ():
639+ minWatt = 0
640+ for i in range (INVERTER_COUNT ):
641+ if (not AVAILABLE [i ]) or (not HOY_BATTERY_MODE [i ]) or (not HOY_BATTERY_GOOD_VOLTAGE [i ]):
642+ continue
643+ minWatt = minWatt + GetMinWatt (i )
644+ return minWatt
645+
638646def GetMixedMode ():
639647 #if battery mode and custom priority use SetLimitWithPriority
640648 for i in range (INVERTER_COUNT ):
@@ -1607,14 +1615,16 @@ def emit(self, record):
16071615try :
16081616 logger .info ("---Init---" )
16091617
1610- newLimitSetpoint = 0
16111618 DTU .CheckMinVersion ()
16121619 if GetHoymilesAvailable ():
16131620 for i in range (INVERTER_COUNT ):
16141621 SetHoymilesPowerStatus (i , True )
1615- SetLimit (GetMinWattFromAllInverters ())
1622+ newLimitSetpoint = GetMinWattFromAllInverters ()
1623+ SetLimit (newLimitSetpoint )
16161624 GetHoymilesActualPower ()
16171625 GetCheckBattery ()
1626+ else :
1627+ newLimitSetpoint = 0
16181628 GetPowermeterWatts ()
16191629except Exception as e :
16201630 if hasattr (e , 'message' ):
0 commit comments