springfall2008 / batpred

Home battery prediction and charging automation for Home Assistant, supporting many inverter types
https://springfall2008.github.io/batpred/
129 stars 44 forks source link

Exception during HoldCharge events #1618

Closed HeavyPXL closed 1 week ago

HeavyPXL commented 2 weeks ago

Describe the bug

During HoldCharge events I am getting the PredBat Status: Error: Exception raised Inverter.adjust_charge_immediate() got an unexpected keyword argument 'freeze'

This is mostly an annoyance because the inverter stays in Self-use mode ('Idle') which isn't a huge problem because the Fox doesn't support a SOC freeze anyway.

Expected behaviour

Since the Fox does not support Freeze charge mode I'd expect either Status of 'Idle' or possibly a 'Force Charge' until the SOC reaches the level PredBat wants and then 'Idle'

Predbat version Since version 8.5.9 (possibly 8.5.8?)

Rolling back to 8.5.7 eliminates the error.

Environment details Fox H1-5.0-E HOAS / AppDaemon

Log file 2024-11-10 19:40:09.098687 INFO pred_bat: Info: record_status Error: Exception raised Inverter.adjust_charge_immediate() got an unexpected keyword argument 'freeze' 2024-11-10 19:40:09.082460 INFO pred_bat: Error: Traceback (most recent call last): File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 11221, in run_time_loop self.update_pred(scheduled=True) File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 9986, in update_pred status, status_extra = self.execute_plan() ^^^^^^^^^^^^^^^^^^^ File "/homeassistant/appdaemon/apps/batpred/predbat.py", line 8531, in execute_plan inverter.adjust_charge_immediate(self.charge_limit_percent_best[0], freeze=True) TypeError: Inverter.adjust_charge_immediate() got an unexpected keyword argument 'freeze' 2024-11-10 19:40:09.080876 INFO pred_bat: Error: Exception raised Inverter.adjust_charge_immediate() got an unexpected keyword argument 'freeze' 2024-11-10 19:40:09.080107 INFO pred_bat: Hold charging as soc 31% is above target 28% set_discharge_during_charge True

springfall2008 commented 2 weeks ago

I assume you have a bad install and your inverter.py does not match your predbat.py file, not sure how this happens but I'd try updating to the latest release or check inverter.py which should say:

def adjust_charge_immediate(self, target_soc, freeze=False):
    """
    Adjust from charging or not charging based on passed target soc
    """
HeavyPXL commented 1 week ago

I made the move from the AppDaemon install to the PredBat Add-on install and moved my apps.yaml over and everything seems OK so it does seem to have been a corrupt install.

Thanks.