From 2ac4095aa6abc0e3d942fa3827b8ad811e826d79 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 22:33:23 +0000 Subject: [PATCH 1/3] Restructure CHANGELOG Next section as Keep-a-Changelog diff to main Regrouped the flat bullet list into Breaking / Added / Changed / Fixed subsections so readers can scan by change type. Each bullet is now a standalone diff to main (no cross-references) and cites every PR that contributed. Added Breaking entries that were missing: - CT002/CT003 ACTIVE_CONTROL default (smoothing + 15 W BALANCE_DEADBAND + saturation detection on by default) - WAIT_FOR_NEXT_MESSAGE default True (affects Shelly emulation too, not just CT002/CT003) - Async Powermeter base (out-of-tree subclasses must implement async get_powermeter_watts()) Added missing feature bullets: per-powermeter EMA smoothing/deadband wrappers (#331), Hampel outlier filter (#334), MQTT BROKER_URI (#309), exc_info on warnings (#307). Filled in previously-missing PR refs on the rebrand, CT002/CT003, MQTT Insights, web config editor, PID controller, and GIT_COMMIT_SHA bullets. https://claude.ai/code/session_01BCVmemteVXNfoTQE4De2CU --- CHANGELOG.md | 68 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 511aeef7..1eb02a4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,51 @@ # Changelog ## Next -- Added optional Hampel outlier filter (`HAMPEL_WINDOW`, `HAMPEL_N_SIGMA`, `HAMPEL_MIN_THRESHOLD`) for rejecting wild samples from noisy powermeter sources (MQTT/HTTP/WiFi); configurable globally or per powermeter section, disabled by default -- Added `DEDUPE_TIME_WINDOW` support to the Shelly emulator to drop burst-repeat requests from the same battery IP; the value can be set under `[GENERAL]` to apply regardless of which device type is emulated -- Added opt-in web-based configuration editor (`WEB_CONFIG_ENABLED = True` in `[GENERAL]`) accessible at `http://:52500/config`; supports editing all config sections and keys with type-appropriate inputs, comment preservation, and a Save & Restart button -- **Breaking:** Rebrand project from "B2500 Meter" to "AstraMeter" (formerly b2500-meter). Package renamed to `astrameter`, CLI commands are now `astrameter` and `astra-sim`. Docker image moved from `ghcr.io/tomquist/b2500-meter` to `ghcr.io/tomquist/astrameter` (the legacy `ghcr.io/tomquist/b2500-meter` image is still published in parallel for backward compatibility). Home Assistant users must update their app repository URL to `https://github.com/tomquist/astrameter#main`. -- Added CT002/CT003 emulation for steering multiple Marstek storage devices over the Marstek CT UDP protocol, with opt-in efficiency optimization that concentrates power on fewer batteries at low demand and rotates fairly over time (`MIN_EFFICIENT_POWER`, `EFFICIENCY_ROTATION_INTERVAL`, and related tuning options) -- Added MQTT Insights: optional `[MQTT_INSIGHTS]` section publishes internal state (grid power, targets, saturation, consumer topology) to MQTT with Home Assistant Device Discovery, per-consumer active/pause control, manual target override, and Shelly battery offline availability; auto-configured in the HA app when Mosquitto is installed -- Added HomeWizard P1 powermeter support via the device WebSocket API with optional `VERIFY_SSL` ([#231](https://github.com/tomquist/astrameter/pull/231), [#254](https://github.com/tomquist/astrameter/pull/254)) -- Added SMA Energy Meter / Sunny Home Manager support via Speedwire multicast with auto-detection and per-phase readings ([#252](https://github.com/tomquist/astrameter/pull/252)) -- Added SML powermeter support for smart meters over a local serial port (IR head), with optional per-phase OBIS overrides ([#229](https://github.com/tomquist/astrameter/pull/229)) -- Added multi-phase support for Tasmota (`JSON_POWER_MQTT_LABEL`) and MQTT (`TOPICS` / `JSON_PATHS`) powermeters ([#136](https://github.com/tomquist/astrameter/issues/136), [#280](https://github.com/tomquist/astrameter/pull/280)) -- Added multi-phase support for the VZLogger powermeter via comma-separated `UUID` values; phases are fetched in parallel ([#332](https://github.com/tomquist/astrameter/pull/332)) -- Added PID controller support for any powermeter via `PID_KP`, `PID_KI`, `PID_KD`, `PID_OUTPUT_MAX`, and `PID_MODE` config options (global or per-section), with built-in anti-windup -- Added `POWER_OFFSET` and `POWER_MULTIPLIER` transforms for any powermeter, including per-phase calibration, sign flipping, and phase nulling ([#250](https://github.com/tomquist/astrameter/pull/250)); the Home Assistant app exposes both as optional advanced fields -- Added optional Marstek cloud auto-registration for managed fake CT devices at startup ([#237](https://github.com/tomquist/astrameter/pull/237)) -- Switched the Home Assistant powermeter integration from REST polling to the WebSocket API ([#232](https://github.com/tomquist/astrameter/pull/232)) -- Added `LOG_LEVEL` environment variable support for Docker and CLI runs ([#174](https://github.com/tomquist/astrameter/pull/174)) -- Added timestamps to application log lines ([#260](https://github.com/tomquist/astrameter/pull/260)) -- CI-built container images embed `GIT_COMMIT_SHA`; startup logs the git commit and `/health` JSON includes `git_commit` when set -- Fixed Modbus `UNIT_ID` handling and clarified Home Assistant entity ID configuration in the docs ([#191](https://github.com/tomquist/astrameter/pull/191), [#195](https://github.com/tomquist/astrameter/pull/195)) -- Added battery activity info logs for Shelly emulation to report detection, inactivity, and reconnection events ([#241](https://github.com/tomquist/astrameter/pull/241)) -- Reduced throttling output noise by replacing unconditional `print` calls in `ThrottledPowermeter` with structured logging (`logger.debug` for routine wait/fetch/cache messages; failures remain at error level) ([#251](https://github.com/tomquist/astrameter/pull/251)) -- Improved Shelly UDP server robustness by adding socket timeouts to avoid hangs during shutdown and testing ([#233](https://github.com/tomquist/astrameter/pull/233)) ### Breaking -- The Home Assistant app no longer publishes images for 32-bit ARM (`armhf` / `armv7`). Installations must use a 64-bit Home Assistant OS or supervisor environment (`amd64` or `aarch64`), consistent with Home Assistant dropping 32-bit support. -- **CT001 emulation removed** (Python `ct001` package and the `nodered.json` flow). Use `ct002` or `ct003` for multiple storage devices; use a Shelly `DEVICE_TYPE` otherwise (replacing `ct001`). Drop obsolete `[GENERAL]` options `DISABLE_SUM_PHASES`, `DISABLE_ABSOLUTE_VALUES`, and `POLL_INTERVAL` if present. The Home Assistant app no longer offers `poll_interval` or `disable_absolute_values`; remove those keys from saved app configuration if validation fails after upgrade ([#258](https://github.com/tomquist/astrameter/pull/258)). -- **From-source / contributor workflow:** Pipenv, `Pipfile`, and running `python main.py` from the repo root are removed—use **uv** and the **`astrameter`** command (or `uv run astrameter`) per [CONTRIBUTING.md](CONTRIBUTING.md). +- **Rebranded** project from "B2500 Meter" to "AstraMeter" (formerly b2500-meter). Package renamed to `astrameter`, CLI commands are now `astrameter` and `astra-sim`. Docker image moved from `ghcr.io/tomquist/b2500-meter` to `ghcr.io/tomquist/astrameter` (the legacy `ghcr.io/tomquist/b2500-meter` image is still published in parallel for backward compatibility). Home Assistant users must update their app repository URL to `https://github.com/tomquist/astrameter#main` ([#302](https://github.com/tomquist/astrameter/pull/302), [#304](https://github.com/tomquist/astrameter/pull/304)). +- **Removed CT001 emulation** (Python `ct001` package and the `nodered.json` flow). Use `ct002`/`ct003` for multiple storage devices, or a Shelly `DEVICE_TYPE` otherwise. Drop obsolete `[GENERAL]` options `DISABLE_SUM_PHASES`, `DISABLE_ABSOLUTE_VALUES`, and `POLL_INTERVAL` if present. The Home Assistant app no longer offers `poll_interval` or `disable_absolute_values`; remove those keys from saved app configuration if validation fails after upgrade ([#258](https://github.com/tomquist/astrameter/pull/258)). +- **Changed default:** CT002/CT003 `ACTIVE_CONTROL` is on by default. When emulating CT002/CT003 the emulator now smooths the grid reading, splits the target across batteries with a built-in 15 W `BALANCE_DEADBAND`, and runs saturation detection. Set `ACTIVE_CONTROL = False` under `[CT002]` / `[CT003]` for relay mode (raw meter values forwarded, batteries decide); tunables `BALANCE_DEADBAND`, `FAIR_DISTRIBUTION`, `BALANCE_GAIN`, `SATURATION_DETECTION` ([#283](https://github.com/tomquist/astrameter/pull/283), [#296](https://github.com/tomquist/astrameter/pull/296)). +- **Changed default:** `WAIT_FOR_NEXT_MESSAGE` defaults to `True`. Every emulator response (CT002/CT003 **and** Shelly) now waits up to 2 s for a fresh push sample from event-driven meters (MQTT, SMA Speedwire, HomeWizard WS, HA WS) before replying, then falls back to the cached value on timeout. Set `WAIT_FOR_NEXT_MESSAGE = False` under `[GENERAL]` or a powermeter section to disable ([#322](https://github.com/tomquist/astrameter/pull/322), [#330](https://github.com/tomquist/astrameter/pull/330)). +- **Changed API:** the `Powermeter` base class is now async. Out-of-tree powermeter subclasses must implement `async get_powermeter_watts()`; the synchronous legacy interface has been removed ([#273](https://github.com/tomquist/astrameter/pull/273), [#274](https://github.com/tomquist/astrameter/pull/274), [#275](https://github.com/tomquist/astrameter/pull/275), [#276](https://github.com/tomquist/astrameter/pull/276), [#277](https://github.com/tomquist/astrameter/pull/277), [#278](https://github.com/tomquist/astrameter/pull/278), [#279](https://github.com/tomquist/astrameter/pull/279), [#282](https://github.com/tomquist/astrameter/pull/282)). +- **Removed** 32-bit ARM (`armhf` / `armv7`) Home Assistant images. Installations must use a 64-bit Home Assistant OS or supervisor environment (`amd64` or `aarch64`), consistent with Home Assistant dropping 32-bit support. +- **Removed** from-source / contributor workflow: Pipenv, `Pipfile`, and running `python main.py` from the repo root are gone — use **uv** and the **`astrameter`** command (or `uv run astrameter`) per [CONTRIBUTING.md](CONTRIBUTING.md). + +### Added +- **Added** CT002/CT003 emulation for steering multiple Marstek storage devices over the Marstek CT UDP protocol — fair-share load balancing, saturation-aware handoff, manual target override and forced rotation via MQTT, ARP-based consumer discovery, and an opt-in efficiency mode that concentrates power on fewer batteries at low demand (`MIN_EFFICIENT_POWER`, `EFFICIENCY_ROTATION_INTERVAL`, probe-based fades, `SATURATION_GRACE_SECONDS`) ([#283](https://github.com/tomquist/astrameter/pull/283), [#284](https://github.com/tomquist/astrameter/pull/284), [#287](https://github.com/tomquist/astrameter/pull/287), [#289](https://github.com/tomquist/astrameter/pull/289), [#294](https://github.com/tomquist/astrameter/pull/294), [#296](https://github.com/tomquist/astrameter/pull/296), [#298](https://github.com/tomquist/astrameter/pull/298), [#303](https://github.com/tomquist/astrameter/pull/303), [#310](https://github.com/tomquist/astrameter/pull/310), [#311](https://github.com/tomquist/astrameter/pull/311)). +- **Added** MQTT Insights: optional `[MQTT_INSIGHTS]` section publishes internal state (grid power, targets, saturation, consumer topology, EMA poll interval) to MQTT with Home Assistant Device Discovery; per-consumer active/pause + manual target control; Shelly battery offline availability; auto-configured in the HA app when Mosquitto is installed ([#292](https://github.com/tomquist/astrameter/pull/292), [#294](https://github.com/tomquist/astrameter/pull/294), [#297](https://github.com/tomquist/astrameter/pull/297)). +- **Added** opt-in web-based configuration editor (`WEB_CONFIG_ENABLED = True` in `[GENERAL]`) accessible at `http://:52500/config`; supports editing all config sections and keys with type-appropriate inputs, comment preservation, and a Save & Restart button ([#319](https://github.com/tomquist/astrameter/pull/319)). +- **Added** HomeWizard P1 powermeter via the device WebSocket API, with optional `VERIFY_SSL` ([#231](https://github.com/tomquist/astrameter/pull/231), [#254](https://github.com/tomquist/astrameter/pull/254)). +- **Added** SMA Energy Meter / Sunny Home Manager support via Speedwire multicast with device auto-detection and per-phase readings ([#252](https://github.com/tomquist/astrameter/pull/252)). +- **Added** SML powermeter for smart meters over a local serial port (IR head), with optional per-phase OBIS overrides ([#229](https://github.com/tomquist/astrameter/pull/229)). +- **Added** multi-phase support to the MQTT powermeter via `TOPICS` / `JSON_PATHS` ([#280](https://github.com/tomquist/astrameter/pull/280), [issue #136](https://github.com/tomquist/b2500-meter/issues/136)). +- **Added** multi-phase support to the Tasmota powermeter via comma-separated `JSON_POWER_MQTT_LABEL` ([#281](https://github.com/tomquist/astrameter/pull/281)). +- **Added** multi-phase support to the VZLogger powermeter via comma-separated `UUID` values; phases are fetched in parallel ([#332](https://github.com/tomquist/astrameter/pull/332)). +- **Added** PID controller support for any powermeter via `PID_KP`, `PID_KI`, `PID_KD`, `PID_OUTPUT_MAX`, and `PID_MODE` (global or per-section), with built-in anti-windup ([#315](https://github.com/tomquist/astrameter/pull/315)). +- **Added** per-powermeter EMA smoothing and deadband wrappers — `SMOOTH_TARGET_ALPHA`, `MAX_SMOOTH_STEP`, `DEADBAND` (global `[GENERAL]` fallback with per-section override; off by default) ([#331](https://github.com/tomquist/astrameter/pull/331)). +- **Added** optional Hampel outlier filter for noisy powermeter sources (MQTT / HTTP / WiFi glitches): `HAMPEL_WINDOW`, `HAMPEL_N_SIGMA`, `HAMPEL_MIN_THRESHOLD` (global `[GENERAL]` fallback with per-section override; off by default; sits in the wrapper chain after throttling and before EMA smoothing) ([#334](https://github.com/tomquist/astrameter/pull/334)). +- **Added** `POWER_OFFSET` and `POWER_MULTIPLIER` transforms for any powermeter, including per-phase calibration, sign flipping, and phase nulling; the Home Assistant app exposes both as optional advanced fields ([#250](https://github.com/tomquist/astrameter/pull/250), [#308](https://github.com/tomquist/astrameter/pull/308)). +- **Added** `DEDUPE_TIME_WINDOW` to the Shelly emulator to drop burst-repeat requests from the same battery IP; the value can also be set under `[GENERAL]` to apply regardless of which device type is emulated ([#333](https://github.com/tomquist/astrameter/pull/333)). +- **Added** MQTT broker configuration via a single `BROKER_URI` (auth and TLS schemes) alongside the existing host/port/user/pass keys ([#309](https://github.com/tomquist/astrameter/pull/309)). +- **Added** optional Marstek cloud auto-registration for managed fake CT devices at startup under `[MARSTEK]` ([#237](https://github.com/tomquist/astrameter/pull/237)). +- **Added** `LOG_LEVEL` environment variable support for Docker and CLI runs ([#174](https://github.com/tomquist/astrameter/pull/174)). +- **Added** timestamps to application log lines ([#260](https://github.com/tomquist/astrameter/pull/260)). +- **Added** `GIT_COMMIT_SHA` embedding in CI-built container images; startup logs the git commit and `/health` JSON includes `git_commit` when set ([#273](https://github.com/tomquist/astrameter/pull/273)). +- **Added** `exc_info` to logger warnings for better debugging ([#307](https://github.com/tomquist/astrameter/pull/307)). + +### Changed +- **Switched** the Home Assistant powermeter integration from REST polling to the WebSocket API ([#232](https://github.com/tomquist/astrameter/pull/232)). +- **Updated** the CT002/CT003 saturation EMA to be time-weighted for sample-rate invariance — slow meters no longer accumulate saturation faster per sample ([#321](https://github.com/tomquist/astrameter/pull/321)). +- **Added** battery activity info logs for Shelly emulation to report detection, inactivity, and reconnection events ([#241](https://github.com/tomquist/astrameter/pull/241)). +- **Reduced** throttling output noise by replacing unconditional `print` calls in `ThrottledPowermeter` with structured logging (`logger.debug` for routine wait/fetch/cache messages; failures remain at error level) ([#251](https://github.com/tomquist/astrameter/pull/251)). +- **Improved** Shelly UDP server robustness by adding socket timeouts to avoid hangs during shutdown and testing ([#233](https://github.com/tomquist/astrameter/pull/233)). + +### Fixed +- **Fixed** Modbus `UNIT_ID` handling and clarified Home Assistant entity ID configuration in the docs ([#191](https://github.com/tomquist/astrameter/pull/191), [#195](https://github.com/tomquist/astrameter/pull/195)). +- **Fixed** MQTT service availability check in the Home Assistant addon ([#306](https://github.com/tomquist/astrameter/pull/306)). +- **Fixed** CT002 efficiency-rotation lockup when a push-based powermeter goes silent ([#320](https://github.com/tomquist/astrameter/pull/320)). +- **Fixed** crash when the `[MQTT_INSIGHTS]` section has empty config values ([#300](https://github.com/tomquist/astrameter/pull/300)). +- **Fixed** false saturation detection during load-sign reversal and battery ramp-down, and false saturation swaps under fluctuating household load ([#291](https://github.com/tomquist/astrameter/pull/291), [#293](https://github.com/tomquist/astrameter/pull/293), [#301](https://github.com/tomquist/astrameter/pull/301)). ## 1.0.8 - Added support for Modbus holding registers through new `REGISTER_TYPE` configuration option ([#173](https://github.com/tomquist/b2500-meter/pull/173)) From dcda782307a09880088827c829650fb889f12c9d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 22:37:17 +0000 Subject: [PATCH 2/3] Fold same-cycle fixes into their parent Added bullets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Fixed / Changed bullets for CT002/CT003 saturation, efficiency- rotation lockup, and the MQTT_INSIGHTS empty-config crash / HA mosquitto availability check referenced features introduced in this same release cycle, so they weren't a standalone diff against main. Merged those PR refs into the CT002/CT003 and MQTT Insights Added bullets (the end state, which is what a main-viewer cares about). Modbus UNIT_ID fix stays in Fixed — Modbus existed on main. https://claude.ai/code/session_01BCVmemteVXNfoTQE4De2CU --- CHANGELOG.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eb02a4c..cf79ad7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,8 @@ - **Removed** from-source / contributor workflow: Pipenv, `Pipfile`, and running `python main.py` from the repo root are gone — use **uv** and the **`astrameter`** command (or `uv run astrameter`) per [CONTRIBUTING.md](CONTRIBUTING.md). ### Added -- **Added** CT002/CT003 emulation for steering multiple Marstek storage devices over the Marstek CT UDP protocol — fair-share load balancing, saturation-aware handoff, manual target override and forced rotation via MQTT, ARP-based consumer discovery, and an opt-in efficiency mode that concentrates power on fewer batteries at low demand (`MIN_EFFICIENT_POWER`, `EFFICIENCY_ROTATION_INTERVAL`, probe-based fades, `SATURATION_GRACE_SECONDS`) ([#283](https://github.com/tomquist/astrameter/pull/283), [#284](https://github.com/tomquist/astrameter/pull/284), [#287](https://github.com/tomquist/astrameter/pull/287), [#289](https://github.com/tomquist/astrameter/pull/289), [#294](https://github.com/tomquist/astrameter/pull/294), [#296](https://github.com/tomquist/astrameter/pull/296), [#298](https://github.com/tomquist/astrameter/pull/298), [#303](https://github.com/tomquist/astrameter/pull/303), [#310](https://github.com/tomquist/astrameter/pull/310), [#311](https://github.com/tomquist/astrameter/pull/311)). -- **Added** MQTT Insights: optional `[MQTT_INSIGHTS]` section publishes internal state (grid power, targets, saturation, consumer topology, EMA poll interval) to MQTT with Home Assistant Device Discovery; per-consumer active/pause + manual target control; Shelly battery offline availability; auto-configured in the HA app when Mosquitto is installed ([#292](https://github.com/tomquist/astrameter/pull/292), [#294](https://github.com/tomquist/astrameter/pull/294), [#297](https://github.com/tomquist/astrameter/pull/297)). +- **Added** CT002/CT003 emulation for steering multiple Marstek storage devices over the Marstek CT UDP protocol — fair-share load balancing, sample-rate-invariant time-weighted saturation detection with handoff, manual target override and forced rotation via MQTT, ARP-based consumer discovery, and an opt-in efficiency mode that concentrates power on fewer batteries at low demand (`MIN_EFFICIENT_POWER`, `EFFICIENCY_ROTATION_INTERVAL`, probe-based fades, `SATURATION_GRACE_SECONDS`) ([#283](https://github.com/tomquist/astrameter/pull/283), [#284](https://github.com/tomquist/astrameter/pull/284), [#287](https://github.com/tomquist/astrameter/pull/287), [#289](https://github.com/tomquist/astrameter/pull/289), [#291](https://github.com/tomquist/astrameter/pull/291), [#293](https://github.com/tomquist/astrameter/pull/293), [#294](https://github.com/tomquist/astrameter/pull/294), [#296](https://github.com/tomquist/astrameter/pull/296), [#298](https://github.com/tomquist/astrameter/pull/298), [#301](https://github.com/tomquist/astrameter/pull/301), [#303](https://github.com/tomquist/astrameter/pull/303), [#310](https://github.com/tomquist/astrameter/pull/310), [#311](https://github.com/tomquist/astrameter/pull/311), [#320](https://github.com/tomquist/astrameter/pull/320), [#321](https://github.com/tomquist/astrameter/pull/321)). +- **Added** MQTT Insights: optional `[MQTT_INSIGHTS]` section publishes internal state (grid power, targets, saturation, consumer topology, EMA poll interval) to MQTT with Home Assistant Device Discovery; per-consumer active/pause + manual target control; Shelly battery offline availability; auto-configured in the HA app when Mosquitto is installed ([#292](https://github.com/tomquist/astrameter/pull/292), [#294](https://github.com/tomquist/astrameter/pull/294), [#297](https://github.com/tomquist/astrameter/pull/297), [#300](https://github.com/tomquist/astrameter/pull/300), [#306](https://github.com/tomquist/astrameter/pull/306)). - **Added** opt-in web-based configuration editor (`WEB_CONFIG_ENABLED = True` in `[GENERAL]`) accessible at `http://:52500/config`; supports editing all config sections and keys with type-appropriate inputs, comment preservation, and a Save & Restart button ([#319](https://github.com/tomquist/astrameter/pull/319)). - **Added** HomeWizard P1 powermeter via the device WebSocket API, with optional `VERIFY_SSL` ([#231](https://github.com/tomquist/astrameter/pull/231), [#254](https://github.com/tomquist/astrameter/pull/254)). - **Added** SMA Energy Meter / Sunny Home Manager support via Speedwire multicast with device auto-detection and per-phase readings ([#252](https://github.com/tomquist/astrameter/pull/252)). @@ -35,17 +35,12 @@ ### Changed - **Switched** the Home Assistant powermeter integration from REST polling to the WebSocket API ([#232](https://github.com/tomquist/astrameter/pull/232)). -- **Updated** the CT002/CT003 saturation EMA to be time-weighted for sample-rate invariance — slow meters no longer accumulate saturation faster per sample ([#321](https://github.com/tomquist/astrameter/pull/321)). - **Added** battery activity info logs for Shelly emulation to report detection, inactivity, and reconnection events ([#241](https://github.com/tomquist/astrameter/pull/241)). - **Reduced** throttling output noise by replacing unconditional `print` calls in `ThrottledPowermeter` with structured logging (`logger.debug` for routine wait/fetch/cache messages; failures remain at error level) ([#251](https://github.com/tomquist/astrameter/pull/251)). - **Improved** Shelly UDP server robustness by adding socket timeouts to avoid hangs during shutdown and testing ([#233](https://github.com/tomquist/astrameter/pull/233)). ### Fixed - **Fixed** Modbus `UNIT_ID` handling and clarified Home Assistant entity ID configuration in the docs ([#191](https://github.com/tomquist/astrameter/pull/191), [#195](https://github.com/tomquist/astrameter/pull/195)). -- **Fixed** MQTT service availability check in the Home Assistant addon ([#306](https://github.com/tomquist/astrameter/pull/306)). -- **Fixed** CT002 efficiency-rotation lockup when a push-based powermeter goes silent ([#320](https://github.com/tomquist/astrameter/pull/320)). -- **Fixed** crash when the `[MQTT_INSIGHTS]` section has empty config values ([#300](https://github.com/tomquist/astrameter/pull/300)). -- **Fixed** false saturation detection during load-sign reversal and battery ramp-down, and false saturation swaps under fluctuating household load ([#291](https://github.com/tomquist/astrameter/pull/291), [#293](https://github.com/tomquist/astrameter/pull/293), [#301](https://github.com/tomquist/astrameter/pull/301)). ## 1.0.8 - Added support for Modbus holding registers through new `REGISTER_TYPE` configuration option ([#173](https://github.com/tomquist/b2500-meter/pull/173)) From 2dba4e5291bbff001700c5c3fdd557bb48d13662 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 22:42:16 +0000 Subject: [PATCH 3/3] Fold CT002/CT003 active-control defaults into Added bullet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CT002/CT003 ACTIVE_CONTROL default is not a 'changed default' vs main — CT002/CT003 don't exist on main, so the default is just part of the new feature description. Moved the default-on behavior and BALANCE_DEADBAND details into the CT002/CT003 Added bullet. Also narrowed the WAIT_FOR_NEXT_MESSAGE Breaking bullet to just the Shelly emulator (the real diff against main); the CT002/CT003 aspect is implicit in the CT002/CT003 Added bullet. Fixed a minor verb mismatch in Changed: 'Added battery activity info logs' → 'Expanded Shelly emulation logs'. https://claude.ai/code/session_01BCVmemteVXNfoTQE4De2CU --- CHANGELOG.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf79ad7b..f8ea1f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,13 @@ ### Breaking - **Rebranded** project from "B2500 Meter" to "AstraMeter" (formerly b2500-meter). Package renamed to `astrameter`, CLI commands are now `astrameter` and `astra-sim`. Docker image moved from `ghcr.io/tomquist/b2500-meter` to `ghcr.io/tomquist/astrameter` (the legacy `ghcr.io/tomquist/b2500-meter` image is still published in parallel for backward compatibility). Home Assistant users must update their app repository URL to `https://github.com/tomquist/astrameter#main` ([#302](https://github.com/tomquist/astrameter/pull/302), [#304](https://github.com/tomquist/astrameter/pull/304)). - **Removed CT001 emulation** (Python `ct001` package and the `nodered.json` flow). Use `ct002`/`ct003` for multiple storage devices, or a Shelly `DEVICE_TYPE` otherwise. Drop obsolete `[GENERAL]` options `DISABLE_SUM_PHASES`, `DISABLE_ABSOLUTE_VALUES`, and `POLL_INTERVAL` if present. The Home Assistant app no longer offers `poll_interval` or `disable_absolute_values`; remove those keys from saved app configuration if validation fails after upgrade ([#258](https://github.com/tomquist/astrameter/pull/258)). -- **Changed default:** CT002/CT003 `ACTIVE_CONTROL` is on by default. When emulating CT002/CT003 the emulator now smooths the grid reading, splits the target across batteries with a built-in 15 W `BALANCE_DEADBAND`, and runs saturation detection. Set `ACTIVE_CONTROL = False` under `[CT002]` / `[CT003]` for relay mode (raw meter values forwarded, batteries decide); tunables `BALANCE_DEADBAND`, `FAIR_DISTRIBUTION`, `BALANCE_GAIN`, `SATURATION_DETECTION` ([#283](https://github.com/tomquist/astrameter/pull/283), [#296](https://github.com/tomquist/astrameter/pull/296)). -- **Changed default:** `WAIT_FOR_NEXT_MESSAGE` defaults to `True`. Every emulator response (CT002/CT003 **and** Shelly) now waits up to 2 s for a fresh push sample from event-driven meters (MQTT, SMA Speedwire, HomeWizard WS, HA WS) before replying, then falls back to the cached value on timeout. Set `WAIT_FOR_NEXT_MESSAGE = False` under `[GENERAL]` or a powermeter section to disable ([#322](https://github.com/tomquist/astrameter/pull/322), [#330](https://github.com/tomquist/astrameter/pull/330)). +- **Changed Shelly emulator default:** event-driven powermeters (MQTT, SMA Speedwire, HomeWizard WS, HA WS) now block each Shelly response for up to 2 s waiting for a fresh push sample, then fall back to the cached value on timeout. Set `WAIT_FOR_NEXT_MESSAGE = False` under `[GENERAL]` or the powermeter section to restore the previous immediate-read behavior ([#322](https://github.com/tomquist/astrameter/pull/322), [#330](https://github.com/tomquist/astrameter/pull/330)). - **Changed API:** the `Powermeter` base class is now async. Out-of-tree powermeter subclasses must implement `async get_powermeter_watts()`; the synchronous legacy interface has been removed ([#273](https://github.com/tomquist/astrameter/pull/273), [#274](https://github.com/tomquist/astrameter/pull/274), [#275](https://github.com/tomquist/astrameter/pull/275), [#276](https://github.com/tomquist/astrameter/pull/276), [#277](https://github.com/tomquist/astrameter/pull/277), [#278](https://github.com/tomquist/astrameter/pull/278), [#279](https://github.com/tomquist/astrameter/pull/279), [#282](https://github.com/tomquist/astrameter/pull/282)). - **Removed** 32-bit ARM (`armhf` / `armv7`) Home Assistant images. Installations must use a 64-bit Home Assistant OS or supervisor environment (`amd64` or `aarch64`), consistent with Home Assistant dropping 32-bit support. - **Removed** from-source / contributor workflow: Pipenv, `Pipfile`, and running `python main.py` from the repo root are gone — use **uv** and the **`astrameter`** command (or `uv run astrameter`) per [CONTRIBUTING.md](CONTRIBUTING.md). ### Added -- **Added** CT002/CT003 emulation for steering multiple Marstek storage devices over the Marstek CT UDP protocol — fair-share load balancing, sample-rate-invariant time-weighted saturation detection with handoff, manual target override and forced rotation via MQTT, ARP-based consumer discovery, and an opt-in efficiency mode that concentrates power on fewer batteries at low demand (`MIN_EFFICIENT_POWER`, `EFFICIENCY_ROTATION_INTERVAL`, probe-based fades, `SATURATION_GRACE_SECONDS`) ([#283](https://github.com/tomquist/astrameter/pull/283), [#284](https://github.com/tomquist/astrameter/pull/284), [#287](https://github.com/tomquist/astrameter/pull/287), [#289](https://github.com/tomquist/astrameter/pull/289), [#291](https://github.com/tomquist/astrameter/pull/291), [#293](https://github.com/tomquist/astrameter/pull/293), [#294](https://github.com/tomquist/astrameter/pull/294), [#296](https://github.com/tomquist/astrameter/pull/296), [#298](https://github.com/tomquist/astrameter/pull/298), [#301](https://github.com/tomquist/astrameter/pull/301), [#303](https://github.com/tomquist/astrameter/pull/303), [#310](https://github.com/tomquist/astrameter/pull/310), [#311](https://github.com/tomquist/astrameter/pull/311), [#320](https://github.com/tomquist/astrameter/pull/320), [#321](https://github.com/tomquist/astrameter/pull/321)). +- **Added** CT002/CT003 emulation for steering multiple Marstek storage devices over the Marstek CT UDP protocol. Active control is on by default (`ACTIVE_CONTROL = True`): the emulator smooths the grid reading, splits the target across batteries with a 15 W `BALANCE_DEADBAND`, and runs time-weighted saturation detection with handoff — set `ACTIVE_CONTROL = False` for relay mode (raw meter values forwarded, batteries decide). Includes fair-share balancing (`FAIR_DISTRIBUTION`, `BALANCE_GAIN`), manual target override and forced rotation via MQTT, ARP-based consumer discovery, and an opt-in efficiency mode that concentrates power on fewer batteries at low demand (`MIN_EFFICIENT_POWER`, `EFFICIENCY_ROTATION_INTERVAL`, probe-based fades, `SATURATION_GRACE_SECONDS`) ([#283](https://github.com/tomquist/astrameter/pull/283), [#284](https://github.com/tomquist/astrameter/pull/284), [#287](https://github.com/tomquist/astrameter/pull/287), [#289](https://github.com/tomquist/astrameter/pull/289), [#291](https://github.com/tomquist/astrameter/pull/291), [#293](https://github.com/tomquist/astrameter/pull/293), [#294](https://github.com/tomquist/astrameter/pull/294), [#296](https://github.com/tomquist/astrameter/pull/296), [#298](https://github.com/tomquist/astrameter/pull/298), [#301](https://github.com/tomquist/astrameter/pull/301), [#303](https://github.com/tomquist/astrameter/pull/303), [#310](https://github.com/tomquist/astrameter/pull/310), [#311](https://github.com/tomquist/astrameter/pull/311), [#320](https://github.com/tomquist/astrameter/pull/320), [#321](https://github.com/tomquist/astrameter/pull/321)). - **Added** MQTT Insights: optional `[MQTT_INSIGHTS]` section publishes internal state (grid power, targets, saturation, consumer topology, EMA poll interval) to MQTT with Home Assistant Device Discovery; per-consumer active/pause + manual target control; Shelly battery offline availability; auto-configured in the HA app when Mosquitto is installed ([#292](https://github.com/tomquist/astrameter/pull/292), [#294](https://github.com/tomquist/astrameter/pull/294), [#297](https://github.com/tomquist/astrameter/pull/297), [#300](https://github.com/tomquist/astrameter/pull/300), [#306](https://github.com/tomquist/astrameter/pull/306)). - **Added** opt-in web-based configuration editor (`WEB_CONFIG_ENABLED = True` in `[GENERAL]`) accessible at `http://:52500/config`; supports editing all config sections and keys with type-appropriate inputs, comment preservation, and a Save & Restart button ([#319](https://github.com/tomquist/astrameter/pull/319)). - **Added** HomeWizard P1 powermeter via the device WebSocket API, with optional `VERIFY_SSL` ([#231](https://github.com/tomquist/astrameter/pull/231), [#254](https://github.com/tomquist/astrameter/pull/254)). @@ -35,7 +34,7 @@ ### Changed - **Switched** the Home Assistant powermeter integration from REST polling to the WebSocket API ([#232](https://github.com/tomquist/astrameter/pull/232)). -- **Added** battery activity info logs for Shelly emulation to report detection, inactivity, and reconnection events ([#241](https://github.com/tomquist/astrameter/pull/241)). +- **Expanded** Shelly emulation logs to report battery detection, inactivity, and reconnection events ([#241](https://github.com/tomquist/astrameter/pull/241)). - **Reduced** throttling output noise by replacing unconditional `print` calls in `ThrottledPowermeter` with structured logging (`logger.debug` for routine wait/fetch/cache messages; failures remain at error level) ([#251](https://github.com/tomquist/astrameter/pull/251)). - **Improved** Shelly UDP server robustness by adding socket timeouts to avoid hangs during shutdown and testing ([#233](https://github.com/tomquist/astrameter/pull/233)).