Update pymyq to 2.0.0 (#28069)

* Update pymyq to 2.0.0

* Removed unnecessary update

* Restore `type` parameter (as optional)
This commit is contained in:
Aaron Bach 2019-10-21 14:46:39 -06:00 committed by GitHub
parent 86347a3d5f
commit 86b204df0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 13 deletions

View File

@ -1,5 +1,8 @@
"""Support for MyQ-Enabled Garage Doors.""" """Support for MyQ-Enabled Garage Doors."""
import logging import logging
from pymyq import login
from pymyq.errors import MyQError
import voluptuous as vol import voluptuous as vol
from homeassistant.components.cover import ( from homeassistant.components.cover import (
@ -30,35 +33,29 @@ MYQ_TO_HASS = {
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{ {
vol.Required(CONF_TYPE): cv.string,
vol.Required(CONF_USERNAME): cv.string, vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): 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): async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the platform.""" """Set up the platform."""
from pymyq import login
from pymyq.errors import MyQError, UnsupportedBrandError
websession = aiohttp_client.async_get_clientsession(hass) websession = aiohttp_client.async_get_clientsession(hass)
username = config[CONF_USERNAME] username = config[CONF_USERNAME]
password = config[CONF_PASSWORD] password = config[CONF_PASSWORD]
brand = config[CONF_TYPE]
try: try:
myq = await login(username, password, brand, websession) myq = await login(username, password, websession)
except UnsupportedBrandError:
_LOGGER.error("Unsupported brand: %s", brand)
return
except MyQError as err: except MyQError as err:
_LOGGER.error("There was an error while logging in: %s", err) _LOGGER.error("There was an error while logging in: %s", err)
return return
devices = await myq.get_devices() async_add_entities([MyQDevice(device) for device in myq.covers.values()], True)
async_add_entities([MyQDevice(device) for device in devices], True)
class MyQDevice(CoverDevice): class MyQDevice(CoverDevice):

View File

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

View File

@ -1322,7 +1322,7 @@ pymonoprice==0.3
pymusiccast==0.1.6 pymusiccast==0.1.6
# homeassistant.components.myq # homeassistant.components.myq
pymyq==1.2.1 pymyq==2.0.0
# homeassistant.components.mysensors # homeassistant.components.mysensors
pymysensors==0.18.0 pymysensors==0.18.0