def setup_platform(hass, config, add_devices, discovery_info=None):
"""Set up the MyQ garage door."""
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
logger = logging.getLogger(__name__)
if username is None or password is None:
logger.error("MyQ Cover - Missing username or password.")
return
try:
brand = BRAND_MAPPINGS[config.get(CONF_BRAND)];
except KeyError:
logger.error("MyQ Cover - Missing or unsupported brand. Supported brands: %s", ', '.join(SUPPORTED_BRANDS))
return
myq = MyQAPI(username, password, brand, logger)
add_devices(MyQCoverDevice(myq, door) for door in myq.get_garage_doors())
评论列表
文章目录