WebOS component fixes

* fixed some exceptions

* add requirements to notify

* added optimistic state to power off

* run requirements script
This commit is contained in:
Dennis Karpienski 2016-04-22 02:35:56 +02:00 committed by Paulus Schoutsen
parent 3318c55c65
commit 2333c0ca3b
3 changed files with 10 additions and 4 deletions

View file

@ -69,7 +69,7 @@ def setup_tv(host, hass, add_devices):
_LOGGER.warning(
'Connected to LG WebOS TV at %s but not paired.', host)
return
except ConnectionRefusedError:
except OSError:
_LOGGER.error('Unable to connect to host %s.', host)
return
else:
@ -158,7 +158,7 @@ class LgWebOSDevice(MediaPlayerDevice):
if source['appId'] == self._current_source_id:
self._current_source = source['label']
except ConnectionRefusedError:
except OSError:
self._state = STATE_OFF
@property
@ -208,6 +208,7 @@ class LgWebOSDevice(MediaPlayerDevice):
def turn_off(self):
"""Turn off media player."""
self._state = STATE_OFF
self._client.power_off()
def volume_up(self):

View file

@ -10,6 +10,10 @@ from homeassistant.components.notify import (BaseNotificationService, DOMAIN)
from homeassistant.const import (CONF_HOST, CONF_NAME)
from homeassistant.helpers import validate_config
REQUIREMENTS = ['https://github.com/TheRealLink/pylgtv'
'/archive/v0.1.2.zip'
'#pylgtv==0.1.2']
_LOGGER = logging.getLogger(__name__)
@ -35,7 +39,7 @@ def get_service(hass, config):
except PyLGTVPairException:
_LOGGER.error('Pairing failed.')
return None
except ConnectionRefusedError:
except OSError:
_LOGGER.error('Host unreachable.')
return None
@ -58,5 +62,5 @@ class LgWebOSNotificationService(BaseNotificationService):
self._client.send_message(message)
except PyLGTVPairException:
_LOGGER.error('Pairing failed.')
except ConnectionRefusedError:
except OSError:
_LOGGER.error('Host unreachable.')

View file

@ -80,6 +80,7 @@ https://github.com/HydrelioxGitHub/netatmo-api-python/archive/43ff238a0122b0939a
https://github.com/LinuxChristian/pyW215/archive/v0.1.1.zip#pyW215==0.1.1
# homeassistant.components.media_player.webostv
# homeassistant.components.notify.webostv
https://github.com/TheRealLink/pylgtv/archive/v0.1.2.zip#pylgtv==0.1.2
# homeassistant.components.sensor.thinkingcleaner