From 401263519df50b074eb51d1069b32c85b46a6d6e Mon Sep 17 00:00:00 2001 From: Josh Anderson Date: Mon, 13 Feb 2017 21:29:18 +0000 Subject: [PATCH] Only try to pair notify.webostv when not paired (#5967) This allows the notify.webostv component to successfully register when the TV is not currently powered on as long as a pairing record exists. --- homeassistant/components/notify/webostv.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/notify/webostv.py b/homeassistant/components/notify/webostv.py index edaab1b5521..476f7b9053e 100644 --- a/homeassistant/components/notify/webostv.py +++ b/homeassistant/components/notify/webostv.py @@ -34,14 +34,15 @@ def get_service(hass, config, discovery_info=None): path = hass.config.path(config.get(CONF_FILENAME)) client = WebOsClient(config.get(CONF_HOST), key_file_path=path) - try: - client.register() - except PyLGTVPairException: - _LOGGER.error("Pairing with TV failed") - return None - except OSError: - _LOGGER.error("TV unreachable") - return None + if not client.is_registered(): + try: + client.register() + except PyLGTVPairException: + _LOGGER.error("Pairing with TV failed") + return None + except OSError: + _LOGGER.error("TV unreachable") + return None return LgWebOSNotificationService(client)