当前位置: 首页>>代码示例>>Python>>正文


Python verisure.HUB类代码示例

本文整理汇总了Python中homeassistant.components.verisure.HUB的典型用法代码示例。如果您正苦于以下问题:Python HUB类的具体用法?Python HUB怎么用?Python HUB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HUB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_platform

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Verisure platform."""
    alarms = []
    if int(hub.config.get(CONF_ALARM, 1)):
        hub.update_overview()
        alarms.append(VerisureAlarm())
    add_devices(alarms)
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:7,代码来源:verisure.py

示例2: check_imagelist

    def check_imagelist(self):
        """Check the contents of the image list."""
        hub.update_smartcam_imagelist()
        if (self._device_id not in hub.smartcam_dict or
                not hub.smartcam_dict[self._device_id]):
            return
        images = hub.smartcam_dict[self._device_id]
        new_image_id = images[0]
        _LOGGER.debug('self._device_id=%s, self._images=%s, '
                      'self._new_image_id=%s', self._device_id,
                      images, new_image_id)
        if (new_image_id == '-1' or
                self._image_id == new_image_id):
            _LOGGER.debug('The image is the same, or loading image_id')
            return
        _LOGGER.debug('Download new image %s', new_image_id)
        hub.my_pages.smartcam.download_image(self._device_id,
                                             new_image_id,
                                             self._directory_path)
        _LOGGER.debug('Old image_id=%s', self._image_id)
        self.delete_image(self)

        self._image_id = new_image_id
        self._image = os.path.join(self._directory_path,
                                   '{}{}'.format(
                                       self._image_id,
                                       '.jpg'))
开发者ID:DavidLP,项目名称:home-assistant,代码行数:27,代码来源:verisure.py

示例3: setup_platform

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Verisure platform."""
    alarms = []
    if int(hub.config.get("alarm", "1")):
        hub.update_alarms()
        alarms.extend([VerisureAlarm(value.id) for value in hub.alarm_status.values()])
    add_devices(alarms)
开发者ID:hcchu,项目名称:home-assistant,代码行数:7,代码来源:verisure.py

示例4: setup_platform

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Verisure platform."""
    locks = []
    if int(hub.config.get("locks", "1")):
        hub.update_locks()
        locks.extend([VerisureDoorlock(device_id) for device_id in hub.lock_status.keys()])
    add_devices(locks)
开发者ID:rhooper,项目名称:home-assistant,代码行数:7,代码来源:verisure.py

示例5: update

    def update(self):
        """Update lock status."""
        hub.update_locks()

        if hub.lock_status[self._id].status == "unlocked":
            self._state = STATE_UNLOCKED
        elif hub.lock_status[self._id].status == "locked":
            self._state = STATE_LOCKED
        elif hub.lock_status[self._id].status != "pending":
            _LOGGER.error("Unknown lock state %s", hub.lock_status[self._id].status)
开发者ID:rhooper,项目名称:home-assistant,代码行数:10,代码来源:verisure.py

示例6: setup_platform

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Verisure switch platform."""
    if not int(hub.config.get('smartplugs', '1')):
        return False

    hub.update_smartplugs()
    switches = []
    switches.extend([
        VerisureSmartplug(value.deviceLabel)
        for value in hub.smartplug_status.values()])
    add_devices(switches)
开发者ID:12-hak,项目名称:hak-assistant,代码行数:11,代码来源:verisure.py

示例7: setup_platform

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure switch platform."""
    if not int(hub.config.get(CONF_SMARTPLUGS, 1)):
        return False

    hub.update_overview()
    switches = []
    switches.extend([
        VerisureSmartplug(device_label)
        for device_label in hub.get('$.smartPlugs[*].deviceLabel')])
    add_entities(switches)
开发者ID:EarthlingRich,项目名称:home-assistant,代码行数:11,代码来源:verisure.py

示例8: set_arm_state

def set_arm_state(state, code=None):
    """Send set arm state command."""
    transaction_id = hub.session.set_arm_state(code, state)[
        'armStateChangeTransactionId']
    _LOGGER.info('verisure set arm state %s', state)
    transaction = {}
    while 'result' not in transaction:
        sleep(0.5)
        transaction = hub.session.get_arm_state_transaction(transaction_id)
    # pylint: disable=unexpected-keyword-arg
    hub.update_overview(no_throttle=True)
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:11,代码来源:verisure.py

示例9: setup_platform

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure lock platform."""
    locks = []
    if int(hub.config.get(CONF_LOCKS, 1)):
        hub.update_overview()
        locks.extend([
            VerisureDoorlock(device_label)
            for device_label in hub.get(
                "$.doorLockStatusList[*].deviceLabel")])

    add_entities(locks)
开发者ID:arsaboo,项目名称:home-assistant,代码行数:11,代码来源:lock.py

示例10: update

    def update(self):
        """ Update lock status """
        hub.update_locks()

        if hub.lock_status[self._id].status == 'unlocked':
            self._state = STATE_UNLOCKED
        elif hub.lock_status[self._id].status == 'locked':
            self._state = STATE_LOCKED
        elif hub.lock_status[self._id].status != 'pending':
            _LOGGER.error(
                'Unknown lock state %s',
                hub.lock_status[self._id].status)
开发者ID:100dayproject,项目名称:home-assistant,代码行数:12,代码来源:verisure.py

示例11: update

    def update(self):
        """Update lock status."""
        hub.update_locks()

        if hub.lock_status[self._id].status == 'unlocked':
            self._state = STATE_UNLOCKED
        elif hub.lock_status[self._id].status == 'locked':
            self._state = STATE_LOCKED
        elif hub.lock_status[self._id].status != 'pending':
            _LOGGER.error(
                "Unknown lock state %s", hub.lock_status[self._id].status)
        self._changed_by = hub.lock_status[self._id].name
开发者ID:compvter,项目名称:home-assistant,代码行数:12,代码来源:verisure.py

示例12: update

    def update(self):
        """Update alarm status."""
        hub.update_alarms()

        if hub.alarm_status[self._id].status == "unarmed":
            self._state = STATE_ALARM_DISARMED
        elif hub.alarm_status[self._id].status == "armedhome":
            self._state = STATE_ALARM_ARMED_HOME
        elif hub.alarm_status[self._id].status == "armed":
            self._state = STATE_ALARM_ARMED_AWAY
        elif hub.alarm_status[self._id].status != "pending":
            _LOGGER.error("Unknown alarm state %s", hub.alarm_status[self._id].status)
        self._changed_by = hub.alarm_status[self._id].name
开发者ID:hcchu,项目名称:home-assistant,代码行数:13,代码来源:verisure.py

示例13: update

 def update(self):
     """Update alarm status."""
     hub.update_overview()
     status = hub.get_first("$.armState.statusType")
     if status == 'DISARMED':
         self._state = STATE_ALARM_DISARMED
     elif status == 'ARMED_HOME':
         self._state = STATE_ALARM_ARMED_HOME
     elif status == 'ARMED_AWAY':
         self._state = STATE_ALARM_ARMED_AWAY
     elif status != 'PENDING':
         _LOGGER.error('Unknown alarm state %s', status)
     self._changed_by = hub.get_first("$.armState.name")
开发者ID:BaptisteSim,项目名称:home-assistant,代码行数:13,代码来源:verisure.py

示例14: setup_platform

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Camera."""
    if not int(hub.config.get(CONF_SMARTCAM, 1)):
        return False
    directory_path = hass.config.config_dir
    if not os.access(directory_path, os.R_OK):
        _LOGGER.error("file path %s is not readable", directory_path)
        return False
    hub.update_smartcam()
    smartcams = []
    smartcams.extend([
        VerisureSmartcam(hass, value.deviceLabel, directory_path)
        for value in hub.smartcam_status.values()])
    add_devices(smartcams)
开发者ID:DavidLP,项目名称:home-assistant,代码行数:14,代码来源:verisure.py

示例15: setup_platform

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure Camera."""
    if not int(hub.config.get(CONF_SMARTCAM, 1)):
        return False
    directory_path = hass.config.config_dir
    if not os.access(directory_path, os.R_OK):
        _LOGGER.error("file path %s is not readable", directory_path)
        return False
    hub.update_overview()
    smartcams = []
    smartcams.extend([
        VerisureSmartcam(hass, device_label, directory_path)
        for device_label in hub.get(
            "$.customerImageCameras[*].deviceLabel")])
    add_entities(smartcams)
开发者ID:arsaboo,项目名称:home-assistant,代码行数:15,代码来源:camera.py


注:本文中的homeassistant.components.verisure.HUB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。