How to use the bellows.zigbee.zcl.Cluster function in bellows

To help you get started, we’ve selected a few bellows 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 zigpy / bellows / tests / test_zcl.py View on Github external
def test_unknown_cluster():
    c = zcl.Cluster.from_id(None, 999)
    assert isinstance(c, zcl.Cluster)
    assert c.cluster_id == 999
github zigpy / bellows / tests / test_zcl_clusters.py View on Github external
def test_time_cluster():
    ep = mock.MagicMock()
    ep.device = mock.MagicMock()
    t = zcl.Cluster._registry[0x000a](ep)

    aps_frame = 0
    tsn = 0

    t.handle_cluster_request(aps_frame, tsn, 1, [[0]])
    assert ep.device.reply.call_count == 0

    t.handle_cluster_request(aps_frame, tsn, 0, [[0]])
    assert ep.device.reply.call_count == 1
    assert ep.device.reply.call_args[0][1][3] == 0

    t.handle_cluster_request(aps_frame, tsn, 0, [[1]])
    assert ep.device.reply.call_count == 2
    assert ep.device.reply.call_args[0][1][3] == 1

    t.handle_cluster_request(aps_frame, tsn, 0, [[2]])
github zigpy / bellows / bellows / zigbee / zcl / clusters / general.py View on Github external
0x002e: ('inactive_text', t.LVBytes),
        0x0042: ('minimum_off_time', t.uint32_t),
        0x0043: ('minimum_on_time', t.uint32_t),
        0x0051: ('out_of_service', t.Bool),
        0x0055: ('present_value', t.Single),
        # 0x0057: ('priority_array', TODO.array),  # Array of 16 structures of (boolean, single precision)
        0x0067: ('reliability', t.uint8_t),  # enum8
        0x0068: ('relinquish_default', t.Single),
        0x006f: ('status_flags', t.uint8_t),  # bitmap8
        0x0100: ('application_type', t.uint32_t),
    }
    server_commands = {}
    client_commands = {}


class MultistateInput(Cluster):
    cluster_id = 0x0012
    ep_attribute = 'multistate_input'
    attributes = {
        0x000e: ('state_text', t.List(t.LVBytes)),
        0x001c: ('description', t.LVBytes),
        0x004a: ('number_of_states', t.uint16_t),
        0x0051: ('out_of_service', t.Bool),
        0x0055: ('present_value', t.Single),
        # 0x0057: ('priority_array', TODO.array),  # Array of 16 structures of (boolean, single precision)
        0x0067: ('reliability', t.uint8_t),  # enum8
        0x006f: ('status_flags', t.uint8_t),  # bitmap8
        0x0100: ('application_type', t.uint32_t),
    }
    server_commands = {}
    client_commands = {}
github zigpy / bellows / bellows / zigbee / zcl / clusters / security.py View on Github external
0x0009: ('get_zone_status', (), False),
    }
    client_commands = {
        0x0000: ('arm_response', (), True),
        0x0001: ('get_zone_id_map_response', (), True),
        0x0002: ('get_zone_info_response', (), True),
        0x0003: ('zone_status_changed', (), False),
        0x0004: ('panel_status_changed', (), False),
        0x0005: ('panel_status_response', (), True),
        0x0006: ('set_bypassed_zone_list', (), False),
        0x0007: ('bypass_response', (), True),
        0x0008: ('get_zone_status_response', (), True),
    }


class IasWd(Cluster):
    cluster_id = 0x0502
    name = 'IAS Warning Device'
    ep_attribute = 'ias_wd'
    attributes = {
        0x0000: ('max_duration', t.uint16_t),
    }
    server_commands = {
        0x0000: ('start_warning', (), False),
        0x0001: ('squawk', (), False),
    }
    client_commands = {}
github zigpy / bellows / bellows / zigbee / zcl / clusters / smartenergy.py View on Github external
0x0001: ('req_mirror_response', (), True),
        0x0002: ('mirror_rem_response', (), True),
        0x0003: ('req_fast_poll_mode_response', (), True),
        0x0004: ('get_snapshot_response', (), True),
    }


class Messaging(Cluster):
    cluster_id = 0x0703
    ep_attribute = 'smartenergy_messaging'
    attributes = {}
    server_commands = {}
    client_commands = {}


class Tunneling(Cluster):
    cluster_id = 0x0704
    ep_attribute = 'smartenergy_tunneling'
    attributes = {}
    server_commands = {}
    client_commands = {}


class Prepayment(Cluster):
    cluster_id = 0x0705
    ep_attribute = 'smartenergy_prepayment'
    attributes = {}
    server_commands = {}
    client_commands = {}


class EnergyManagement(Cluster):
github zigpy / bellows / bellows / zigbee / zcl / clusters / protocol.py View on Github external
cluster_id = 0x0602
    ep_attribute = 'bacnet_regular_analog_input'
    attributes = {
        0x0016: ('cov_increment', t.Single),
        0x001f: ('device_type', t.LVBytes),
        0x004b: ('object_id', t.fixed_list(4, t.uint8_t)),
        0x004d: ('object_name', t.LVBytes),
        0x004f: ('object_type', t.uint16_t),  # enum16
        0x0076: ('update_interval', t.uint8_t),
        0x00a8: ('profile_name', t.LVBytes),
    }
    server_commands = {}
    client_commands = {}


class AnalogInputExtended(Cluster):
    cluster_id = 0x0603
    ep_attribute = 'bacnet_extended_analog_input'
    attributes = {
        0x0000: ('acked_transitions', t.uint8_t),  # bitmap8
        0x0011: ('notification_class', t.uint16_t),
        0x0019: ('deadband', t.Single),
        0x0023: ('event_enable', t.uint8_t),  # bitmap8
        0x0024: ('event_state', t.uint8_t),  # enum8
        0x002d: ('high_limit', t.Single),
        0x0034: ('limit_enable', t.uint8_t),  # bitmap8
        0x003b: ('low_limit', t.Single),
        0x0048: ('notify_type', t.uint8_t),  # enum8
        0x0071: ('time_delay', t.uint8_t),
        # 0x0082: ('event_time_stamps', TODO.array),  # Array[3] of (16-bit unsigned integer, time of day, or structure of (date, time of day))
    }
    server_commands = {
github zigpy / bellows / bellows / zigbee / zcl / clusters / protocol.py View on Github external
0x0010: ('change_of_state_time', DateTime),
        0x001f: ('device_type', t.LVBytes),
        0x0021: ('elapsed_active_time', t.uint32_t),
        0x0028: ('feed_back_value', t.uint8_t),  # enum8
        0x004b: ('object_id', t.fixed_list(4, t.uint8_t)),
        0x004d: ('object_name', t.LVBytes),
        0x004f: ('object_type', t.uint16_t),  # enum16
        0x0072: ('time_of_at_reset', DateTime),
        0x0073: ('time_of_sc_reset', DateTime),
        0x00a8: ('profile_name', t.LVBytes),
    }
    server_commands = {}
    client_commands = {}


class BinaryOutputExtended(Cluster):
    cluster_id = 0x060b
    ep_attribute = 'bacnet_extended_binary_output'
    attributes = {
        0x0000: ('acked_transitions', t.uint8_t),  # bitmap8
        0x0011: ('notification_class', t.uint16_t),
        0x0023: ('event_enable', t.uint8_t),  # bitmap8
        0x0024: ('event_state', t.uint8_t),  # enum8
        0x0048: ('notify_type', t.uint8_t),  # enum8
        0x0071: ('time_delay', t.uint8_t),
        # 0x0082: ('event_time_stamps', TODO.array),  # Array[3] of (16-bit unsigned integer, time of day, or structure of (date, time of day))
    }
    server_commands = {}
    client_commands = {}


class BinaryValueRegular(Cluster):
github zigpy / bellows / bellows / zigbee / zcl / clusters / protocol.py View on Github external
class MultistateValueRegular(Cluster):
    cluster_id = 0x0612
    ep_attribute = 'bacnet_regular_multistate_value'
    attributes = {
        0x004b: ('object_id', t.fixed_list(4, t.uint8_t)),
        0x004d: ('object_name', t.LVBytes),
        0x004f: ('object_type', t.uint16_t),  # enum16
        0x00a8: ('profile_name', t.LVBytes),
    }
    server_commands = {}
    client_commands = {}


class MultistateValueExtended(Cluster):
    cluster_id = 0x0613
    ep_attribute = 'bacnet_extended_multistate_value'
    attributes = {
        0x0000: ('acked_transitions', t.uint8_t),  # bitmap8
        0x0006: ('alarm_value', t.uint16_t),
        0x0011: ('notification_class', t.uint16_t),
        0x0023: ('event_enable', t.uint8_t),  # bitmap8
        0x0024: ('event_state', t.uint8_t),  # enum8
        0x0025: ('fault_values', t.uint16_t),
        0x0048: ('notify_type', t.uint8_t),  # enum8
        0x0071: ('time_delay', t.uint8_t),
        # 0x0082: ('event_time_stamps', TODO.array),  # Array[3] of (16-bit unsigned integer, time of day, or structure of (date, time of day))
    }
    server_commands = {}
    client_commands = {}
github zigpy / bellows / bellows / zigbee / zcl / clusters / general.py View on Github external
0x0042: ('copy', (), False),
    }
    client_commands = {
        0x0000: ('add_response', (t.uint8_t, t.uint16_t, t.uint8_t), True),
        0x0001: ('view_response', (t.uint8_t, t.uint16_t, t.uint8_t, ), True),  # + 3 more optionals
        0x0002: ('remove_response', (t.uint8_t, t.uint16_t, t.uint8_t), True),
        0x0003: ('remove_all_response', (t.uint8_t, t.uint16_t), True),
        0x0004: ('store_response', (t.uint8_t, t.uint16_t, t.uint8_t), True),
        0x0006: ('get_scene_membership_response', (t.uint8_t, t.uint8_t, t.uint16_t, t.LVList(t.uint8_t)), True),
        0x0040: ('enhanced_add_response', (), True),
        0x0041: ('enhanced_view_response', (), True),
        0x0042: ('copy_response', (), True),
    }


class OnOff(Cluster):
    """Attributes and commands for switching devices between
    ‘On’ and ‘Off’ states. """
    cluster_id = 0x0006
    name = 'On/Off'
    ep_attribute = 'on_off'
    attributes = {
        0x0000: ('on_off', t.Bool),
        0x4000: ('global_scene_control', t.Bool),
        0x4001: ('on_time', t.uint16_t),
        0x4002: ('off_wait_time', t.uint16_t),
    }
    server_commands = {
        0x0000: ('off', (), False),
        0x0001: ('on', (), False),
        0x0002: ('toggle', (), False),
        0x0040: ('off_with_effect', (), False),
github zigpy / bellows / bellows / zigbee / zcl / clusters / homeautomation.py View on Github external
0x0004: ('data_quality_id', t.uint16_t),
        0x0005: ('customer_name', t.LVBytes),
        0x0006: ('model', t.LVBytes),
        0x0007: ('part_number', t.LVBytes),
        0x0008: ('product_revision', t.LVBytes),
        0x000a: ('software_revision', t.LVBytes),
        0x000b: ('utility_name', t.LVBytes),
        0x000c: ('pod', t.LVBytes),
        0x000d: ('available_power', t.int24s),
        0x000e: ('power_threshold', t.int24s),
    }
    server_commands = {}
    client_commands = {}


class ApplianceEventAlerts(Cluster):
    cluster_id = 0x0b02
    name = 'Appliance Event Alerts'
    ep_attribute = 'appliance_event'
    attributes = {}
    server_commands = {
        0x0000: ('get_alerts', (), False),
    }
    client_commands = {
        0x0000: ('get_alarts_response', (), True),
        0x0001: ('alerts_notification', (), False),
        0x0002: ('event_notification', (), False),
    }


class ApplianceStatistics(Cluster):
    cluster_id = 0x0b03