示例#1
0
def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the Verisure platform."""
    sensors = []

    if int(hub.config.get('thermometers', '1')):
        hub.update_climate()
        sensors.extend([
            VerisureThermometer(value.id)
            for value in hub.climate_status.values()
            if hasattr(value, 'temperature') and value.temperature
            ])

    if int(hub.config.get('hygrometers', '1')):
        hub.update_climate()
        sensors.extend([
            VerisureHygrometer(value.id)
            for value in hub.climate_status.values()
            if hasattr(value, 'humidity') and value.humidity
            ])

    if int(hub.config.get('mouse', '1')):
        hub.update_mousedetection()
        sensors.extend([
            VerisureMouseDetection(value.deviceLabel)
            for value in hub.mouse_status.values()
            # is this if needed?
            if hasattr(value, 'amountText') and value.amountText
            ])

    add_devices(sensors)
示例#2
0
 def update(self):
     """Update the sensor."""
     hub.update_mousedetection()