diff --git a/CHANGELOG.md b/CHANGELOG.md index 511aeef7..f8ea1f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,45 @@ # 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 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. 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)). +- **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)). +- **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)). + +### 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)). ## 1.0.8 - Added support for Modbus holding registers through new `REGISTER_TYPE` configuration option ([#173](https://github.com/tomquist/b2500-meter/pull/173))