mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
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:
parent
86347a3d5f
commit
86b204df0e
@ -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):
|
||||
|
@ -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": []
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user