You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
inverter.py update_status(): bare raise ValueError surfaces as unhelpful "Error: Exception raised" #4179
Inverter.update_status() raises a bare raise ValueError (no message) when it can't determine the charge window because there's no rate/window source configured. Because the exception carries no context, it bubbles up to the main loop and surfaces to the user as the unhelpful status Error: Exception raised, with a raw traceback in the logs instead of an actionable message.
Where
apps/predbat/inverter.py ~line 1458, in update_status():
ifself.rest_data:
charge_start_time=time_string_to_stamp(self.rest_data["Timeslots"]["Charge_start_time_slot_1"])
charge_end_time=time_string_to_stamp(self.rest_data["Timeslots"]["Charge_end_time_slot_1"])
elif"charge_start_time"inself.base.args:
charge_start_time=time_string_to_stamp(self.base.get_arg("charge_start_time", index=self.id))
charge_end_time=time_string_to_stamp(self.base.get_arg("charge_end_time", index=self.id))
else:
self.log("Error: Inverter {} unable to read charge window time as neither REST, charge_start_time or charge_start_hour are set".format(self.id))
self.base.record_status("Error: Inverter {} unable to read charge window time ...".format(self.id), had_errors=True)
raiseValueError# <-- bare, no message
Why it matters
The status entity ends up as Error: Exception raised (the outer handler's generic message), so users/support can't see why it failed without digging into the pod's traceback.
It's inconsistent with the sibling branch just below (~1460–1466), which handles a missing/None charge window gracefully — logs a Warn, sets safe defaults, and retries next update rather than raising:
ifcharge_start_timeisNoneorcharge_end_timeisNone:
self.log("Warn: Inverter {} unable to read charge window time ... will retry next update")
...
self.charge_enable_time=Falseself.charge_start_time_minutes=self.base.forecast_minutes
...
Observed in production on multiple instances whose upstream inverter integration returned no device/registers (e.g. GivEnergy cloud "no devices", Fox returning no data): the useful Error: Inverter 0 unable to read charge window time ... message is logged, but the subsequent bare ValueError overwrites the user-visible status with Error: Exception raised.
Suggested fix (either)
Raise with the same descriptive message already logged: raise ValueError("Inverter {}: unable to read charge window — neither REST, charge_start_time nor charge_start_hour set".format(self.id)), or
Follow the sibling branch's graceful-recovery pattern (safe defaults + retry next update) so a transient/absent inverter feed doesn't hard-error the whole plan.
Option 1 is minimal; option 2 is more robust for instances where the inverter feed is temporarily empty on a fresh start.
Confirmed still present. Fixed following the issue's suggested "Option 2" (graceful recovery matching the sibling branch, rather than just adding a message to the raise) in #4288 (bundled with a couple of other small fixes - happy to split it out if preferred).
Note: I also tried adding a setup-time warning for "no source configured at all", but reverted it after finding it would produce false positives for Ginlong Solis-type inverters (which use charge_start_hour/charge_start_minute rather than charge_start_time). That's a separate, pre-existing inconsistency worth its own investigation rather than bundling in here.
Activity
fix(inverter): don't crash the whole plan when no charge window sourc…
chalfontchubby commentedon Jul 23, 2026
Confirmed still present. Fixed following the issue's suggested "Option 2" (graceful recovery matching the sibling branch, rather than just adding a message to the raise) in #4288 (bundled with a couple of other small fixes - happy to split it out if preferred).
Note: I also tried adding a setup-time warning for "no source configured at all", but reverted it after finding it would produce false positives for Ginlong Solis-type inverters (which use
charge_start_hour/charge_start_minuterather thancharge_start_time). That's a separate, pre-existing inconsistency worth its own investigation rather than bundling in here.