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."""
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):

View File

@ -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": []

View File

@ -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