mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add discovery suppport to Apple TV (#5801)
Add an optional extended description…
This commit is contained in:
parent
2dab6cbb0e
commit
250523c1d8
@ -40,6 +40,7 @@ SERVICE_HANDLERS = {
|
||||
'samsung_tv': ('media_player', 'samsungtv'),
|
||||
'yeelight': ('light', 'yeelight'),
|
||||
'flux_led': ('light', 'flux_led'),
|
||||
'apple_tv': ('media_player', 'apple_tv'),
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
|
@ -21,7 +21,7 @@ import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
||||
REQUIREMENTS = ['pyatv==0.0.1']
|
||||
REQUIREMENTS = ['pyatv==0.1.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -44,17 +44,21 @@ def async_setup_platform(hass, config, async_add_entities,
|
||||
"""Setup the Apple TV platform."""
|
||||
import pyatv
|
||||
|
||||
if discovery_info is not None:
|
||||
name = discovery_info['name']
|
||||
host = discovery_info['host']
|
||||
login_id = discovery_info['hsgid']
|
||||
else:
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
login_id = config.get(CONF_LOGIN_ID)
|
||||
|
||||
if DATA_APPLE_TV not in hass.data:
|
||||
hass.data[DATA_APPLE_TV] = []
|
||||
|
||||
name = config.get(CONF_NAME)
|
||||
host = config.get(CONF_HOST)
|
||||
login_id = config.get(CONF_LOGIN_ID)
|
||||
|
||||
key = '{}:{}'.format(host, name)
|
||||
if key in hass.data[DATA_APPLE_TV]:
|
||||
if host in hass.data[DATA_APPLE_TV]:
|
||||
return False
|
||||
hass.data[DATA_APPLE_TV].append(key)
|
||||
hass.data[DATA_APPLE_TV].append(host)
|
||||
|
||||
details = pyatv.AppleTVDevice(name, host, login_id)
|
||||
atv = pyatv.connect_to_apple_tv(details, hass.loop)
|
||||
|
@ -418,7 +418,7 @@ pyasn1-modules==0.0.8
|
||||
pyasn1==0.2.2
|
||||
|
||||
# homeassistant.components.media_player.apple_tv
|
||||
pyatv==0.0.1
|
||||
pyatv==0.1.1
|
||||
|
||||
# homeassistant.components.device_tracker.bbox
|
||||
# homeassistant.components.sensor.bbox
|
||||
|
Loading…
x
Reference in New Issue
Block a user