How to use the pydeconz.sensor.Thermostat function in pydeconz

To help you get started, we’ve selected a few pydeconz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kane610 / deconz / pydeconz / sensor.py View on Github external
Battery,
    CarbonMonoxide,
    Consumption,
    Daylight,
    Fire,
    GenericFlag,
    GenericStatus,
    Humidity,
    LightLevel,
    OpenClose,
    Power,
    Presence,
    Pressure,
    Switch,
    Temperature,
    Thermostat,
    Vibration,
    Water,
)


def create_sensor(sensor_id, raw, request):
    """Simplify creating sensor by not needing to know type."""
    for sensor_class in SENSOR_CLASSES:
        if raw["type"] in sensor_class.ZHATYPE:
            return sensor_class(sensor_id, raw, request)

    _LOGGER.info("Unsupported sensor type %s (%s)", raw["type"], raw["name"])
    return DeconzSensor(sensor_id, raw, request)
github home-assistant / home-assistant / homeassistant / components / deconz / climate.py View on Github external
def async_add_climate(sensors, new=True):
        """Add climate devices from deCONZ."""
        entities = []

        for sensor in sensors:

            if new and sensor.type in Thermostat.ZHATYPE:
                entities.append(DeconzThermostat(sensor, gateway))

        async_add_entities(entities, True)
github home-assistant / home-assistant / homeassistant / components / deconz / sensor.py View on Github external
If new is false it means an existing sensor has got a battery state reported.
        """
        entities = []

        for sensor in sensors:

            if new and sensor.type in Switch.ZHATYPE:

                if gateway.option_allow_clip_sensor or not sensor.type.startswith(
                    "CLIP"
                ):
                    new_event = DeconzEvent(sensor, gateway)
                    hass.async_create_task(new_event.async_update_device_registry())
                    gateway.events.append(new_event)

            elif new and not sensor.BINARY and sensor.type not in Thermostat.ZHATYPE:

                new_sensor = DeconzSensor(sensor, gateway)
                entity_handler.add_entity(new_sensor)
                entities.append(new_sensor)

            if sensor.battery is not None:
                new_battery = DeconzBattery(sensor, gateway)
                if new_battery.unique_id not in batteries:
                    batteries.add(new_battery.unique_id)
                    entities.append(new_battery)
                    battery_handler.remove_tracker(sensor)
            else:
                battery_handler.create_tracker(sensor)

        async_add_entities(entities, True)