EV-05: shutdown keeps one command_site_release() call site
checks / unit (pull_request) Successful in 24m44s
infra-pin / fresh (pull_request) Successful in 1s

CI run 1737: test_sma10_two_idle_states counts the call lines of
command_site_release() in main.py (the Stop button and shutdown, 2); the
Solar-first branch had made it 3. Same order as before: in Solar the
charger's 0 A first, in Manual the inverters first.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
ems-agent
2026-11-18 00:29:05 +01:00
co-authored by Claude
parent 29480fda47
commit 8ba3e1c337
+8 -7
View File
@@ -1040,14 +1040,15 @@ class Controller(InputsMixin, WritesMixin, TradeMixin, CycleMixin, AlarmsMixin,
self.stopping = True
_LOG.info(handback.log_shutdown(handback.current())
or "shutting down - commanding 0 W on every inverter")
if self.car_solar_engaged():
# EV-05: Solar's fail state is 0 A, and it goes out BEFORE the
# inverters go to 0 W (bounded by `ctl_car.RELEASE_WAIT_S`).
# EV-05: Solar's fail state is 0 A, and it goes out BEFORE the
# inverters go to 0 W (bounded by `ctl_car.RELEASE_WAIT_S`). Manual
# keeps EV-04's order: the inverters first, then undo a phase change.
solar = self.car_solar_engaged()
if solar:
await self.car_shutdown()
await self.command_site_release()
if not solar:
await self.car_shutdown()
await self.command_site_release()
else:
await self.command_site_release()
await self.car_shutdown() # EV-04: undo a phase change half way
self.mqtt.close()