3333from ..nodes import get_plugwise_node
3434from .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