Fix myq increasing number of network connections (#22432)

* Fix for network issues

Fix for network issues

* Further changes to network connection

* websession is created in pymyq

websession is created in pymyq instead.
Added call on stop event to close web session.

* Updated requirements file

* Added comment

* Changed back to use aiohttp_client

* Cleanup closed sockets in aiohttp

Enable automatic cleanup of closed sockets in aiohttp client helper.

* Updated manifest & requirements

* Updated comment block
This commit is contained in:
ehendrix23 2019-04-10 15:24:12 -06:00 committed by Paulus Schoutsen
parent 38d92b2abf
commit 7862fdd27e
4 changed files with 11 additions and 7 deletions

View file

@ -1,16 +1,17 @@
"""Support for MyQ-Enabled Garage Doors."""
import logging
import voluptuous as vol
from homeassistant.components.cover import (
PLATFORM_SCHEMA, SUPPORT_CLOSE, SUPPORT_OPEN, CoverDevice)
CoverDevice, PLATFORM_SCHEMA, SUPPORT_CLOSE, SUPPORT_OPEN
)
from homeassistant.const import (
CONF_PASSWORD, CONF_TYPE, CONF_USERNAME, STATE_CLOSED, STATE_CLOSING,
STATE_OPEN, STATE_OPENING)
STATE_OPEN, STATE_OPENING
)
from homeassistant.helpers import aiohttp_client, config_validation as cv
REQUIREMENTS = ['pymyq==1.1.0']
REQUIREMENTS = ['pymyq==1.2.0']
_LOGGER = logging.getLogger(__name__)
MYQ_TO_HASS = {

View file

@ -3,7 +3,7 @@
"name": "Myq",
"documentation": "https://www.home-assistant.io/components/myq",
"requirements": [
"pymyq==1.1.0"
"pymyq==1.2.0"
],
"dependencies": [],
"codeowners": []

View file

@ -168,7 +168,10 @@ def _async_get_connector(hass: HomeAssistantType,
else:
ssl_context = False
connector = aiohttp.TCPConnector(loop=hass.loop, ssl=ssl_context)
connector = aiohttp.TCPConnector(loop=hass.loop,
enable_cleanup_closed=True,
ssl=ssl_context,
)
hass.data[key] = connector
async def _async_close_connector(event: Event) -> None:

View file

@ -1160,7 +1160,7 @@ pymonoprice==0.3
pymusiccast==0.1.6
# homeassistant.components.myq
pymyq==1.1.0
pymyq==1.2.0
# homeassistant.components.mysensors
pymysensors==0.18.0