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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## ongoing
## v0.44.13 - 2025-08-29

- PR [327](https://github.com/plugwise/python-plugwise-usb/pull/327): Improve code quality according to SonarCloud, simplify sed awake timer
- PR [328](https://github.com/plugwise/python-plugwise-usb/pull/328): allow get_state request for non-data NodeFeatures

## v0.44.12 - 2025-08-24

Expand Down
5 changes: 3 additions & 2 deletions plugwise_usb/nodes/circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def _correct_power_pulses(self, pulses: int, offset: int) -> float:
return 0.0

@raise_not_loaded
async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any]:
async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any]: # noqa: PLR0912
"""Update latest state for given feature."""
states: dict[NodeFeature, Any] = {}
if not self._available and not await self.is_online():
Expand Down Expand Up @@ -1294,7 +1294,8 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
)
case _:
state_result = await super().get_state((feature,))
states[feature] = state_result[feature]
if feature in state_result:
states[feature] = state_result[feature]

if NodeFeature.AVAILABLE not in states:
states[NodeFeature.AVAILABLE] = self.available_state
Expand Down
7 changes: 4 additions & 3 deletions plugwise_usb/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,10 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
case NodeFeature.PING:
states[NodeFeature.PING] = await self.ping_update()
case _:
raise NodeError(
f"Update of feature '{feature.name}' is "
+ f"not supported for {self.mac}"
_LOGGER.debug(
"Update of feature '%s' does not return any data for %s",
feature.name,
self.mac,
)

return states
Expand Down
5 changes: 3 additions & 2 deletions plugwise_usb/nodes/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ async def _scan_calibrate_light(self) -> bool:
)

async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any]:
"""Update latest state for given feature."""
"""Update latest state for given features."""
states: dict[NodeFeature, Any] = {}
for feature in features:
_LOGGER.debug(
Expand All @@ -545,7 +545,8 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
states[NodeFeature.MOTION_CONFIG] = self._motion_config
case _:
state_result = await super().get_state((feature,))
states[feature] = state_result[feature]
if feature in state_result:
states[feature] = state_result[feature]

if NodeFeature.AVAILABLE not in states:
states[NodeFeature.AVAILABLE] = self.available_state
Expand Down
3 changes: 2 additions & 1 deletion plugwise_usb/nodes/sed.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
states[NodeFeature.BATTERY] = self._battery_config
case _:
state_result = await super().get_state((feature,))
states[feature] = state_result[feature]
if feature in state_result:
states[feature] = state_result[feature]

return states
3 changes: 2 additions & 1 deletion plugwise_usb/nodes/sense.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
states[NodeFeature.SENSE] = self._sense_statistics
case _:
state_result = await super().get_state((feature,))
states[feature] = state_result[feature]
if feature in state_result:
states[feature] = state_result[feature]

if NodeFeature.AVAILABLE not in states:
states[NodeFeature.AVAILABLE] = self.available_state
Expand Down
3 changes: 2 additions & 1 deletion plugwise_usb/nodes/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ async def get_state(self, features: tuple[NodeFeature]) -> dict[NodeFeature, Any
states[NodeFeature.SWITCH] = self._switch
case _:
state_result = await super().get_state((feature,))
states[feature] = state_result[feature]
if feature in state_result:
states[feature] = state_result[feature]

if NodeFeature.AVAILABLE not in states:
states[NodeFeature.AVAILABLE] = self.available_state
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "plugwise_usb"
version = "0.44.13a0"
version = "0.44.13"
license = "MIT"
keywords = ["home", "automation", "plugwise", "module", "usb"]
classifiers = [
Expand Down