Handle connection errors when connecting to Apple TVs (#5829)

* Handle connection errors when connecting to Apple TVs

Also bump pyatv to 0.1.2 which fixes a request leak.

* Fix pylint error

* Fix import order
pull/5836/head
Pierre Ståhl 2017-02-09 22:25:06 +01:00 committed by Pascal Vizeli
parent c54517de90
commit ecbbb06b2f
2 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import asyncio
import logging
import hashlib
import aiohttp
import voluptuous as vol
from homeassistant.components.media_player import (
@ -21,7 +22,7 @@ import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
REQUIREMENTS = ['pyatv==0.1.1']
REQUIREMENTS = ['pyatv==0.1.2']
_LOGGER = logging.getLogger(__name__)
@ -128,6 +129,8 @@ class AppleTvDevice(MediaPlayerDevice):
self._playing = playing
except exceptions.AuthenticationError as ex:
_LOGGER.warning('%s (bad login id?)', str(ex))
except aiohttp.errors.ClientOSError as ex:
_LOGGER.error('failed to connect to Apple TV (%s)', str(ex))
except asyncio.TimeoutError:
_LOGGER.warning('timed out while connecting to Apple TV')

View File

@ -418,7 +418,7 @@ pyasn1-modules==0.0.8
pyasn1==0.2.2
# homeassistant.components.media_player.apple_tv
pyatv==0.1.1
pyatv==0.1.2
# homeassistant.components.device_tracker.bbox
# homeassistant.components.sensor.bbox