def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Sector Alarm platform."""
    alarms = []
    if int(hub.config.get(CONF_ALARM, 1)):
        hub.update_alarms()
        alarms.append(SectorAlarmAlarm())
    add_devices(alarms)
    def update(self):
        """Update lock status."""
        hub.update_locks()

        if hub.lock_status[self._id]['Status'] == 'unlock':
            self._state = STATE_UNLOCKED
        elif hub.lock_status[self._id]['Status'] == 'lock':
            self._state = STATE_LOCKED
        elif hub.lock_status[self._id]['Status'] != 'pending':
            _LOGGER.error('Unknown lock state %s',
                          hub.lock_status[self._id]['Status'])
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Set up the Sector Alarm platform."""
    locks = []
    if int(hub.config.get(CONF_LOCKS, 1)):
        hub.update_locks()
        locks.extend([
            SectorAlarmDoorlock(device_id)
            for device_id in hub.lock_status.keys()
        ])

    add_devices(locks)
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Sector Alarm platform."""
    sensors = []

    if int(hub.config.get(CONF_THERMOMETERS, 1)):
        hub.update_temperature()
        sensors.extend([
            SectorAlarmThermometer(value['serialNo'])
            for value in hub.temperature_status.values()
        ])
    add_devices(sensors)
    def update(self):
        """Update alarm status."""
        hub.update_alarms()

        if hub.alarm_status[0]['message'] == 'disarmed':
            self._state = STATE_ALARM_DISARMED
        elif hub.alarm_status[0]['message'] == 'armedhome':
            self._state = STATE_ALARM_ARMED_HOME
        elif hub.alarm_status[0]['message'] == 'armed':
            self._state = STATE_ALARM_ARMED_AWAY
        elif hub.alarm_status[0]['message'] != 'pending':
            _LOGGER.error(
                "Unknown alarm state %s", hub.alarm_status[self._id].status)
        self._changed_by = hub.alarm_status[0]['user']
        self._changed_at = hub.alarm_status[0]['timeex']
 def update(self):
     """Update the state of the sensor."""
     hub.update_ethernet()
     self._state = hub.ethernet_status[0]['ethernetStatus']
 def update(self):
     """Update the sensor."""
     hub.update_temperature()