Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
36 changes: 18 additions & 18 deletions src/solmate_optimizer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down