Issue 6749 updated pylgtv to 0.1.6 to fix thread leak in asyncio loop (#7199)
* updated pylgtv module to fix problems with timeouts * - update pylgtv to 0.1.6 - handle new TimeoutError exception from pylgtv * used full name for exception handling of concurrent.futures._base.TimeoutError * the exception handling should now follow the rules * float typecasting should not be necessary * use asyncio for TimeoutError it’s an alias for concurrent.futures.TimeoutErrorpull/7197/head
parent
b641f6863c
commit
dafbdbd2d0
|
@ -5,6 +5,7 @@ For more details about this platform, please refer to the documentation at
|
|||
https://home-assistant.io/components/media_player.webostv/
|
||||
"""
|
||||
import logging
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
@ -24,7 +25,7 @@ from homeassistant.const import (
|
|||
from homeassistant.loader import get_component
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['pylgtv==0.1.5',
|
||||
REQUIREMENTS = ['pylgtv==0.1.6',
|
||||
'websockets==3.2',
|
||||
'wakeonlan==0.2.2']
|
||||
|
||||
|
@ -99,7 +100,8 @@ def setup_tv(host, mac, name, customize, config, hass, add_devices):
|
|||
_LOGGER.warning(
|
||||
"Connected to LG webOS TV %s but not paired", host)
|
||||
return
|
||||
except (OSError, ConnectionClosed):
|
||||
except (OSError, ConnectionClosed, TypeError,
|
||||
asyncio.TimeoutError):
|
||||
_LOGGER.error("Unable to connect to host %s", host)
|
||||
return
|
||||
else:
|
||||
|
@ -196,7 +198,8 @@ class LgWebOSDevice(MediaPlayerDevice):
|
|||
app = self._app_list[source['appId']]
|
||||
self._source_list[app['title']] = app
|
||||
|
||||
except (OSError, ConnectionClosed):
|
||||
except (OSError, ConnectionClosed, TypeError,
|
||||
asyncio.TimeoutError):
|
||||
self._state = STATE_OFF
|
||||
|
||||
@property
|
||||
|
@ -257,7 +260,8 @@ class LgWebOSDevice(MediaPlayerDevice):
|
|||
self._state = STATE_OFF
|
||||
try:
|
||||
self._client.power_off()
|
||||
except (OSError, ConnectionClosed):
|
||||
except (OSError, ConnectionClosed, TypeError,
|
||||
asyncio.TimeoutError):
|
||||
pass
|
||||
|
||||
def turn_on(self):
|
||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.components.notify import (
|
|||
ATTR_DATA, BaseNotificationService, PLATFORM_SCHEMA)
|
||||
from homeassistant.const import (CONF_FILENAME, CONF_HOST, CONF_ICON)
|
||||
|
||||
REQUIREMENTS = ['pylgtv==0.1.5']
|
||||
REQUIREMENTS = ['pylgtv==0.1.6']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -564,7 +564,7 @@ pylast==1.8.0
|
|||
|
||||
# homeassistant.components.media_player.webostv
|
||||
# homeassistant.components.notify.webostv
|
||||
pylgtv==0.1.5
|
||||
pylgtv==0.1.6
|
||||
|
||||
# homeassistant.components.litejet
|
||||
pylitejet==0.1
|
||||
|
|
Loading…
Reference in New Issue