diff --git a/homeassistant/components/myq/cover.py b/homeassistant/components/myq/cover.py index e9c3237490a..b6da7174f05 100644 --- a/homeassistant/components/myq/cover.py +++ b/homeassistant/components/myq/cover.py @@ -1,5 +1,8 @@ """Support for MyQ-Enabled Garage Doors.""" import logging + +from pymyq import login +from pymyq.errors import MyQError import voluptuous as vol from homeassistant.components.cover import ( @@ -30,35 +33,29 @@ MYQ_TO_HASS = { PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( { - vol.Required(CONF_TYPE): cv.string, vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_PASSWORD): cv.string, + # This parameter is no longer used; keeping it to avoid a breaking change in + # a hotfix, but in a future main release, this should be removed: + vol.Optional(CONF_TYPE): cv.string, } ) async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the platform.""" - from pymyq import login - from pymyq.errors import MyQError, UnsupportedBrandError - websession = aiohttp_client.async_get_clientsession(hass) username = config[CONF_USERNAME] password = config[CONF_PASSWORD] - brand = config[CONF_TYPE] try: - myq = await login(username, password, brand, websession) - except UnsupportedBrandError: - _LOGGER.error("Unsupported brand: %s", brand) - return + myq = await login(username, password, websession) except MyQError as err: _LOGGER.error("There was an error while logging in: %s", err) return - devices = await myq.get_devices() - async_add_entities([MyQDevice(device) for device in devices], True) + async_add_entities([MyQDevice(device) for device in myq.covers.values()], True) class MyQDevice(CoverDevice): diff --git a/homeassistant/components/myq/manifest.json b/homeassistant/components/myq/manifest.json index 213679b320a..73265b61c83 100644 --- a/homeassistant/components/myq/manifest.json +++ b/homeassistant/components/myq/manifest.json @@ -3,7 +3,7 @@ "name": "Myq", "documentation": "https://www.home-assistant.io/integrations/myq", "requirements": [ - "pymyq==1.2.1" + "pymyq==2.0.0" ], "dependencies": [], "codeowners": [] diff --git a/requirements_all.txt b/requirements_all.txt index 982c20e5972..0330d7d8f60 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1322,7 +1322,7 @@ pymonoprice==0.3 pymusiccast==0.1.6 # homeassistant.components.myq -pymyq==1.2.1 +pymyq==2.0.0 # homeassistant.components.mysensors pymysensors==0.18.0