From d7b692eb82b0f4a1701782b14b7a530d076f7589 Mon Sep 17 00:00:00 2001 From: Harald Schilly Date: Thu, 16 Apr 2026 10:34:09 +0200 Subject: [PATCH 1/2] Fix: always activate profile to ensure mode is set to "profile" Previously, when the computed profile hadn't changed, the code returned early and skipped apply_injection_profile(). This meant that if someone manually switched to "static" mode, the optimizer would never switch back to "profile" mode until the next profile change. Now apply_injection_profile() runs on every non-dry-run invocation, ensuring the SolMate is always in profile mode. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/solmate_optimizer/main.py | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/solmate_optimizer/main.py b/src/solmate_optimizer/main.py index c510615..09283d1 100644 --- a/src/solmate_optimizer/main.py +++ b/src/solmate_optimizer/main.py @@ -353,29 +353,29 @@ def optimize(dry_run: bool, no_activate: bool, serial: str, password: str, print("Dry run — no change needed.") return - if not changed: + if changed: + # --- Write updated profile --- + existing_profiles[profile_name] = { + "min": profile.min_val, + "max": profile.max_val, + } + + timestamp = now.strftime(DATETIME_FORMAT_INJECTION_PROFILES) + try: + client.set_injection_profiles(existing_profiles, timestamp) + print(f"UPDATED — profile '{profile_name}' written") + except Exception as e: + print(f"Failed to write profile: {e}", file=sys.stderr) + sys.exit(1) + else: print(f"No change — profile '{profile_name}' is already up to date.") - return - - # --- Write updated profile --- - existing_profiles[profile_name] = { - "min": profile.min_val, - "max": profile.max_val, - } - - timestamp = now.strftime(DATETIME_FORMAT_INJECTION_PROFILES) - try: - client.set_injection_profiles(existing_profiles, timestamp) - print(f"UPDATED — profile '{profile_name}' written") - except Exception as e: - print(f"Failed to write profile: {e}", file=sys.stderr) - sys.exit(1) if no_activate: - print(f"Profile '{profile_name}' written but not activated (--no-activate).") + if changed: + print(f"Profile '{profile_name}' written but not activated (--no-activate).") return - # --- Activate profile --- + # --- Activate profile (always, to ensure mode is set to "profile") --- try: client.apply_injection_profile(profile_name) print(f"Profile '{profile_name}' activated") From dcbf06d8473d9dac620acf1e1bf487becebcd47f Mon Sep 17 00:00:00 2001 From: Harald Schilly Date: Thu, 16 Apr 2026 10:36:40 +0200 Subject: [PATCH 2/2] Release v0.5.0 Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 8 +++++++- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f746cc4..a70f9eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.0] - 2026-04-16 + ### Added - CLI options for all remaining env-only variables: `--serial`, `--password`, `--owm-api-key`, `--location`, `--timezone`, `--profile-name`. +### Fixed +- Always activate the injection profile on every run, even when the profile values haven't changed. Previously, if the SolMate was manually switched to "static" mode, the optimizer would never switch back to "profile" mode until the next profile change. + ## [0.4.0] - 2026-04-13 ### Added @@ -67,7 +72,8 @@ Initial public release. - GitHub Actions release workflow using PyPI trusted publishing (OIDC). - GCP Cloud Run deployment instructions (`DEPLOYMENT.md`). -[Unreleased]: https://github.com/haraldschilly/solmate-optimizer/compare/v0.4.0...HEAD +[Unreleased]: https://github.com/haraldschilly/solmate-optimizer/compare/v0.5.0...HEAD +[0.5.0]: https://github.com/haraldschilly/solmate-optimizer/compare/v0.4.0...v0.5.0 [0.4.0]: https://github.com/haraldschilly/solmate-optimizer/compare/v0.3.0...v0.4.0 [0.3.0]: https://github.com/haraldschilly/solmate-optimizer/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/haraldschilly/solmate-optimizer/compare/v0.1.0...v0.2.0 diff --git a/pyproject.toml b/pyproject.toml index 3bc4126..8f9c189 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "solmate-optimizer" -version = "0.4.0" +version = "0.5.0" description = "Dynamically adjusts EET SolMate injection profile based on hourly electricity price and weather forecast" readme = "README.md" authors = [