Skip to content

Commit 4fb4872

Browse files
committed
Implement review suggestions & corrections
1 parent b366b6e commit 4fb4872

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugwise_usb/network/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
from ..nodes import get_plugwise_node
3434
from .registry import StickNetworkRegister
3535

36+
ENERGY_NODE_TYPES: tuple[int] = (1, 2, 9)
37+
3638
_LOGGER = logging.getLogger(__name__)
3739
# endregion
3840

@@ -544,9 +546,9 @@ async def allow_join_requests(self, state: bool) -> None:
544546

545547
async def energy_reset_request(self, mac: str) -> None:
546548
"""Send an energy-reset to a Node."""
547-
if self._nodes[mac].node_info.node_type.value not in (1, 2, 9):
549+
if self._nodes[mac].node_info.node_type.value not in ENERGY_NODE_TYPES:
548550
raise NodeError(
549-
"Energy-resetting not supported for {self._nodes[mac].node_info.node_type.name}"
551+
f"Energy-resetting not supported for {self._nodes[mac].node_info.node_type.name}"
550552
)
551553

552554
node_protocols = self._nodes[mac].node_protocols
@@ -573,9 +575,9 @@ async def set_energy_intervals(
573575
Default: consumption = 60, production = 0.
574576
For logging energy in both directions set both to 60.
575577
"""
576-
if self._nodes[mac].node_info.node_type.value not in (1, 2, 9):
578+
if self._nodes[mac].node_info.node_type.value not in ENERGY_NODE_TYPES:
577579
raise NodeError(
578-
"Setting energy-intervals not supported for {self._nodes[mac].node_info.node_type.name}"
580+
f"Setting energy-intervals not supported for {self._nodes[mac].node_info.node_type.name}"
579581
)
580582

581583
# Validate input parameters

0 commit comments

Comments
 (0)