Example #1
0
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)
Example #2
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure platform."""
    alarms = []
    if int(hub.config.get(CONF_ALARM, 1)):
        hub.update_overview()
        alarms.append(VerisureAlarm())
    add_entities(alarms)
Example #3
0
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)
Example #4
0
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)
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Verisure binary sensors."""
    sensors = []
    hub.update_overview()

    if int(hub.config.get(CONF_DOOR_WINDOW, 1)):
        sensors.extend([
            VerisureDoorWindowSensor(device_label) for device_label in hub.get(
                "$.doorWindow.doorWindowDevice[*].deviceLabel")
        ])
    add_devices(sensors)
Example #6
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure binary sensors."""
    sensors = []
    hub.update_overview()

    if int(hub.config.get(CONF_DOOR_WINDOW, 1)):
        sensors.extend([
            VerisureDoorWindowSensor(device_label)
            for device_label in hub.get(
                "$.doorWindow.doorWindowDevice[*].deviceLabel")])
    add_entities(sensors)
Example #7
0
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)
Example #8
0
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)
Example #9
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure 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)
Example #10
0
 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")
Example #11
0
 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")
Example #12
0
def setup_platform(hass, config, add_devices, 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_devices(smartcams)
Example #13
0
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)
Example #14
0
 def update(self):
     """Update lock status."""
     if time() - self._change_timestamp < 10:
         return
     hub.update_overview()
     status = hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].lockedState",
         self._device_label)
     if status == 'UNLOCKED':
         self._state = STATE_UNLOCKED
     elif status == 'LOCKED':
         self._state = STATE_LOCKED
     elif status != 'PENDING':
         _LOGGER.error('Unknown lock state %s', status)
     self._changed_by = hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].userString",
         self._device_label)
Example #15
0
 def update(self):
     """Update lock status."""
     if time() - self._change_timestamp < 10:
         return
     hub.update_overview()
     status = hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].lockedState",
         self._device_label)
     if status == 'UNLOCKED':
         self._state = STATE_UNLOCKED
     elif status == 'LOCKED':
         self._state = STATE_LOCKED
     elif status != 'PENDING':
         _LOGGER.error('Unknown lock state %s', status)
     self._changed_by = hub.get_first(
         "$.doorLockStatusList[?(@.deviceLabel=='%s')].userString",
         self._device_label)
Example #16
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Verisure platform."""
    sensors = []
    hub.update_overview()

    if int(hub.config.get(CONF_THERMOMETERS, 1)):
        sensors.extend([
            VerisureThermometer(device_label) for device_label in hub.get(
                '$.climateValues[?(@.temperature)].deviceLabel')
        ])

    if int(hub.config.get(CONF_HYDROMETERS, 1)):
        sensors.extend([
            VerisureHygrometer(device_label) for device_label in hub.get(
                '$.climateValues[?(@.humidity)].deviceLabel')
        ])

    if int(hub.config.get(CONF_MOUSE, 1)):
        sensors.extend([
            VerisureMouseDetection(device_label) for device_label in hub.get(
                "$.eventCounts[?(@.deviceType=='MOUSE1')].deviceLabel")
        ])

    add_devices(sensors)
Example #17
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the Verisure platform."""
    sensors = []
    hub.update_overview()

    if int(hub.config.get(CONF_THERMOMETERS, 1)):
        sensors.extend([
            VerisureThermometer(device_label)
            for device_label in hub.get(
                '$.climateValues[?(@.temperature)].deviceLabel')])

    if int(hub.config.get(CONF_HYDROMETERS, 1)):
        sensors.extend([
            VerisureHygrometer(device_label)
            for device_label in hub.get(
                '$.climateValues[?(@.humidity)].deviceLabel')])

    if int(hub.config.get(CONF_MOUSE, 1)):
        sensors.extend([
            VerisureMouseDetection(device_label)
            for device_label in hub.get(
                "$.eventCounts[?(@.deviceType=='MOUSE1')].deviceLabel")])

    add_entities(sensors)
 def update(self):
     """Update the state of the sensor."""
     hub.update_overview()
Example #19
0
 def update(self):
     """Get the latest date of the smartplug."""
     hub.update_overview()
Example #20
0
 def update(self):
     """Update the sensor."""
     hub.update_overview()