Skip to content

Commit 5938036

Browse files
committed
Add FEATURES_CIRCLE constant and implement
1 parent 557fdf4 commit 5938036

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
CACHE_RELAY = "relay"
5858
CACHE_RELAY_INIT = "relay_init"
5959
CACHE_RELAY_LOCK = "relay_lock"
60+
FEATURES_CIRCLE = (
61+
NodeFeature.CIRCLE,
62+
NodeFeature.RELAY,
63+
NodeFeature.RELAY_INIT,
64+
NodeFeature.RELAY_LOCK,
65+
NodeFeature.ENERGY,
66+
NodeFeature.POWER,
67+
)
6068

6169
FuncT = TypeVar("FuncT", bound=Callable[..., Any])
6270
_LOGGER = logging.getLogger(__name__)
@@ -884,17 +892,7 @@ async def load(self) -> bool:
884892
_LOGGER.debug("Loading Circle node %s from cache", self._mac_in_str)
885893
if await self._load_from_cache():
886894
self._loaded = True
887-
self._setup_protocol(
888-
CIRCLE_FIRMWARE_SUPPORT,
889-
(
890-
NodeFeature.CIRCLE,
891-
NodeFeature.RELAY,
892-
NodeFeature.RELAY_INIT,
893-
NodeFeature.RELAY_LOCK,
894-
NodeFeature.ENERGY,
895-
NodeFeature.POWER,
896-
),
897-
)
895+
self._setup_protocol(CIRCLE_FIRMWARE_SUPPORT, FEATURES_CIRCLE)
898896
if await self.initialize():
899897
await self._loaded_callback(NodeEvent.LOADED, self.mac)
900898
return True
@@ -926,17 +924,7 @@ async def load(self) -> bool:
926924
return False
927925

928926
self._loaded = True
929-
self._setup_protocol(
930-
CIRCLE_FIRMWARE_SUPPORT,
931-
(
932-
NodeFeature.CIRCLE,
933-
NodeFeature.RELAY,
934-
NodeFeature.RELAY_INIT,
935-
NodeFeature.RELAY_LOCK,
936-
NodeFeature.ENERGY,
937-
NodeFeature.POWER,
938-
),
939-
)
927+
self._setup_protocol(CIRCLE_FIRMWARE_SUPPORT, FEATURES_CIRCLE)
940928
if not await self.initialize():
941929
return False
942930

0 commit comments

Comments
 (0)