Skip to content

Commit c5e516d

Browse files
committed
codefactor check update
coderabbitai recommendations
1 parent 1e1f7d6 commit c5e516d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

plugwise_usb/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class NodeFeature(str, Enum):
4141

4242
AVAILABLE = "available"
4343
BATTERY = "battery"
44+
CIRCLEPLUS = "circleplus"
4445
ENERGY = "energy"
4546
HUMIDITY = "humidity"
4647
INFO = "info"
@@ -54,7 +55,6 @@ class NodeFeature(str, Enum):
5455
SWITCH = "switch"
5556
SENSE = "sense"
5657
TEMPERATURE = "temperature"
57-
CIRCLEPLUS = "circleplus"
5858

5959

6060
class NodeType(Enum):

plugwise_usb/nodes/circle_plus.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ async def load(self) -> bool:
7575
NodeFeature.RELAY_LOCK,
7676
NodeFeature.ENERGY,
7777
NodeFeature.POWER,
78+
NodeFeature.CIRCLEPLUS,
7879
),
7980
)
8081
if not await self.initialize():
@@ -126,7 +127,16 @@ async def clock_synchronize(self) -> bool:
126127

127128
@raise_not_loaded
128129
async def enable_auto_join(self) -> bool:
129-
"""Enable Auto Join."""
130-
_LOGGER.info("Allow Auto Joining Enabled")
131-
allow_auto_join_request = CirclePlusAllowJoiningRequest(self._send, True)
132-
return await allow_auto_join_request.send()
130+
"""Enable auto-join on the Circle+.
131+
132+
Returns:
133+
bool: True if the request was acknowledged, False otherwise.
134+
"""
135+
_LOGGER.info("Enabling auto-join for CirclePlus")
136+
request = CirclePlusAllowJoiningRequest(self._send, True)
137+
response = await request.send()
138+
if response is None:
139+
return False
140+
141+
# JOIN_ACCEPTED is the ACK for enable=True
142+
return NodeResponseType(response.ack_id) == NodeResponseType.JOIN_ACCEPTED

0 commit comments

Comments
 (0)