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 = [ 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")