diff --git a/CHANGELOG.md b/CHANGELOG.md index dadc7aee5..e88e95631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,15 @@ # Changelog -## v0.44.1 +## v0.44.2 - 2025-06-11 + +- Bugfix: implement solution for Issue [#259](https://github.com/plugwise/plugwise_usb-beta/issues/259) + +## v0.44.1 - 2025-06-10 - PR [#258](https://github.com/plugwise/python-plugwise-usb/pull/258) - Sense: make sure NodeFeature.BATTERY is called and configuration parameters are propagated properly -## v0.44.0 +## v0.44.0 - 2025-06-10 - PR [#256](https://github.com/plugwise/python-plugwise-usb/pull/256) Implement PlugWise Sense product diff --git a/plugwise_usb/nodes/helpers/pulses.py b/plugwise_usb/nodes/helpers/pulses.py index 811254969..1bd8e81dc 100644 --- a/plugwise_usb/nodes/helpers/pulses.py +++ b/plugwise_usb/nodes/helpers/pulses.py @@ -503,8 +503,14 @@ def _update_log_direction( ) -> None: """Update Energy direction of log record. - Two subsequential logs with the same timestamp indicates the first - is consumption and second production. + Two subsequential logging slots with the same timestamp indicate + both consumption and production logging is active. + The first slot (e.g. 1) contains consumption data, + the second slot (e.g. 2) production data. + + This code expects either single slots containing consumption data + or double slots containing consumption and production data. + Single slots containing production data only is NOT supported/tested. """ if self._logs is None: return @@ -513,10 +519,11 @@ def _update_log_direction( next_timestamp = self._check_next_production(address, slot, timestamp) if self._first_prev_log_processed and self._first_next_log_processed: # _log_production is True when 2 out of 3 consecutive slots have - # the same timestamp, otherwise it is False + # the same timestamp self._log_production = ( - next_timestamp == timestamp and prev_timestamp != timestamp - ) or (next_timestamp == prev_timestamp and next_timestamp != timestamp) + (prev_timestamp == timestamp) + ^ (next_timestamp == timestamp) + ) def _check_prev_production( self, address: int, slot: int, timestamp: datetime diff --git a/pyproject.toml b/pyproject.toml index fa1198b93..35532dce9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise_usb" -version = "0.44.1" +version = "0.44.2" license = "MIT" keywords = ["home", "automation", "plugwise", "module", "usb"] classifiers = [