feat(energy-control): add solar-based automatic mode switching#5
feat(energy-control): add solar-based automatic mode switching#5deKibi wants to merge 10 commits into
Conversation
|
@codex please review this PR only for critical or harmful issues. Focus on whether:
This is an MVP running in real conditions. Please report only issues that could cause incorrect, unsafe, or damaging behavior. Ignore nice-to-have improvements, broad refactoring, style suggestions, and speculative edge cases. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1214b2782
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex Please review this PR focusing only on critical or high-impact issues in the automatic energy mode switching flow. Verify:
Please report only real correctness, safety, regression, or race-condition risks. Ignore minor style issues, naming preferences, and unrelated refactoring suggestions. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99dffbefb1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ): | ||
| target_mode = AUTO_SWITCH_TARGET_MODE | ||
| switch_reason = "auto-switch target time has been reached" | ||
| switch_rule = SCHEDULED_SWITCH_RULE |
There was a problem hiding this comment.
Block scheduled switchbacks during daylight
When both scheduled and solar switching are enabled, this branch wins before the solar rule and only checks that AUTO_SWITCH_TARGET_TIME has been reached. If that scheduled target is configured before the solar/daylight window ends, an inverter already in solar-priority mode can be commanded back to the scheduled mode while daylight is still active; the switchback should be gated on being outside the daylight window or validated to occur after the window end.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Review Result
I reviewed the follow-up fix at 8960ae442f93893fa0f24ec8ea87bc090478d481 for the scheduled switchback concern.
- The scheduled rule now requires either solar auto-switching to be disabled or the current time to be outside the configured solar window before sending the scheduled target mode. This blocks scheduled switchbacks during
[SOLAR_AUTO_SWITCH_START_TIME, SOLAR_AUTO_SWITCH_END_TIME). energy_mode_control/energy_mode_controller.pyL117-L132 - Grid-outage switching still runs before scheduled and solar rules, preserving the highest-priority outage behavior. energy_mode_control/energy_mode_controller.pyL108-L115
- The added focused tests cover blocking inside the solar window, allowing at the exact end boundary via the window check returning false, and preserving scheduled behavior when solar auto-switching is disabled. tests/control_power_mode/test_energy_mode_controller.pyL144-L197
I did not find a remaining critical or harmful issue in this specific fix, so I made no code changes, did not commit, and did not create a new PR.
Testing
- ✅
pytest tests/control_power_mode/test_energy_mode_controller.py tests/control_power_mode/test_time_utils.py— 30 passed.
|
@codex Please perform a final focused review of the latest PR state. Context:
Please review the complete latest diff and report only critical correctness, In particular, verify:
Ignore minor style, naming, seasonal-window suggestions, unrelated refactoring, |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Adds autonomous inverter mode switching based on time window, grid availability, and recent battery, PV, and load conditions.