mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use async functions for Somfy (#42448)
This commit is contained in:
parent
f91cd25e57
commit
b2598d2241
@ -61,29 +61,29 @@ class SomfyCover(SomfyEntity, RestoreEntity, CoverEntity):
|
|||||||
await super().async_update()
|
await super().async_update()
|
||||||
self.cover = Blind(self.device, self.api)
|
self.cover = Blind(self.device, self.api)
|
||||||
|
|
||||||
def close_cover(self, **kwargs):
|
async def async_close_cover(self, **kwargs):
|
||||||
"""Close the cover."""
|
"""Close the cover."""
|
||||||
self._is_closing = True
|
self._is_closing = True
|
||||||
self.schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
try:
|
try:
|
||||||
# Blocks until the close command is sent
|
# Blocks until the close command is sent
|
||||||
self.cover.close()
|
await self.hass.async_add_executor_job(self.cover.close)
|
||||||
self._closed = True
|
self._closed = True
|
||||||
finally:
|
finally:
|
||||||
self._is_closing = None
|
self._is_closing = None
|
||||||
self.schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
def open_cover(self, **kwargs):
|
async def async_open_cover(self, **kwargs):
|
||||||
"""Open the cover."""
|
"""Open the cover."""
|
||||||
self._is_opening = True
|
self._is_opening = True
|
||||||
self.schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
try:
|
try:
|
||||||
# Blocks until the open command is sent
|
# Blocks until the open command is sent
|
||||||
self.cover.open()
|
await self.hass.async_add_executor_job(self.cover.open)
|
||||||
self._closed = False
|
self._closed = False
|
||||||
finally:
|
finally:
|
||||||
self._is_opening = None
|
self._is_opening = None
|
||||||
self.schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
def stop_cover(self, **kwargs):
|
def stop_cover(self, **kwargs):
|
||||||
"""Stop the cover."""
|
"""Stop the cover."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user