Add transition support to scenes, cleanup blocking parameter (#34434)

This commit is contained in:
Franck Nijhof 2020-04-21 03:07:50 +02:00 committed by GitHub
parent 19be31d13a
commit bc5a2da7b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 547 additions and 229 deletions

View file

@ -1,6 +1,6 @@
"""Module that groups code required to handle state restore for component."""
import asyncio
from typing import Iterable, Optional
from typing import Any, Dict, Iterable, Optional
from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import Context, State
@ -26,7 +26,11 @@ from .const import (
async def _async_reproduce_states(
hass: HomeAssistantType, state: State, context: Optional[Context] = None
hass: HomeAssistantType,
state: State,
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce component states."""
@ -69,9 +73,18 @@ async def _async_reproduce_states(
async def async_reproduce_states(
hass: HomeAssistantType, states: Iterable[State], context: Optional[Context] = None
hass: HomeAssistantType,
states: Iterable[State],
*,
context: Optional[Context] = None,
reproduce_options: Optional[Dict[str, Any]] = None,
) -> None:
"""Reproduce component states."""
await asyncio.gather(
*(_async_reproduce_states(hass, state, context) for state in states)
*(
_async_reproduce_states(
hass, state, context=context, reproduce_options=reproduce_options
)
for state in states
)
)