How to use the zigpy.profiles.zha.DeviceType function in zigpy

To help you get started, we’ve selected a few zigpy 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 home-assistant / home-assistant / tests / components / zha / test_light.py View on Github external
await async_test_level_on_off_from_hass(
        hass, level_device_on_off_cluster, level_device_level_cluster, level_entity_id
    )

    # test turning the lights on and off from the light
    await async_test_on_from_light(hass, level_device_on_off_cluster, level_entity_id)

    # test getting a brightness change from the network
    await async_test_dimmer_from_light(
        hass, level_device_level_cluster, level_entity_id, 150, STATE_ON
    )

    # test adding a new light to the network and HA
    await async_test_device_join(
        hass, zha_gateway, OnOff.cluster_id, DOMAIN, device_type=DeviceType.ON_OFF_LIGHT
    )
github home-assistant / home-assistant / tests / components / zha / test_light.py View on Github external
async def test_light(hass, config_entry, zha_gateway, monkeypatch):
    """Test zha light platform."""
    from zigpy.zcl.clusters.general import OnOff, LevelControl, Basic
    from zigpy.zcl.foundation import Status
    from zigpy.profiles.zha import DeviceType

    # create zigpy devices
    zigpy_device_on_off = await async_init_zigpy_device(
        hass,
        [OnOff.cluster_id, Basic.cluster_id],
        [],
        DeviceType.ON_OFF_LIGHT,
        zha_gateway,
    )

    zigpy_device_level = await async_init_zigpy_device(
        hass,
        [OnOff.cluster_id, LevelControl.cluster_id, Basic.cluster_id],
        [],
        DeviceType.ON_OFF_LIGHT,
        zha_gateway,
        ieee="00:0d:6f:11:0a:90:69:e7",
        manufacturer="FakeLevelManufacturer",
        model="FakeLevelModel",
    )

    # load up light domain
    await hass.config_entries.async_forward_entry_setup(config_entry, DOMAIN)
github home-assistant / home-assistant / homeassistant / components / zha / core / registries.py View on Github external
zcl.clusters.security.IasZone.cluster_id: ZONE,
        }
    )

    DEVICE_CLASS[zigpy.profiles.zha.PROFILE_ID].update(
        {
            SMARTTHINGS_ARRIVAL_SENSOR_DEVICE_TYPE: DEVICE_TRACKER,
            zigpy.profiles.zha.DeviceType.COLOR_DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.COLOR_TEMPERATURE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_BALLAST: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_PLUG_IN_UNIT: LIGHT,
            zigpy.profiles.zha.DeviceType.EXTENDED_COLOR_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.LEVEL_CONTROLLABLE_OUTPUT: LIGHT,
            zigpy.profiles.zha.DeviceType.ON_OFF_BALLAST: SWITCH,
            zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT_SWITCH: SWITCH,
            zigpy.profiles.zha.DeviceType.ON_OFF_PLUG_IN_UNIT: SWITCH,
            zigpy.profiles.zha.DeviceType.SMART_PLUG: SWITCH,
        }
    )

    DEVICE_CLASS[zigpy.profiles.zll.PROFILE_ID].update(
        {
            zigpy.profiles.zll.DeviceType.COLOR_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.COLOR_TEMPERATURE_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.DIMMABLE_PLUGIN_UNIT: LIGHT,
            zigpy.profiles.zll.DeviceType.EXTENDED_COLOR_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.ON_OFF_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.ON_OFF_PLUGIN_UNIT: SWITCH,
        }
github zigpy / zigpy / zigpy / profiles / zha.py View on Github external
# ZLO device types, continued
    COLOR_CONTROLLER = 0x0800
    COLOR_SCENE_CONTROLLER = 0x0810
    NON_COLOR_CONTROLLER = 0x0820
    NON_COLOR_SCENE_CONTROLLER = 0x0830
    CONTROL_BRIDGE = 0x0840
    ON_OFF_SENSOR = 0x0850


CLUSTERS = {
    # Generic
    DeviceType.ON_OFF_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.LEVEL_CONTROL_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.ON_OFF_OUTPUT: ([0x0004, 0x0005, 0x0006], []),
    DeviceType.LEVEL_CONTROLLABLE_OUTPUT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.SCENE_SELECTOR: ([], [0x0004, 0x0005]),
    DeviceType.REMOTE_CONTROL: ([], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.MAIN_POWER_OUTLET: ([0x0004, 0x0005, 0x0006], []),
    DeviceType.SMART_PLUG: ([0x0004, 0x0005, 0x0006], []),
    # Lighting
    DeviceType.ON_OFF_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.COLOR_DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008, 0x0300], []),
    DeviceType.ON_OFF_LIGHT_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.DIMMER_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.COLOR_DIMMER_SWITCH: (
        [0x0007],
        [0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
    ),
    DeviceType.LIGHT_SENSOR: ([0x0400], []),
    DeviceType.OCCUPANCY_SENSOR: ([0x0406], []),
    DeviceType.COLOR_TEMPERATURE_LIGHT: (
github zigpy / zigpy / zigpy / profiles / zha.py View on Github external
COLOR_SCENE_CONTROLLER = 0x0810
    NON_COLOR_CONTROLLER = 0x0820
    NON_COLOR_SCENE_CONTROLLER = 0x0830
    CONTROL_BRIDGE = 0x0840
    ON_OFF_SENSOR = 0x0850


CLUSTERS = {
    # Generic
    DeviceType.ON_OFF_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.LEVEL_CONTROL_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.ON_OFF_OUTPUT: ([0x0004, 0x0005, 0x0006], []),
    DeviceType.LEVEL_CONTROLLABLE_OUTPUT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.SCENE_SELECTOR: ([], [0x0004, 0x0005]),
    DeviceType.REMOTE_CONTROL: ([], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.MAIN_POWER_OUTLET: ([0x0004, 0x0005, 0x0006], []),
    DeviceType.SMART_PLUG: ([0x0004, 0x0005, 0x0006], []),
    # Lighting
    DeviceType.ON_OFF_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.COLOR_DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008, 0x0300], []),
    DeviceType.ON_OFF_LIGHT_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.DIMMER_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.COLOR_DIMMER_SWITCH: (
        [0x0007],
        [0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
    ),
    DeviceType.LIGHT_SENSOR: ([0x0400], []),
    DeviceType.OCCUPANCY_SENSOR: ([0x0406], []),
    DeviceType.COLOR_TEMPERATURE_LIGHT: (
        [0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
        [],
github zigpy / zigpy / zigpy / profiles / zha.py View on Github external
DeviceType.ON_OFF_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.COLOR_DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008, 0x0300], []),
    DeviceType.ON_OFF_LIGHT_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.DIMMER_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.COLOR_DIMMER_SWITCH: (
        [0x0007],
        [0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
    ),
    DeviceType.LIGHT_SENSOR: ([0x0400], []),
    DeviceType.OCCUPANCY_SENSOR: ([0x0406], []),
    DeviceType.COLOR_TEMPERATURE_LIGHT: (
        [0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
        [],
    ),
    DeviceType.EXTENDED_COLOR_LIGHT: (
        [0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
        [],
    ),
    # Closures
    DeviceType.WINDOW_COVERING_DEVICE: ([0x0004, 0x0005, 0x0102], []),
    # HVAC
    DeviceType.THERMOSTAT: ([0x0201, 0x0204], [0x0200, 0x0202, 0x0203]),
}
github zigpy / zigpy / zigpy / appdb.py View on Github external
async def _load_endpoints(self):
        for (ieee, epid, profile_id, device_type, status) in self._scan("endpoints"):
            dev = self._application.get_device(ieee)
            ep = dev.add_endpoint(epid)
            ep.profile_id = profile_id
            ep.device_type = device_type
            if profile_id == 260:
                ep.device_type = zigpy.profiles.zha.DeviceType(device_type)
            elif profile_id == 49246:
                ep.device_type = zigpy.profiles.zll.DeviceType(device_type)
            ep.status = zigpy.endpoint.Status(status)
github home-assistant / home-assistant / homeassistant / components / zha / core / registries.py View on Github external
DEVICE_CLASS[zigpy.profiles.zha.PROFILE_ID].update(
        {
            SMARTTHINGS_ARRIVAL_SENSOR_DEVICE_TYPE: DEVICE_TRACKER,
            zigpy.profiles.zha.DeviceType.COLOR_DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.COLOR_TEMPERATURE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_BALLAST: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_PLUG_IN_UNIT: LIGHT,
            zigpy.profiles.zha.DeviceType.EXTENDED_COLOR_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.LEVEL_CONTROLLABLE_OUTPUT: LIGHT,
            zigpy.profiles.zha.DeviceType.ON_OFF_BALLAST: SWITCH,
            zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT_SWITCH: SWITCH,
            zigpy.profiles.zha.DeviceType.ON_OFF_PLUG_IN_UNIT: SWITCH,
            zigpy.profiles.zha.DeviceType.SMART_PLUG: SWITCH,
        }
    )

    DEVICE_CLASS[zigpy.profiles.zll.PROFILE_ID].update(
        {
            zigpy.profiles.zll.DeviceType.COLOR_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.COLOR_TEMPERATURE_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.DIMMABLE_PLUGIN_UNIT: LIGHT,
            zigpy.profiles.zll.DeviceType.EXTENDED_COLOR_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.ON_OFF_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.ON_OFF_PLUGIN_UNIT: SWITCH,
        }
    )

    SINGLE_INPUT_CLUSTER_DEVICE_CLASS.update(
github zigpy / zigpy / zigpy / profiles / zha.py View on Github external
CLUSTERS = {
    # Generic
    DeviceType.ON_OFF_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.LEVEL_CONTROL_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.ON_OFF_OUTPUT: ([0x0004, 0x0005, 0x0006], []),
    DeviceType.LEVEL_CONTROLLABLE_OUTPUT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.SCENE_SELECTOR: ([], [0x0004, 0x0005]),
    DeviceType.REMOTE_CONTROL: ([], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.MAIN_POWER_OUTLET: ([0x0004, 0x0005, 0x0006], []),
    DeviceType.SMART_PLUG: ([0x0004, 0x0005, 0x0006], []),
    # Lighting
    DeviceType.ON_OFF_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008], []),
    DeviceType.COLOR_DIMMABLE_LIGHT: ([0x0004, 0x0005, 0x0006, 0x0008, 0x0300], []),
    DeviceType.ON_OFF_LIGHT_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006]),
    DeviceType.DIMMER_SWITCH: ([0x0007], [0x0004, 0x0005, 0x0006, 0x0008]),
    DeviceType.COLOR_DIMMER_SWITCH: (
        [0x0007],
        [0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
    ),
    DeviceType.LIGHT_SENSOR: ([0x0400], []),
    DeviceType.OCCUPANCY_SENSOR: ([0x0406], []),
    DeviceType.COLOR_TEMPERATURE_LIGHT: (
        [0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
        [],
    ),
    DeviceType.EXTENDED_COLOR_LIGHT: (
        [0x0003, 0x0004, 0x0005, 0x0006, 0x0008, 0x0300],
        [],
    ),
    # Closures
    DeviceType.WINDOW_COVERING_DEVICE: ([0x0004, 0x0005, 0x0102], []),
github home-assistant / home-assistant / homeassistant / components / zha / core / registries.py View on Github external
BINARY_SENSOR_TYPES.update(
        {
            SMARTTHINGS_ACCELERATION_CLUSTER: SENSOR_ACCELERATION,
            zcl.clusters.general.OnOff.cluster_id: SENSOR_OPENING,
            zcl.clusters.measurement.OccupancySensing.cluster_id: SENSOR_OCCUPANCY,
            zcl.clusters.security.IasZone.cluster_id: ZONE,
        }
    )

    DEVICE_CLASS[zigpy.profiles.zha.PROFILE_ID].update(
        {
            SMARTTHINGS_ARRIVAL_SENSOR_DEVICE_TYPE: DEVICE_TRACKER,
            zigpy.profiles.zha.DeviceType.COLOR_DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.COLOR_TEMPERATURE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_BALLAST: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.DIMMABLE_PLUG_IN_UNIT: LIGHT,
            zigpy.profiles.zha.DeviceType.EXTENDED_COLOR_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.LEVEL_CONTROLLABLE_OUTPUT: LIGHT,
            zigpy.profiles.zha.DeviceType.ON_OFF_BALLAST: SWITCH,
            zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT: LIGHT,
            zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT_SWITCH: SWITCH,
            zigpy.profiles.zha.DeviceType.ON_OFF_PLUG_IN_UNIT: SWITCH,
            zigpy.profiles.zha.DeviceType.SMART_PLUG: SWITCH,
        }
    )

    DEVICE_CLASS[zigpy.profiles.zll.PROFILE_ID].update(
        {
            zigpy.profiles.zll.DeviceType.COLOR_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.COLOR_TEMPERATURE_LIGHT: LIGHT,
            zigpy.profiles.zll.DeviceType.DIMMABLE_LIGHT: LIGHT,