myq.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:Home-Assistant 作者: jmart518 项目源码 文件源码
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())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号