mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Reuse default aiohttp session (#5836)
This commit is contained in:
parent
ebfff6a907
commit
841321f154
@ -18,11 +18,12 @@ from homeassistant.components.media_player import (
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_IDLE, STATE_PAUSED, STATE_PLAYING, STATE_STANDBY, CONF_HOST,
|
STATE_IDLE, STATE_PAUSED, STATE_PLAYING, STATE_STANDBY, CONF_HOST,
|
||||||
CONF_NAME, EVENT_HOMEASSISTANT_STOP)
|
CONF_NAME, EVENT_HOMEASSISTANT_STOP)
|
||||||
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
|
|
||||||
REQUIREMENTS = ['pyatv==0.1.2']
|
REQUIREMENTS = ['pyatv==0.1.3']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -62,7 +63,8 @@ def async_setup_platform(hass, config, async_add_entities,
|
|||||||
hass.data[DATA_APPLE_TV].append(host)
|
hass.data[DATA_APPLE_TV].append(host)
|
||||||
|
|
||||||
details = pyatv.AppleTVDevice(name, host, login_id)
|
details = pyatv.AppleTVDevice(name, host, login_id)
|
||||||
atv = pyatv.connect_to_apple_tv(details, hass.loop)
|
session = async_get_clientsession(hass)
|
||||||
|
atv = pyatv.connect_to_apple_tv(details, hass.loop, session=session)
|
||||||
entity = AppleTvDevice(atv, name)
|
entity = AppleTvDevice(atv, name)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
@ -418,7 +418,7 @@ pyasn1-modules==0.0.8
|
|||||||
pyasn1==0.2.2
|
pyasn1==0.2.2
|
||||||
|
|
||||||
# homeassistant.components.media_player.apple_tv
|
# homeassistant.components.media_player.apple_tv
|
||||||
pyatv==0.1.2
|
pyatv==0.1.3
|
||||||
|
|
||||||
# homeassistant.components.device_tracker.bbox
|
# homeassistant.components.device_tracker.bbox
|
||||||
# homeassistant.components.sensor.bbox
|
# homeassistant.components.sensor.bbox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user