diff --git a/CHANGELOG.md b/CHANGELOG.md index bf9df23..5633acb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.2.4] - 03/2026 + +### Fixed + +- **Negative zero on idle circuits** — Circuit power negation (`-raw_power_w`) produced IEEE 754 `-0.0` when the panel reported `0.0` for an idle circuit. The value is now normalized to positive zero after negation. + ## [2.2.3] - 03/2026 ### Changed diff --git a/pyproject.toml b/pyproject.toml index 5b4683d..2f7884f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "span-panel-api" -version = "2.2.3" +version = "2.2.4" description = "A client library for SPAN Panel API" authors = [ {name = "SpanPanel"} diff --git a/src/span_panel_api/mqtt/homie.py b/src/span_panel_api/mqtt/homie.py index 3148cb7..7a0a449 100644 --- a/src/span_panel_api/mqtt/homie.py +++ b/src/span_panel_api/mqtt/homie.py @@ -265,7 +265,7 @@ def _build_circuit(self, node_id: str, device_type: str = "circuit", relative_po # active-power is in watts; negate so positive = consumption raw_power_w = _parse_float(self._get_prop(node_id, "active-power")) - instant_power_w = -raw_power_w + instant_power_w = -raw_power_w or 0.0 # Energy: exported-energy = consumption (panel exports TO circuit) consumed_wh = _parse_float(self._get_prop(node_id, "exported-energy"))