Skip to content

Commit 02c4aa5

Browse files
committed
use emit instead of another task
1 parent e98096c commit 02c4aa5

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

zha/application/platforms/cover/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def restore_external_state_attributes(
197197
self._state = state
198198
self._target_lift_position = target_lift_position
199199
self._target_tilt_position = target_tilt_position
200+
self.maybe_emit_state_changed_event()
200201

201202
@property
202203
def is_closed(self) -> bool | None:
@@ -701,14 +702,6 @@ def restore_external_state_attributes(
701702
target_tilt_position: int | None,
702703
):
703704
"""Restore external state attributes."""
704-
705-
def refresh_state():
706-
refresh_task = asyncio.create_task(
707-
self._device.gateway.entities.refresh_state(self.info_object)
708-
)
709-
self._tasks.append(refresh_task)
710-
refresh_task.add_done_callback(self._tasks.remove)
711-
712705
task = asyncio.create_task(
713706
self._device.gateway.covers.restore_external_state_attributes(
714707
self.info_object,
@@ -719,4 +712,3 @@ def refresh_state():
719712
)
720713
self._tasks.append(task)
721714
task.add_done_callback(self._tasks.remove)
722-
task.add_done_callback(lambda _: refresh_state())

0 commit comments

Comments
 (0)