Skip to content

Commit 5c25339

Browse files
committed
Wait task for open and closed is fixed now.
1 parent 57e97d7 commit 5c25339

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pymyq/device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async def wait_for_state(self, current_state: List, new_state: List, last_state_
134134
pass
135135

136136
# Wait until the state is to what we want it to be
137-
_LOGGER.debug(f"Waiting until device state for {self.name} is {current_state}")
137+
_LOGGER.debug(f"Waiting until device state for {self.name} is {new_state}")
138138
wait_timeout = WAIT_TIMEOUT
139139
while self.state in current_state and wait_timeout > 0:
140140
wait_timeout = wait_timeout - 5

pymyq/garagedoor.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,16 @@ async def close(self, wait_for_state: bool = False) -> Union[asyncio.Task, bool]
7474
)
7575
self.state = STATE_CLOSING
7676

77-
if not wait_for_state:
78-
return True
79-
8077
wait_for_state_task = asyncio.create_task(self.wait_for_state(
81-
current_state=[STATE_OPENING],
82-
new_state=[STATE_OPEN],
78+
current_state=[STATE_CLOSING],
79+
new_state=[STATE_CLOSED],
8380
last_state_update=self.device_json["state"].get("last_update"),
8481
), name="MyQ_WaitForClose",
8582
)
8683
if not wait_for_state:
8784
return wait_for_state_task
8885

86+
_LOGGER.debug("Waiting till garage is closed")
8987
return await wait_for_state_task
9088

9189
async def open(self, wait_for_state: bool = False) -> Union[asyncio.Task, bool]:
@@ -113,4 +111,5 @@ async def open(self, wait_for_state: bool = False) -> Union[asyncio.Task, bool]:
113111
if not wait_for_state:
114112
return wait_for_state_task
115113

114+
_LOGGER.debug("Waiting till garage is open")
116115
return await wait_for_state_task

0 commit comments

Comments
 (0)