mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
RFC: Use bind_hass for helpers (#9745)
* Add Helpers bind_hass functionality * Update other helpers
This commit is contained in:
@@ -4,6 +4,7 @@ import json
|
||||
import logging
|
||||
from collections import defaultdict
|
||||
|
||||
from homeassistant.loader import bind_hass
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.components.media_player import (
|
||||
ATTR_MEDIA_CONTENT_ID, ATTR_MEDIA_CONTENT_TYPE, ATTR_MEDIA_SEEK_POSITION,
|
||||
@@ -120,6 +121,7 @@ def get_changed_since(states, utc_point_in_time):
|
||||
if state.last_updated >= utc_point_in_time]
|
||||
|
||||
|
||||
@bind_hass
|
||||
def reproduce_state(hass, states, blocking=False):
|
||||
"""Reproduce given state."""
|
||||
return run_coroutine_threadsafe(
|
||||
@@ -127,6 +129,7 @@ def reproduce_state(hass, states, blocking=False):
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
@bind_hass
|
||||
def async_reproduce_state(hass, states, blocking=False):
|
||||
"""Reproduce given state."""
|
||||
if isinstance(states, State):
|
||||
|
||||
Reference in New Issue
Block a user