Cleanup coroutine threadsafe (#27080)

* Cleanup coroutine threadsafe

* fix lint

* Fix typing

* Fix tests

* Fix black
This commit is contained in:
Pascal Vizeli 2019-10-01 16:59:06 +02:00 committed by GitHub
parent f4a1f2809b
commit c1851a2d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 196 additions and 232 deletions

View file

@ -44,7 +44,6 @@ from homeassistant.const import (
SERVICE_SELECT_OPTION,
)
from homeassistant.core import Context, State, DOMAIN as HASS_DOMAIN
from homeassistant.util.async_ import run_coroutine_threadsafe
from .typing import HomeAssistantType
_LOGGER = logging.getLogger(__name__)
@ -122,7 +121,7 @@ def reproduce_state(
blocking: bool = False,
) -> None:
"""Reproduce given state."""
return run_coroutine_threadsafe( # type: ignore
return asyncio.run_coroutine_threadsafe(
async_reproduce_state(hass, states, blocking), hass.loop
).result()