1 """Reproduce an Input text state."""
3 from __future__
import annotations
6 from collections.abc
import Iterable
13 from .
import ATTR_VALUE, DOMAIN, SERVICE_SET_VALUE
15 _LOGGER = logging.getLogger(__name__)
22 context: Context |
None =
None,
23 reproduce_options: dict[str, Any] |
None =
None,
25 """Reproduce a single state."""
27 if (cur_state := hass.states.get(state.entity_id))
is None:
28 _LOGGER.warning(
"Unable to find entity %s", state.entity_id)
32 if cur_state.state == state.state:
36 service = SERVICE_SET_VALUE
37 service_data = {ATTR_ENTITY_ID: state.entity_id, ATTR_VALUE: state.state}
39 await hass.services.async_call(
40 DOMAIN, service, service_data, context=context, blocking=
True
46 states: Iterable[State],
48 context: Context |
None =
None,
49 reproduce_options: dict[str, Any] |
None =
None,
51 """Reproduce Input text states."""
56 hass, state, context=context, reproduce_options=reproduce_options
None async_reproduce_states(HomeAssistant hass, Iterable[State] states, *Context|None context=None, dict[str, Any]|None reproduce_options=None)
None _async_reproduce_state(HomeAssistant hass, State state, *Context|None context=None, dict[str, Any]|None reproduce_options=None)