mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Update roomba to use async_add_executor_job (#41448)
This commit is contained in:
parent
4ab02cb9bc
commit
52e8366ce7
@ -129,7 +129,7 @@ async def async_connect_or_timeout(hass, roomba):
|
|||||||
name = None
|
name = None
|
||||||
with async_timeout.timeout(10):
|
with async_timeout.timeout(10):
|
||||||
_LOGGER.debug("Initialize connection to vacuum")
|
_LOGGER.debug("Initialize connection to vacuum")
|
||||||
await hass.async_add_job(roomba.connect)
|
await hass.async_add_executor_job(roomba.connect)
|
||||||
while not roomba.roomba_connected or name is None:
|
while not roomba.roomba_connected or name is None:
|
||||||
# Waiting for connection and check datas ready
|
# Waiting for connection and check datas ready
|
||||||
name = roomba_reported_state(roomba).get("name", None)
|
name = roomba_reported_state(roomba).get("name", None)
|
||||||
@ -152,7 +152,7 @@ async def async_disconnect_or_timeout(hass, roomba):
|
|||||||
"""Disconnect to vacuum."""
|
"""Disconnect to vacuum."""
|
||||||
_LOGGER.debug("Disconnect vacuum")
|
_LOGGER.debug("Disconnect vacuum")
|
||||||
with async_timeout.timeout(3):
|
with async_timeout.timeout(3):
|
||||||
await hass.async_add_job(roomba.disconnect)
|
await hass.async_add_executor_job(roomba.disconnect)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user