예제 #1
0
파일: lighting.py 프로젝트: mzoworka/zigpy
class Ballast(Cluster):
    """Attributes and commands for configuring a lighting
    ballast"""

    cluster_id = 0x0301
    ep_attribute = "light_ballast"
    attributes: dict[int, ZCLAttributeDef] = {
        # Ballast Information
        0x0000: ("physical_min_level", t.uint8_t),
        0x0001: ("physical_max_level", t.uint8_t),
        0x0002: ("ballast_status", t.bitmap8),
        # Ballast Settings
        0x0010: ("min_level", t.uint8_t),
        0x0011: ("max_level", t.uint8_t),
        0x0012: ("power_on_level", t.uint8_t),
        0x0013: ("power_on_fade_time", t.uint16_t),
        0x0014: ("intrinsic_ballast_factor", t.uint8_t),
        0x0015: ("ballast_factor_adjustment", t.uint8_t),
        # Lamp Information
        0x0020: ("lamp_quantity", t.uint8_t),
        # Lamp Settings
        0x0030: ("lamp_type", t.LimitedCharString(16)),
        0x0031: ("lamp_manufacturer", t.LimitedCharString(16)),
        0x0032: ("lamp_rated_hours", t.uint24_t),
        0x0033: ("lamp_burn_hours", t.uint24_t),
        0x0034: ("lamp_alarm_mode", t.bitmap8),
        0x0035: ("lamp_burn_hours_trip_point", t.uint24_t),
        0xFFFD: ("cluster_revision", t.uint16_t),
        0xFFFE: ("attr_reporting_status", foundation.AttributeReportingStatus),
    }
    server_commands: dict[int, ZCLCommandDef] = {}
    client_commands: dict[int, ZCLCommandDef] = {}
예제 #2
0
class Ballast(Cluster):
    """Attributes and commands for configuring a lighting
    ballast"""
    cluster_id = 0x0301
    ep_attribute = 'light_ballast'
    attributes = {
        # Ballast Information
        0x0000: ('physical_min_level', t.uint8_t),
        0x0001: ('physical_max_level', t.uint8_t),
        0x0002: ('ballast_status', t.bitmap8),
        # Ballast Settings
        0x0010: ('min_level', t.uint8_t),
        0x0011: ('max_level', t.uint8_t),
        0x0012: ('power_on_level', t.uint8_t),
        0x0013: ('power_on_fade_time', t.uint16_t),
        0x0014: ('intrinsic_ballast_factor', t.uint8_t),
        0x0015: ('ballast_factor_adjustment', t.uint8_t),
        # Lamp Information
        0x0020: ('lamp_quantity', t.uint8_t),
        # Lamp Settings
        0x0030: ('lamp_type', t.LimitedCharString(16)),
        0x0031: ('lamp_manufacturer', t.LimitedCharString(16)),
        0x0032: ('lamp_rated_hours', t.uint24_t),
        0x0033: ('lamp_burn_hours', t.uint24_t),
        0x0034: ('lamp_alarm_mode', t.bitmap8),
        0x0035: ('lamp_burn_hours_trip_point', t.uint24_t),
    }
    server_commands = {}
    client_commands = {}
예제 #3
0
파일: general.py 프로젝트: bdrydyk/zigpy
class Basic(Cluster):
    """ Attributes for determining basic information about a
    device, setting user device information such as location,
    and enabling a device.
    """

    cluster_id = 0x0000
    ep_attribute = "basic"
    attributes = {
        # Basic Device Information
        0x0000: ("zcl_version", t.uint8_t),
        0x0001: ("app_version", t.uint8_t),
        0x0002: ("stack_version", t.uint8_t),
        0x0003: ("hw_version", t.uint8_t),
        0x0004: ("manufacturer", t.CharacterString),
        0x0005: ("model", t.CharacterString),
        0x0006: ("date_code", t.CharacterString),
        0x0007: ("power_source", t.enum8),
        0x0008: ("app_profile_version", t.enum8),
        # Basic Device Settings
        0x0010: ("location_desc", t.LimitedCharString(16)),
        0x0011: ("physical_env", t.enum8),
        0x0012: ("device_enabled", t.Bool),
        0x0013: ("alarm_mask", t.bitmap8),
        0x0014: ("disable_local_config", t.bitmap8),
        0x4000: ("sw_build_id", t.CharacterString),
    }
    server_commands = {0x0000: ("reset_fact_default", (), False)}
    client_commands = {}
예제 #4
0
class ApplianceIdentification(Cluster):
    cluster_id = 0x0B00
    name = "Appliance Identification"
    ep_attribute = "appliance_id"
    attributes: dict[int, ZCLAttributeDef] = {
        0x0000: ("basic_identification", t.uint56_t),
        0x0010: ("company_name", t.LimitedCharString(16)),
        0x0011: ("company_id", t.uint16_t),
        0x0012: ("brand_name", t.LimitedCharString(16)),
        0x0013: ("brand_id", t.uint16_t),
        0x0014: ("model", t.LimitedLVBytes(16)),
        0x0015: ("part_number", t.LimitedLVBytes(16)),
        0x0016: ("product_revision", t.LimitedLVBytes(6)),
        0x0017: ("software_revision", t.LimitedLVBytes(6)),
        0x0018: ("product_type_name", t.LVBytesSize2),
        0x0019: ("product_type_id", t.uint16_t),
        0x001A: ("ceced_specification_version", t.uint8_t),
    }
    server_commands: dict[int, ZCLCommandDef] = {}
    client_commands: dict[int, ZCLCommandDef] = {}
예제 #5
0
class MeterIdentification(Cluster):
    cluster_id = 0x0B01
    name = "Meter Identification"
    ep_attribute = "meter_id"
    attributes: dict[int, ZCLAttributeDef] = {
        0x0000: ("company_name", t.LimitedCharString(16)),
        0x0001: ("meter_type_id", t.uint16_t),
        0x0004: ("data_quality_id", t.uint16_t),
        0x0005: ("customer_name", t.LimitedCharString(16)),
        0x0006: ("model", t.LimitedLVBytes(16)),
        0x0007: ("part_number", t.LimitedLVBytes(16)),
        0x0008: ("product_revision", t.LimitedLVBytes(6)),
        0x000A: ("software_revision", t.LimitedLVBytes(6)),
        0x000B: ("utility_name", t.LimitedCharString(16)),
        0x000C: ("pod", t.LimitedCharString(16)),
        0x000D: ("available_power", t.int24s),
        0x000E: ("power_threshold", t.int24s),
    }
    server_commands: dict[int, ZCLCommandDef] = {}
    client_commands: dict[int, ZCLCommandDef] = {}
예제 #6
0
def test_limited_char_string():
    assert t.LimitedCharString(5)("12345").serialize() == b"\x0512345"
    with pytest.raises(ValueError):
        t.LimitedCharString(5)("123456").serialize()
예제 #7
0
파일: general.py 프로젝트: vzenrhen/zigpy
class Basic(Cluster):
    """Attributes for determining basic information about a
    device, setting user device information such as location,
    and enabling a device.
    """
    class PowerSource(t.enum8):
        """Power source enum."""

        Unknown = 0x00
        Mains_single_phase = 0x01
        Mains_three_phase = 0x02
        Battery = 0x03
        DC_Source = 0x04
        Emergency_Mains_Always_On = 0x05
        Emergency_Mains_Transfer_Switch = 0x06

        def __init__(self, *args, **kwargs):
            self.battery_backup = False

        @classmethod
        def deserialize(cls, data: bytes) -> Tuple[bytes, bytes]:
            val, data = t.uint8_t.deserialize(data)
            r = cls(val & 0x7F)
            r.battery_backup = bool(val & 0x80)
            return r, data

    class PhysicalEnvironment(t.enum8):
        Unspecified_environment = 0x00
        Mirror = 0x01
        Atrium = 0x01
        Bar = 0x02
        Courtyard = 0x03
        Bathroom = 0x04
        Bedroom = 0x05
        Billiard_Room = 0x06
        Utility_Room = 0x07
        Cellar = 0x08
        Storage_Closet = 0x09
        Theater = 0x0A
        Office = 0x0B
        Deck = 0x0C
        Den = 0x0D
        Dining_Room = 0x0E
        Electrical_Room = 0x0F
        Elevator = 0x10
        Entry = 0x11
        Family_Room = 0x12
        Main_Floor = 0x13
        Upstairs = 0x14
        Downstairs = 0x15
        Basement = 0x16
        Gallery = 0x17
        Game_Room = 0x18
        Garage = 0x19
        Gym = 0x1A
        Hallway = 0x1B
        House = 0x1C
        Kitchen = 0x1D
        Laundry_Room = 0x1E
        Library = 0x1F
        Master_Bedroom = 0x20
        Mud_Room_small_room_for_coats_and_boots = 0x21
        Nursery = 0x22
        Pantry = 0x23
        Office_2 = 0x24
        Outside = 0x25
        Pool = 0x26
        Porch = 0x27
        Sewing_Room = 0x28
        Sitting_Room = 0x29
        Stairway = 0x2A
        Yard = 0x2B
        Attic = 0x2C
        Hot_Tub = 0x2D
        Living_Room = 0x2E
        Sauna = 0x2F
        Workshop = 0x30
        Guest_Bedroom = 0x31
        Guest_Bath = 0x32
        Back_Yard = 0x34
        Front_Yard = 0x35
        Patio = 0x36
        Driveway = 0x37
        Sun_Room = 0x38
        Grand_Room = 0x39
        Spa = 0x3A
        Whirlpool = 0x3B
        Shed = 0x3C
        Equipment_Storage = 0x3D
        Craft_Room = 0x3E
        Fountain = 0x3F
        Pond = 0x40
        Reception_Room = 0x41
        Breakfast_Room = 0x42
        Nook = 0x43
        Garden = 0x44
        Balcony = 0x45
        Panic_Room = 0x46
        Terrace = 0x47
        Roof = 0x48
        Toilet = 0x49
        Toilet_Main = 0x4A
        Outside_Toilet = 0x4B
        Shower_room = 0x4C
        Study = 0x4D
        Front_Garden = 0x4E
        Back_Garden = 0x4F
        Kettle = 0x50
        Television = 0x51
        Stove = 0x52
        Microwave = 0x53
        Toaster = 0x54
        Vacuum = 0x55
        Appliance = 0x56
        Front_Door = 0x57
        Back_Door = 0x58
        Fridge_Door = 0x59
        Medication_Cabinet_Door = 0x60
        Wardrobe_Door = 0x61
        Front_Cupboard_Door = 0x62
        Other_Door = 0x63
        Waiting_Room = 0x64
        Triage_Room = 0x65
        Doctors_Office = 0x66
        Patients_Private_Room = 0x67
        Consultation_Room = 0x68
        Nurse_Station = 0x69
        Ward = 0x6A
        Corridor = 0x6B
        Operating_Theatre = 0x6C
        Dental_Surgery_Room = 0x6D
        Medical_Imaging_Room = 0x6E
        Decontamination_Room = 0x6F
        Unknown_environment = 0xFF

    class AlarmMask(t.bitmap8):
        General_hardware_fault = 0x01
        General_software_fault = 0x02

    class DisableLocalConfig(t.bitmap8):
        Reset = 0x01
        Device_Configuration = 0x02

    cluster_id = 0x0000
    ep_attribute = "basic"
    attributes = {
        # Basic Device Information
        0x0000: ("zcl_version", t.uint8_t),
        0x0001: ("app_version", t.uint8_t),
        0x0002: ("stack_version", t.uint8_t),
        0x0003: ("hw_version", t.uint8_t),
        0x0004: ("manufacturer", t.CharacterString),
        0x0005: ("model", t.CharacterString),
        0x0006: ("date_code", t.CharacterString),
        0x0007: ("power_source", PowerSource),
        0x0008: ("app_profile_version", t.enum8),
        # Basic Device Settings
        0x0010: ("location_desc", t.LimitedCharString(16)),
        0x0011: ("physical_env", PhysicalEnvironment),
        0x0012: ("device_enabled", t.Bool),
        0x0013: ("alarm_mask", AlarmMask),
        0x0014: ("disable_local_config", DisableLocalConfig),
        0x4000: ("sw_build_id", t.CharacterString),
    }
    server_commands = {0x0000: ("reset_fact_default", (), False)}
    client_commands = {}
예제 #8
0
파일: closures.py 프로젝트: zsyg/zigpy
class DoorLock(Cluster):
    """The door lock cluster provides an interface to a generic way to secure a door."""
    class LockState(t.enum8):
        Not_fully_locked = 0x00
        Locked = 0x01
        Unlocked = 0x02
        Undefined = 0xFF

    class LockType(t.enum8):
        Dead_bolt = 0x00
        Magnetic = 0x01
        Other = 0x02
        Mortise = 0x03
        Rim = 0x04
        Latch_bolt = 0x05
        Cylindrical_lock = 0x06
        Tubular_lock = 0x07
        Interconnected_lock = 0x08
        Dead_latch = 0x09
        Door_furniture = 0x0A

    class DoorState(t.enum8):
        Open = 0x00
        Closed = 0x01
        Error_jammed = 0x02
        Error_forced_open = 0x03
        Error_unspecified = 0x04
        Undefined = 0xFF

    class OperatingMode(t.enum8):
        Normal = 0x00
        Vacation = 0x01
        Privacy = 0x02
        No_RF_Lock_Unlock = 0x03
        Passage = 0x04

    class SupportedOperatingModes(t.bitmap16):
        Normal = 0x0001
        Vacation = 0x0002
        Privacy = 0x0004
        No_RF = 0x0008
        Passage = 0x0010

    class DefaultConfigurationRegister(t.bitmap16):
        Enable_Local_Programming = 0x0001
        Keypad_Interface_default_access = 0x0002
        RF_Interface_default_access = 0x0004
        Sound_Volume_non_zero = 0x0020
        Auto_Relock_time_non_zero = 0x0040
        Led_settings_non_zero = 0x0080

    class ZigbeeSecurityLevel(t.enum8):
        Network_Security = 0x00
        APS_Security = 0x01

    class AlarmMask(t.bitmap16):
        Deadbolt_Jammed = 0x0001
        Lock_Reset_to_Factory_Defaults = 0x0002
        Reserved = 0x0004
        RF_Module_Power_Cycled = 0x0008
        Tamper_Alarm_wrong_code_entry_limit = 0x0010
        Tamper_Alarm_front_escutcheon_removed = 0x0020
        Forced_Door_Open_under_Door_Lockec_Condition = 0x0040

    class KeypadOperationEventMask(t.bitmap16):
        Manufacturer_specific = 0x0001
        Lock_source_keypad = 0x0002
        Unlock_source_keypad = 0x0004
        Lock_source_keypad_error_invalid_code = 0x0008
        Lock_source_keypad_error_invalid_schedule = 0x0010
        Unlock_source_keypad_error_invalid_code = 0x0020
        Unlock_source_keypad_error_invalid_schedule = 0x0040
        Non_Access_User_Operation = 0x0080

    class RFOperationEventMask(t.bitmap16):
        Manufacturer_specific = 0x0001
        Lock_source_RF = 0x0002
        Unlock_source_RF = 0x0004
        Lock_source_RF_error_invalid_code = 0x0008
        Lock_source_RF_error_invalid_schedule = 0x0010
        Unlock_source_RF_error_invalid_code = 0x0020
        Unlock_source_RF_error_invalid_schedule = 0x0040

    class ManualOperatitonEventMask(t.bitmap16):
        Manufacturer_specific = 0x0001
        Thumbturn_Lock = 0x0002
        Thumbturn_Unlock = 0x0004
        One_touch_lock = 0x0008
        Key_Lock = 0x0010
        Key_Unlock = 0x0020
        Auto_lock = 0x0040
        Schedule_Lock = 0x0080
        Schedule_Unlock = 0x0100
        Manual_Lock_key_or_thumbturn = 0x0200
        Manual_Unlock_key_or_thumbturn = 0x0400

    class RFIDOperationEventMask(t.bitmap16):
        Manufacturer_specific = 0x0001
        Lock_source_RFID = 0x0002
        Unlock_source_RFID = 0x0004
        Lock_source_RFID_error_invalid_RFID_ID = 0x0008
        Lock_source_RFID_error_invalid_schedule = 0x0010
        Unlock_source_RFID_error_invalid_RFID_ID = 0x0020
        Unlock_source_RFID_error_invalid_schedule = 0x0040

    class KeypadProgrammingEventMask(t.bitmap16):
        Manufacturer_Specific = 0x0001
        Master_code_changed = 0x0002
        PIN_added = 0x0004
        PIN_deleted = 0x0008
        PIN_changed = 0x0010

    class RFProgrammingEventMask(t.bitmap16):
        Manufacturer_Specific = 0x0001
        PIN_added = 0x0004
        PIN_deleted = 0x0008
        PIN_changed = 0x0010
        RFID_code_added = 0x0020
        RFID_code_deleted = 0x0040

    class RFIDProgrammingEventMask(t.bitmap16):
        Manufacturer_Specific = 0x0001
        RFID_code_added = 0x0020
        RFID_code_deleted = 0x0040

    class OperationEventSource(t.enum8):
        Keypad = 0x00
        RF = 0x01
        Manual = 0x02
        RFID = 0x03
        Indeterminate = 0xFF

    class OperationEvent(t.enum8):
        UnknownOrMfgSpecific = 0x00
        Lock = 0x01
        Unlock = 0x02
        LockFailureInvalidPINorID = 0x03
        LockFailureInvalidSchedule = 0x04
        UnlockFailureInvalidPINorID = 0x05
        UnlockFailureInvalidSchedule = 0x06
        OnTouchLock = 0x07
        KeyLock = 0x08
        KeyUnlock = 0x09
        AutoLock = 0x0A
        ScheduleLock = 0x0B
        ScheduleUnlock = 0x0C
        Manual_Lock = 0x0D
        Manual_Unlock = 0x0E
        Non_Access_User_Operational_Event = 0x0F

    class ProgrammingEvent(t.enum8):
        UnknownOrMfgSpecific = 0x00
        MasterCodeChanged = 0x01
        PINCodeAdded = 0x02
        PINCodeDeleted = 0x03
        PINCodeChanges = 0x04
        RFIDCodeAdded = 0x05
        RFIDCodeDeleted = 0x06

    class UserStatus(t.enum8):
        Available = 0x00
        Enabled = 0x01
        Disabled = 0x03
        Not_Supported = 0xFF

    class UserType(t.enum8):
        Unrestricted = 0x00
        Year_Day_Schedule_User = 0x01
        Week_Day_Schedule_User = 0x02
        Master_User = 0x03
        Non_Access_User = 0x04
        Not_Supported = 0xFF

    class DayMask(t.bitmap8):
        Sun = 0x01
        Mon = 0x02
        Tue = 0x04
        Wed = 0x08
        Thu = 0x10
        Fri = 0x20
        Sat = 0x40

    class EventType(t.enum8):
        Operation = 0x00
        Programming = 0x01
        Alarm = 0x02

    cluster_id = 0x0101
    name = "Door Lock"
    ep_attribute = "door_lock"
    attributes = {
        0x0000: ("lock_state", LockState),
        0x0001: ("lock_type", LockType),
        0x0002: ("actuator_enabled", t.Bool),
        0x0003: ("door_state", DoorState),
        0x0004: ("door_open_events", t.uint32_t),
        0x0005: ("door_closed_events", t.uint32_t),
        0x0006: ("open_period", t.uint16_t),
        0x0010: ("num_of_lock_records_supported", t.uint16_t),
        0x0011: ("num_of_total_users_supported", t.uint16_t),
        0x0012: ("num_of_pin_users_supported", t.uint16_t),
        0x0013: ("num_of_rfid_users_supported", t.uint16_t),
        0x0014: ("num_of_week_day_schedules_supported_per_user", t.uint8_t),
        0x0015: ("num_of_year_day_schedules_supported_per_user", t.uint8_t),
        0x0016: ("num_of_holiday_scheduleds_supported", t.uint8_t),
        0x0017: ("max_pin_len", t.uint8_t),
        0x0018: ("min_pin_len", t.uint8_t),
        0x0019: ("max_rfid_len", t.uint8_t),
        0x001A: ("min_rfid_len", t.uint8_t),
        0x0020: ("enable_logging", t.Bool),
        0x0021: ("language", t.LimitedCharString(3)),
        0x0022: ("led_settings", t.uint8_t),
        0x0023: ("auto_relock_time", t.uint32_t),
        0x0024: ("sound_volume", t.uint8_t),
        0x0025: ("operating_mode", OperatingMode),
        0x0026: ("supported_operating_modes", SupportedOperatingModes),
        0x0027:
        ("default_configuration_register", DefaultConfigurationRegister),
        0x0028: ("enable_local_programming", t.Bool),
        0x0029: ("enable_one_touch_locking", t.Bool),
        0x002A: ("enable_inside_status_led", t.Bool),
        0x002B: ("enable_privacy_mode_button", t.Bool),
        0x0030: ("wrong_code_entry_limit", t.uint8_t),
        0x0031: ("user_code_temporary_disable_time", t.uint8_t),
        0x0032: ("send_pin_ota", t.Bool),
        0x0033: ("require_pin_for_rf_operation", t.Bool),
        0x0034: ("zigbee_security_level", ZigbeeSecurityLevel),
        0x0040: ("alarm_mask", AlarmMask),
        0x0041: ("keypad_operation_event_mask", KeypadOperationEventMask),
        0x0042: ("rf_operation_event_mask", RFOperationEventMask),
        0x0043: ("manual_operation_event_mask", ManualOperatitonEventMask),
        0x0044: ("rfid_operation_event_mask", RFIDOperationEventMask),
        0x0045: ("keypad_programming_event_mask", KeypadProgrammingEventMask),
        0x0046: ("rf_programming_event_mask", RFProgrammingEventMask),
        0x0047: ("rfid_programming_event_mask", RFIDProgrammingEventMask),
    }
    server_commands = {
        0x0000: ("lock_door", (t.Optional(t.CharacterString), ), False),
        0x0001: ("unlock_door", (t.Optional(t.CharacterString), ), False),
        0x0002: ("toggle_door", (t.Optional(t.CharacterString), ), False),
        0x0003: (
            "unlock_with_timeout",
            (t.uint16_t, t.Optional(t.CharacterString)),
            False,
        ),
        0x0004: ("get_log_record", (t.uint16_t, ), False),
        0x0005: (
            "set_pin_code",
            (t.uint16_t, UserStatus, UserType, t.CharacterString),
            False,
        ),
        0x0006: ("get_pin_code", (t.uint16_t, ), False),
        0x0007: ("clear_pin_code", (t.uint16_t, ), False),
        0x0008: ("clear_all_pin_codes", (), False),
        0x0009: ("set_user_status", (t.uint16_t, UserStatus), False),
        0x000A: ("get_user_status", (t.uint16_t, ), False),
        0x000B: (
            "set_week_day_schedule",
            (
                t.uint8_t,
                t.uint16_t,
                DayMask,
                t.uint8_t,
                t.uint8_t,
                t.uint8_t,
                t.uint8_t,
            ),
            False,
        ),
        0x000C: ("get_week_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x000D: ("clear_week_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x000E: (
            "set_year_day_schedule",
            (t.uint8_t, t.uint16_t, t.LocalTime, t.LocalTime),
            False,
        ),
        0x000F: ("get_year_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x0010: ("clear_year_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x0011: (
            "set_holiday_schedule",
            (t.uint8_t, t.LocalTime, t.LocalTime, OperatingMode),
            False,
        ),
        0x0012: ("get_holiday_schedule", (t.uint8_t, ), False),
        0x0013: ("clear_holiday_schedule", (t.uint8_t, ), False),
        0x0014: ("set_user_type", (t.uint16_t, UserType), False),
        0x0015: ("get_user_type", (t.uint16_t, ), False),
        0x0016: (
            "set_rfid_code",
            (t.uint16_t, UserStatus, UserType, t.CharacterString),
            False,
        ),
        0x0017: ("get_rfid_code", (t.uint16_t, ), False),
        0x0018: ("clear_rfid_code", (t.uint16_t, ), False),
        0x0019: ("clear_all_rfid_codes", (), False),
    }
    client_commands = {
        0x0000: ("lock_door_response", (foundation.Status, ), True),
        0x0001: ("unlock_door_response", (foundation.Status, ), True),
        0x0002: ("toggle_door_response", (foundation.Status, ), True),
        0x0003: ("unlock_with_timeout_response", (foundation.Status, ), True),
        0x0004: (
            "get_log_record_response",
            (
                t.uint16_t,
                t.uint32_t,
                EventType,
                OperationEventSource,
                t.uint8_t,
                t.uint16_t,
                t.Optional(t.CharacterString),
            ),
            True,
        ),
        0x0005: ("set_pin_code_response", (foundation.Status, ), True),
        0x0006: (
            "get_pin_code_response",
            (t.uint16_t, UserStatus, UserType, t.CharacterString),
            True,
        ),
        0x0007: ("clear_pin_code_response", (foundation.Status, ), True),
        0x0008: ("clear_all_pin_codes_response", (foundation.Status, ), True),
        0x0009: ("set_user_status_response", (foundation.Status, ), True),
        0x000A: ("get_user_status_response", (t.uint16_t, UserStatus), True),
        0x000B:
        ("set_week_day_schedule_response", (foundation.Status, ), True),
        0x000C: (
            "get_week_day_schedule_response",
            (
                t.uint8_t,
                t.uint16_t,
                foundation.Status,
                t.Optional(t.uint8_t),
                t.Optional(t.uint8_t),
                t.Optional(t.uint8_t),
                t.Optional(t.uint8_t),
            ),
            True,
        ),
        0x000D:
        ("clear_week_day_schedule_response", (foundation.Status, ), True),
        0x000E:
        ("set_year_day_schedule_response", (foundation.Status, ), True),
        0x000F: (
            "get_year_day_schedule_response",
            (
                t.uint8_t,
                t.uint16_t,
                foundation.Status,
                t.Optional(t.LocalTime),
                t.Optional(t.LocalTime),
            ),
            True,
        ),
        0x0010:
        ("clear_year_day_schedule_response", (foundation.Status, ), True),
        0x0011: ("set_holiday_schedule_response", (foundation.Status, ), True),
        0x0012: (
            "get_holiday_schedule_response",
            (
                t.uint8_t,
                foundation.Status,
                t.Optional(t.LocalTime),
                t.Optional(t.LocalTime),
                t.Optional(t.uint8_t),
            ),
            True,
        ),
        0x0013: ("clear_holiday_schedule_response", (foundation.Status, ),
                 True),
        0x0014: ("set_user_type_response", (foundation.Status, ), True),
        0x0015: ("get_user_type_response", (t.uint16_t, UserType), True),
        0x0016: ("set_rfid_code_response", (t.uint8_t, ), True),
        0x0017: (
            "get_rfid_code_response",
            (t.uint16_t, UserStatus, UserType, t.CharacterString),
            True,
        ),
        0x0018: ("clear_rfid_code_response", (foundation.Status, ), True),
        0x0019: ("clear_all_rfid_codes_response", (foundation.Status, ), True),
        0x0020: (
            "operation_event_notification",
            (
                OperationEventSource,
                OperationEvent,
                t.uint16_t,
                t.uint8_t,
                t.LocalTime,
                t.CharacterString,
            ),
            False,
        ),
        0x0021: (
            "programming_event_notification",
            (
                OperationEventSource,
                ProgrammingEvent,
                t.uint16_t,
                t.uint8_t,
                UserType,
                UserStatus,
                t.LocalTime,
                t.CharacterString,
            ),
            False,
        ),
    }
예제 #9
0
파일: closures.py 프로젝트: yuzz-iot/zigpy
class DoorLock(Cluster):
    cluster_id = 0x0101
    name = "Door Lock"
    ep_attribute = "door_lock"
    attributes = {
        0x0000: ("lock_state", t.enum8),
        0x0001: ("lock_type", t.enum8),
        0x0002: ("actuator_enabled", t.Bool),
        0x0003: ("door_state", t.enum8),
        0x0004: ("door_open_events", t.uint32_t),
        0x0005: ("door_closed_events", t.uint32_t),
        0x0006: ("open_period", t.uint16_t),
        0x0010: ("num_of_lock_records_supported", t.uint16_t),
        0x0011: ("num_of_total_users_supported", t.uint16_t),
        0x0012: ("num_of_pin_users_supported", t.uint16_t),
        0x0013: ("num_of_rfid_users_supported", t.uint16_t),
        0x0014: ("num_of_week_day_schedules_supported_per_user", t.uint8_t),
        0x0015: ("num_of_year_day_schedules_supported_per_user", t.uint8_t),
        0x0016: ("num_of_holiday_scheduleds_supported", t.uint8_t),
        0x0017: ("max_pin_len", t.uint8_t),
        0x0018: ("min_pin_len", t.uint8_t),
        0x0019: ("max_rfid_len", t.uint8_t),
        0x001A: ("min_rfid_len", t.uint8_t),
        0x0020: ("enable_logging", t.Bool),
        0x0021: ("language", t.LimitedCharString(3)),
        0x0022: ("led_settings", t.uint8_t),
        0x0023: ("auto_relock_time", t.uint32_t),
        0x0024: ("sound_volume", t.uint8_t),
        0x0025: ("operating_mode", t.enum8),
        0x0026: ("supported_operating_modes", t.bitmap16),
        0x0027: ("default_configuration_register", t.bitmap16),
        0x0028: ("enable_local_programming", t.Bool),
        0x0029: ("enable_one_touch_locking", t.Bool),
        0x002A: ("enable_inside_status_led", t.Bool),
        0x002B: ("enable_privacy_mode_button", t.Bool),
        0x0030: ("wrong_code_entry_limit", t.uint8_t),
        0x0031: ("user_code_temporary_disable_time", t.uint8_t),
        0x0032: ("send_pin_ota", t.Bool),
        0x0033: ("require_pin_for_rf_operation", t.Bool),
        0x0034: ("zigbee_security_level", t.enum8),
        0x0040: ("alarm_mask", t.bitmap16),
        0x0041: ("keypad_operation_event_mask", t.bitmap16),
        0x0042: ("rf_operation_event_mask", t.bitmap16),
        0x0043: ("manual_operation_event_mask", t.bitmap16),
        0x0044: ("rfid_operation_event_mask", t.bitmap16),
        0x0045: ("keypad_programming_event_mask", t.bitmap16),
        0x0046: ("rf_programming_event_mask", t.bitmap16),
        0x0047: ("rfid_programming_event_mask", t.bitmap16),
    }
    server_commands = {
        0x0000: ("lock_door", (t.Optional(t.CharacterString), ), False),
        0x0001: ("unlock_door", (t.Optional(t.CharacterString), ), False),
        0x0002: ("toggle_door", (t.Optional(t.CharacterString), ), False),
        0x0003: (
            "unlock_with_timeout",
            (t.uint16_t, t.Optional(t.CharacterString)),
            False,
        ),
        0x0004: ("get_log_record", (t.uint16_t, ), False),
        0x0005: (
            "set_pin_code",
            (t.uint16_t, t.uint8_t, t.enum8, t.CharacterString),
            False,
        ),
        0x0006: ("get_pin_code", (t.uint16_t, ), False),
        0x0007: ("clear_pin_code", (t.uint16_t, ), False),
        0x0008: ("clear_all_pin_codes", (), False),
        0x0009: ("set_user_status", (t.uint16_t, t.uint8_t), False),
        0x000A: ("get_user_status", (t.uint16_t, ), False),
        0x000B: (
            "set_week_day_schedule",
            (
                t.uint8_t,
                t.uint16_t,
                t.bitmap8,
                t.uint8_t,
                t.uint8_t,
                t.uint8_t,
                t.uint8_t,
            ),
            False,
        ),
        0x000C: ("get_week_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x000D: ("clear_week_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x000E: (
            "set_year_day_schedule",
            (t.uint8_t, t.uint16_t, t.uint32_t, t.uint32_t),
            False,
        ),
        0x000F: ("get_year_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x0010: ("clear_year_day_schedule", (t.uint8_t, t.uint16_t), False),
        0x0011: (
            "set_holiday_schedule",
            (t.uint8_t, t.uint32_t, t.uint32_t, t.enum8),
            False,
        ),
        0x0012: ("get_holiday_schedule", (t.uint8_t, ), False),
        0x0013: ("clear_holiday_schedule", (t.uint8_t, ), False),
        0x0014: ("set_user_type", (t.uint16_t, t.enum8), False),
        0x0015: ("get_user_type", (t.uint16_t, ), False),
        0x0016: (
            "set_rfid_code",
            (t.uint16_t, t.uint8_t, t.enum8, t.CharacterString),
            False,
        ),
        0x0017: ("get_rfid_code", (t.uint16_t, ), False),
        0x0018: ("clear_rfid_code", (t.uint16_t, ), False),
        0x0019: ("clear_all_rfid_codes", (), False),
    }
    client_commands = {
        0x0000: ("lock_door_response", (foundation.Status, ), True),
        0x0001: ("unlock_door_response", (foundation.Status, ), True),
        0x0002: ("toggle_door_response", (foundation.Status, ), True),
        0x0003: ("unlock_with_timeout_response", (foundation.Status, ), True),
        0x0004: (
            "get_log_record_response",
            (
                t.uint16_t,
                t.uint32_t,
                t.enum8,
                t.uint8_t,
                t.uint8_t,
                t.uint16_t,
                t.Optional(t.CharacterString),
            ),
            True,
        ),
        0x0005: ("set_pin_code_response", (foundation.Status, ), True),
        0x0006: (
            "get_pin_code_response",
            (t.uint16_t, t.uint8_t, t.enum8, t.CharacterString),
            True,
        ),
        0x0007: ("clear_pin_code_response", (foundation.Status, ), True),
        0x0008: ("clear_all_pin_codes_response", (foundation.Status, ), True),
        0x0009: ("set_user_status_response", (foundation.Status, ), True),
        0x000A: ("get_user_status_response", (t.uint16_t, t.uint8_t), True),
        0x000B:
        ("set_week_day_schedule_response", (foundation.Status, ), True),
        0x000C: (
            "get_week_day_schedule_response",
            (
                t.uint8_t,
                t.uint16_t,
                foundation.Status,
                t.Optional(t.uint8_t),
                t.Optional(t.uint8_t),
                t.Optional(t.uint8_t),
                t.Optional(t.uint8_t),
            ),
            True,
        ),
        0x000D:
        ("clear_week_day_schedule_response", (foundation.Status, ), True),
        0x000E:
        ("set_year_day_schedule_response", (foundation.Status, ), True),
        0x000F: (
            "get_year_day_schedule_response",
            (
                t.uint8_t,
                t.uint16_t,
                foundation.Status,
                t.Optional(t.uint32_t),
                t.Optional(t.uint32_t),
            ),
            True,
        ),
        0x0010:
        ("clear_year_day_schedule_response", (foundation.Status, ), True),
        0x0011: ("set_holiday_schedule_response", (foundation.Status, ), True),
        0x0012: (
            "get_holiday_schedule_response",
            (
                t.uint8_t,
                foundation.Status,
                t.Optional(t.uint32_t),
                t.Optional(t.uint32_t),
                t.Optional(t.enum8),
            ),
            True,
        ),
        0x0013: ("clear_holiday_schedule_response", (foundation.Status, ),
                 True),
        0x0014: ("set_user_type_response", (foundation.Status, ), True),
        0x0015: ("get_user_type_response", (t.uint16_t, t.enum8), True),
        0x0016: ("set_rfid_code_response", (t.uint8_t, ), True),
        0x0017: (
            "get_rfid_code_response",
            (t.uint16_t, t.uint8_t, t.enum8, t.CharacterString),
            True,
        ),
        0x0018: ("clear_rfid_code_response", (foundation.Status, ), True),
        0x0019: ("clear_all_rfid_codes_response", (foundation.Status, ), True),
        0x0020: (
            "operation_event_notification",
            (
                t.uint8_t,
                t.uint8_t,
                t.uint16_t,
                t.uint8_t,
                t.uint32_t,
                t.CharacterString,
            ),
            False,
        ),
        0x0021: (
            "programming_event_notification",
            (
                t.uint8_t,
                t.uint8_t,
                t.uint16_t,
                t.uint8_t,
                t.uint8_t,
                t.uint8_t,
                t.uint32_t,
                t.CharacterString,
            ),
            False,
        ),
    }
예제 #10
0
class DoorLock(Cluster):
    cluster_id = 0x0101
    name = 'Door Lock'
    ep_attribute = 'door_lock'
    attributes = {
        0x0000: ('lock_state', t.enum8),
        0x0001: ('lock_type', t.enum8),
        0x0002: ('actuator_enabled', t.Bool),
        0x0003: ('door_state', t.enum8),
        0x0004: ('door_open_events', t.uint32_t),
        0x0005: ('door_closed_events', t.uint32_t),
        0x0006: ('open_period', t.uint16_t),
        0x0010: ('num_of_lock_records_supported', t.uint16_t),
        0x0011: ('num_of_total_users_supported', t.uint16_t),
        0x0012: ('num_of_pin_users_supported', t.uint16_t),
        0x0013: ('num_of_rfid_users_supported', t.uint16_t),
        0x0014: ('num_of_week_day_schedules_supported_per_user', t.uint8_t),
        0x0015: ('num_of_year_day_schedules_supported_per_user', t.uint8_t),
        0x0016: ('num_of_holiday_scheduleds_supported', t.uint8_t),
        0x0017: ('max_pin_len', t.uint8_t),
        0x0018: ('min_pin_len', t.uint8_t),
        0x0019: ('max_rfid_len', t.uint8_t),
        0x001a: ('min_rfid_len', t.uint8_t),
        0x0020: ('enable_logging', t.Bool),
        0x0021: ('language', t.LimitedCharString(3)),
        0x0022: ('led_settings', t.uint8_t),
        0x0023: ('auto_relock_time', t.uint32_t),
        0x0024: ('sound_volume', t.uint8_t),
        0x0025: ('operating_mode', t.enum8),
        0x0026: ('supported_operating_modes', t.bitmap16),
        0x0027: ('default_configuration_register', t.bitmap16),
        0x0028: ('enable_local_programming', t.Bool),
        0x0029: ('enable_one_touch_locking', t.Bool),
        0x002a: ('enable_inside_status_led', t.Bool),
        0x002b: ('enable_privacy_mode_button', t.Bool),
        0x0030: ('wrong_code_entry_limit', t.uint8_t),
        0x0031: ('user_code_temporary_disable_time', t.uint8_t),
        0x0032: ('send_pin_ota', t.Bool),
        0x0033: ('require_pin_for_rf_operation', t.Bool),
        0x0034: ('zigbee_security_level', t.enum8),
        0x0040: ('alarm_mask', t.bitmap16),
        0x0041: ('keypad_operation_event_mask', t.bitmap16),
        0x0042: ('rf_operation_event_mask', t.bitmap16),
        0x0043: ('manual_operation_event_mask', t.bitmap16),
        0x0044: ('rfid_operation_event_mask', t.bitmap16),
        0x0045: ('keypad_programming_event_mask', t.bitmap16),
        0x0046: ('rf_programming_event_mask', t.bitmap16),
        0x0047: ('rfid_programming_event_mask', t.bitmap16),
    }
    server_commands = {
        0x0000: ('lock_door', (t.Optional(t.CharacterString), ), False),
        0x0001: ('unlock_door', (t.Optional(t.CharacterString), ), False),
        0x0002: ('toggle_door', (t.Optional(t.CharacterString), ), False),
        0x0003: ('unlock_with_timeout',
                 (t.uint16_t, t.Optional(t.CharacterString)), False),
        0x0004: ('get_log_record', (t.uint16_t, ), False),
        0x0005: ('set_pin_code', (t.uint16_t, t.uint8_t, t.enum8,
                                  t.CharacterString), False),
        0x0006: ('get_pin_code', (t.uint16_t, ), False),
        0x0007: ('clear_pin_code', (t.uint16_t, ), False),
        0x0008: ('clear_all_pin_codes', (), False),
        0x0009: ('set_user_status', (t.uint16_t, t.uint8_t), False),
        0x000a: ('get_user_status', (t.uint16_t, ), False),
        0x000b:
        ('set_week_day_schedule', (t.uint8_t, t.uint16_t, t.bitmap8, t.uint8_t,
                                   t.uint8_t, t.uint8_t, t.uint8_t), False),
        0x000c: ('get_week_day_schedule', (t.uint8_t, t.uint16_t), False),
        0x000d: ('clear_week_day_schedule', (t.uint8_t, t.uint16_t), False),
        0x000e: ('set_year_day_schedule', (t.uint8_t, t.uint16_t, t.uint32_t,
                                           t.uint32_t), False),
        0x000f: ('get_year_day_schedule', (t.uint8_t, t.uint16_t), False),
        0x0010: ('clear_year_day_schedule', (t.uint8_t, t.uint16_t), False),
        0x0011: ('set_holiday_schedule', (t.uint8_t, t.uint32_t, t.uint32_t,
                                          t.enum8), False),
        0x0012: ('get_holiday_schedule', (t.uint8_t, ), False),
        0x0013: ('clear_holiday_schedule', (t.uint8_t, ), False),
        0x0014: ('set_user_type', (t.uint16_t, t.enum8), False),
        0x0015: ('get_user_type', (t.uint16_t, ), False),
        0x0016: ('set_rfid_code', (t.uint16_t, t.uint8_t, t.enum8,
                                   t.CharacterString), False),
        0x0017: ('get_rfid_code', (t.uint16_t, ), False),
        0x0018: ('clear_rfid_code', (t.uint16_t, ), False),
        0x0019: ('clear_all_rfid_codes', (), False),
    }
    client_commands = {
        0x0000: ('lock_door_response', (foundation.Status, ), True),
        0x0001: ('unlock_door_response', (foundation.Status, ), True),
        0x0002: ('toggle_door_response', (foundation.Status, ), True),
        0x0003: ('unlock_with_timeout_response', (foundation.Status, ), True),
        0x0004: ('get_log_record_response',
                 (t.uint16_t, t.uint32_t, t.enum8, t.uint8_t, t.uint8_t,
                  t.uint16_t, t.Optional(t.CharacterString)), True),
        0x0005: ('set_pin_code_response', (foundation.Status, ), True),
        0x0006: ('get_pin_code_response', (t.uint16_t, t.uint8_t, t.enum8,
                                           t.CharacterString), True),
        0x0007: ('clear_pin_code_response', (foundation.Status, ), True),
        0x0008: ('clear_all_pin_codes_response', (foundation.Status, ), True),
        0x0009: ('set_user_status_response', (foundation.Status, ), True),
        0x000a: ('get_user_status_response', (t.uint16_t, t.uint8_t), True),
        0x000b:
        ('set_week_day_schedule_response', (foundation.Status, ), True),
        0x000c: ('get_week_day_schedule_response',
                 (t.uint8_t, t.uint16_t, foundation.Status,
                  t.Optional(t.uint8_t), t.Optional(t.uint8_t),
                  t.Optional(t.uint8_t), t.Optional(t.uint8_t)), True),
        0x000d:
        ('clear_week_day_schedule_response', (foundation.Status, ), True),
        0x000e:
        ('set_year_day_schedule_response', (foundation.Status, ), True),
        0x000f: ('get_year_day_schedule_response',
                 (t.uint8_t, t.uint16_t, foundation.Status,
                  t.Optional(t.uint32_t), t.Optional(t.uint32_t)), True),
        0x0010:
        ('clear_year_day_schedule_response', (foundation.Status, ), True),
        0x0011: ('set_holiday_schedule_response', (foundation.Status, ), True),
        0x0012: ('get_holiday_schedule_response',
                 (t.uint8_t, foundation.Status, t.Optional(t.uint32_t),
                  t.Optional(t.uint32_t), t.Optional(t.enum8)), True),
        0x0013: ('clear_holiday_schedule_response', (foundation.Status, ),
                 True),
        0x0014: ('set_user_type_response', (foundation.Status, ), True),
        0x0015: ('get_user_type_response', (t.uint16_t, t.enum8), True),
        0x0016: ('set_rfid_code_response', (t.uint8_t, ), True),
        0x0017: ('get_rfid_code_response', (t.uint16_t, t.uint8_t, t.enum8,
                                            t.CharacterString), True),
        0x0018: ('clear_rfid_code_response', (foundation.Status, ), True),
        0x0019: ('clear_all_rfid_codes_response', (foundation.Status, ), True),
        0x0020: ('operation_event_notification',
                 (t.uint8_t, t.uint8_t, t.uint16_t, t.uint8_t, t.uint32_t,
                  t.CharacterString), False),
        0x0021: ('programming_event_notification',
                 (t.uint8_t, t.uint8_t, t.uint16_t, t.uint8_t, t.uint8_t,
                  t.uint8_t, t.uint32_t, t.CharacterString), False),
    }
예제 #11
0
def test_limited_char_string():
    assert t.LimitedCharString(5)('12345').serialize() == b'\x0512345'
    with pytest.raises(ValueError):
        t.LimitedCharString(5)('123456').serialize()
예제 #12
0
class Metering(Cluster):
    cluster_id = 0x0702
    ep_attribute = 'smartenergy_metering'
    attributes = {
        0x0000: ('current_summ_delivered', t.uint48_t),
        0x0001: ('current_summ_received', t.uint48_t),
        0x0002: ('current_max_demand_delivered', t.uint48_t),
        0x0003: ('current_max_demand_received', t.uint48_t),
        0x0004: ('dft_summ', t.uint48_t),
        0x0005: ('daily_freeze_time', t.uint16_t),
        0x0006: ('power_factor', t.int8s),
        0x0007: ('reading_snapshot_time', t.uint32_t),
        0x0008: ('current_max_demand_deliverd_time', t.uint32_t),
        0x0009: ('current_max_demand_received_time', t.uint32_t),
        0x000a: ('default_update_period', t.uint8_t),
        0x000b: ('fast_poll_update_period', t.uint8_t),
        0x000c: ('current_block_period_consump_delivered', t.uint48_t),
        0x000d: ('daily_consump_target', t.uint24_t),
        0x000e: ('current_block', t.enum8),
        0x000f: ('profile_interval_period', t.enum8),
        # 0x0010: ('interval_read_reporting_period', UNKNOWN),
        0x0011: ('preset_reading_time', t.uint16_t),
        0x0012: ('volume_per_report', t.uint16_t),
        0x0013: ('flow_restriction', t.uint8_t),
        0x0014: ('supply_status', t.enum8),
        0x0015: ('current_in_energy_carrier_summ', t.uint48_t),
        0x0016: ('current_out_energy_carrier_summ', t.uint48_t),
        0x0017: ('inlet_tempreature', t.int24s),
        0x0018: ('outlet_tempreature', t.int24s),
        0x0019: ('control_tempreature', t.int24s),
        0x001a: ('current_in_energy_carrier_demand', t.int24s),
        0x001b: ('current_out_energy_carrier_demand', t.int24s),
        0x001d: ('current_block_period_consump_received', t.uint48_t),
        0x001e: ('current_block_received', t.uint48_t),
        # 0x0100: ('change_reporting_profile', UNKNOWN),
        0x0100: ('current_tier1_summ_delivered', t.uint48_t),
        0x0101: ('current_tier1_summ_received', t.uint48_t),
        0x0102: ('current_tier2_summ_delivered', t.uint48_t),
        0x0103: ('current_tier2_summ_received', t.uint48_t),
        0x0104: ('current_tier3_summ_delivered', t.uint48_t),
        0x0105: ('current_tier3_summ_received', t.uint48_t),
        0x0106: ('current_tier4_summ_delivered', t.uint48_t),
        0x0107: ('current_tier4_summ_received', t.uint48_t),
        0x0108: ('current_tier5_summ_delivered', t.uint48_t),
        0x0109: ('current_tier5_summ_received', t.uint48_t),
        0x010a: ('current_tier6_summ_delivered', t.uint48_t),
        0x010b: ('current_tier6_summ_received', t.uint48_t),
        0x010c: ('current_tier7_summ_delivered', t.uint48_t),
        0x010d: ('current_tier7_summ_received', t.uint48_t),
        0x010e: ('current_tier8_summ_delivered', t.uint48_t),
        0x010f: ('current_tier8_summ_received', t.uint48_t),
        0x0110: ('current_tier9_summ_delivered', t.uint48_t),
        0x0111: ('current_tier9_summ_received', t.uint48_t),
        0x0112: ('current_tier10_summ_delivered', t.uint48_t),
        0x0113: ('current_tier10_summ_received', t.uint48_t),
        0x0114: ('current_tier11_summ_delivered', t.uint48_t),
        0x0115: ('current_tier11_summ_received', t.uint48_t),
        0x0116: ('current_tier12_summ_delivered', t.uint48_t),
        0x0117: ('current_tier12_summ_received', t.uint48_t),
        0x0118: ('current_tier13_summ_delivered', t.uint48_t),
        0x0119: ('current_tier13_summ_received', t.uint48_t),
        0x011a: ('current_tier14_summ_delivered', t.uint48_t),
        0x011b: ('current_tier14_summ_received', t.uint48_t),
        0x011c: ('current_tier15_summ_delivered', t.uint48_t),
        0x011d: ('current_tier15_summ_received', t.uint48_t),
        0x0200: ('status', t.bitmap8),
        0x0201: ('remaining_batt_life', t.uint8_t),
        0x0202: ('hours_in_operation', t.uint24_t),
        0x0203: ('hours_in_fault', t.uint24_t),
        0x0204: ('extended_status', t.bitmap64),
        0x0300: ('unit_of_measure', t.enum8),
        0x0301: ('multiplier', t.uint24_t),
        0x0302: ('divisor', t.uint24_t),
        0x0303: ('summa_formatting', t.bitmap8),
        0x0304: ('demand_formatting', t.bitmap8),
        0x0305: ('historical_consump_formatting', t.bitmap8),
        0x0306: ('metering_device_type', t.bitmap8),
        0x0307: ('site_id', t.LimitedCharString(32)),
        0x0308: ('meter_serial_number', t.LimitedCharString(24)),
        0x0309: ('energy_carrier_unit_of_meas', t.enum8),
        0x030a: ('energy_carrier_summ_formatting', t.bitmap8),
        0x030b: ('energy_carrier_demand_formatting', t.bitmap8),
        0x030c: ('temperature_unit_of_meas', t.enum8),
        0x030d: ('temperature_formatting', t.bitmap8),
        0x030e: ('module_serial_number', t.LVBytes),
        0x030f: ('operating_tariff_level', t.LVBytes),
        0x0400: ('instantaneous_demand', t.int24s),
        0x0401: ('currentday_consump_delivered', t.uint24_t),
        0x0402: ('currentday_consump_received', t.uint24_t),
        0x0403: ('previousday_consump_delivered', t.uint24_t),
        0x0404: ('previousday_consump_received', t.uint24_t),
        0x0405: ('cur_part_profile_int_start_time_delivered', t.uint32_t),
        0x0406: ('cur_part_profile_int_start_time_received', t.uint32_t),
        0x0407: ('cur_part_profile_int_value_delivered', t.uint24_t),
        0x0408: ('cur_part_profile_int_value_received', t.uint24_t),
        0x0409: ('current_day_max_pressure', t.uint48_t),
        0x040a: ('current_day_min_pressure', t.uint48_t),
        0x040b: ('previous_day_max_pressure', t.uint48_t),
        0x040c: ('previous_day_min_pressure', t.uint48_t),
        0x040d: ('current_day_max_demand', t.int24s),
        0x040e: ('previous_day_max_demand', t.int24s),
        0x040f: ('current_month_max_demand', t.int24s),
        0x0410: ('current_year_max_demand', t.int24s),
        0x0411: ('currentday_max_energy_carr_demand', t.int24s),
        0x0412: ('previousday_max_energy_carr_demand', t.int24s),
        0x0413: ('cur_month_max_energy_carr_demand', t.int24s),
        0x0414: ('cur_month_min_energy_carr_demand', t.int24s),
        0x0415: ('cur_year_max_energy_carr_demand', t.int24s),
        0x0416: ('cur_year_min_energy_carr_demand', t.int24s),
        0x0500: ('max_number_of_periods_delivered', t.uint8_t),
        0x0600: ('current_demand_delivered', t.uint24_t),
        0x0601: ('demand_limit', t.uint24_t),
        0x0602: ('demand_integration_period', t.uint8_t),
        0x0603: ('number_of_demand_subintervals', t.uint8_t),
        0x0604: ('demand_limit_arm_duration', t.uint16_t),
        0x0800: ('generic_alarm_mask', t.bitmap16),
        0x0801: ('electricity_alarm_mask', t.bitmap32),
        0x0802: ('gen_flow_pressure_alarm_mask', t.bitmap16),
        0x0803: ('water_specific_alarm_mask', t.bitmap16),
        0x0804: ('heat_cool_specific_alarm_mask', t.bitmap16),
        0x0805: ('gas_specific_alarm_mask', t.bitmap16),
        0x0806: ('extended_generic_alarm_mask', t.bitmap48),
        0x0807: ('manufacture_alarm_mask', t.bitmap16),
        0x0a00: ('bill_to_date', t.uint32_t),
        0x0a01: ('bill_to_date_time_stamp', t.uint32_t),
        0x0a02: ('projected_bill', t.uint32_t),
        0x0a03: ('projected_bill_time_stamp', t.uint32_t),
    }
    server_commands = {
        0x0000: ('get_profile', (), False),
        0x0001: ('req_mirror', (), False),
        0x0002: ('mirror_rem', (), False),
        0x0003: ('req_fast_poll_mode', (), False),
        0x0004: ('get_snapshot', (), False),
        0x0005: ('take_snapshot', (), False),
        0x0006: ('mirror_report_attr_response', (), True),
    }
    client_commands = {
        0x0000: ('get_profile_response', (), True),
        0x0001: ('req_mirror_response', (), True),
        0x0002: ('mirror_rem_response', (), True),
        0x0003: ('req_fast_poll_mode_response', (), True),
        0x0004: ('get_snapshot_response', (), True),
    }
예제 #13
0
파일: smartenergy.py 프로젝트: sybohy/zigpy
class Metering(Cluster):
    cluster_id = 0x0702
    ep_attribute = "smartenergy_metering"
    attributes = {
        0x0000: ("current_summ_delivered", t.uint48_t),
        0x0001: ("current_summ_received", t.uint48_t),
        0x0002: ("current_max_demand_delivered", t.uint48_t),
        0x0003: ("current_max_demand_received", t.uint48_t),
        0x0004: ("dft_summ", t.uint48_t),
        0x0005: ("daily_freeze_time", t.uint16_t),
        0x0006: ("power_factor", t.int8s),
        0x0007: ("reading_snapshot_time", t.uint32_t),
        0x0008: ("current_max_demand_deliverd_time", t.uint32_t),
        0x0009: ("current_max_demand_received_time", t.uint32_t),
        0x000A: ("default_update_period", t.uint8_t),
        0x000B: ("fast_poll_update_period", t.uint8_t),
        0x000C: ("current_block_period_consump_delivered", t.uint48_t),
        0x000D: ("daily_consump_target", t.uint24_t),
        0x000E: ("current_block", t.enum8),
        0x000F: ("profile_interval_period", t.enum8),
        # 0x0010: ('interval_read_reporting_period', UNKNOWN),
        0x0011: ("preset_reading_time", t.uint16_t),
        0x0012: ("volume_per_report", t.uint16_t),
        0x0013: ("flow_restriction", t.uint8_t),
        0x0014: ("supply_status", t.enum8),
        0x0015: ("current_in_energy_carrier_summ", t.uint48_t),
        0x0016: ("current_out_energy_carrier_summ", t.uint48_t),
        0x0017: ("inlet_tempreature", t.int24s),
        0x0018: ("outlet_tempreature", t.int24s),
        0x0019: ("control_tempreature", t.int24s),
        0x001A: ("current_in_energy_carrier_demand", t.int24s),
        0x001B: ("current_out_energy_carrier_demand", t.int24s),
        0x001D: ("current_block_period_consump_received", t.uint48_t),
        0x001E: ("current_block_received", t.uint48_t),
        # 0x0100: ('change_reporting_profile', UNKNOWN),
        0x0100: ("current_tier1_summ_delivered", t.uint48_t),
        0x0101: ("current_tier1_summ_received", t.uint48_t),
        0x0102: ("current_tier2_summ_delivered", t.uint48_t),
        0x0103: ("current_tier2_summ_received", t.uint48_t),
        0x0104: ("current_tier3_summ_delivered", t.uint48_t),
        0x0105: ("current_tier3_summ_received", t.uint48_t),
        0x0106: ("current_tier4_summ_delivered", t.uint48_t),
        0x0107: ("current_tier4_summ_received", t.uint48_t),
        0x0108: ("current_tier5_summ_delivered", t.uint48_t),
        0x0109: ("current_tier5_summ_received", t.uint48_t),
        0x010A: ("current_tier6_summ_delivered", t.uint48_t),
        0x010B: ("current_tier6_summ_received", t.uint48_t),
        0x010C: ("current_tier7_summ_delivered", t.uint48_t),
        0x010D: ("current_tier7_summ_received", t.uint48_t),
        0x010E: ("current_tier8_summ_delivered", t.uint48_t),
        0x010F: ("current_tier8_summ_received", t.uint48_t),
        0x0110: ("current_tier9_summ_delivered", t.uint48_t),
        0x0111: ("current_tier9_summ_received", t.uint48_t),
        0x0112: ("current_tier10_summ_delivered", t.uint48_t),
        0x0113: ("current_tier10_summ_received", t.uint48_t),
        0x0114: ("current_tier11_summ_delivered", t.uint48_t),
        0x0115: ("current_tier11_summ_received", t.uint48_t),
        0x0116: ("current_tier12_summ_delivered", t.uint48_t),
        0x0117: ("current_tier12_summ_received", t.uint48_t),
        0x0118: ("current_tier13_summ_delivered", t.uint48_t),
        0x0119: ("current_tier13_summ_received", t.uint48_t),
        0x011A: ("current_tier14_summ_delivered", t.uint48_t),
        0x011B: ("current_tier14_summ_received", t.uint48_t),
        0x011C: ("current_tier15_summ_delivered", t.uint48_t),
        0x011D: ("current_tier15_summ_received", t.uint48_t),
        0x0200: ("status", t.bitmap8),
        0x0201: ("remaining_batt_life", t.uint8_t),
        0x0202: ("hours_in_operation", t.uint24_t),
        0x0203: ("hours_in_fault", t.uint24_t),
        0x0204: ("extended_status", t.bitmap64),
        0x0300: ("unit_of_measure", t.enum8),
        0x0301: ("multiplier", t.uint24_t),
        0x0302: ("divisor", t.uint24_t),
        0x0303: ("summa_formatting", t.bitmap8),
        0x0304: ("demand_formatting", t.bitmap8),
        0x0305: ("historical_consump_formatting", t.bitmap8),
        0x0306: ("metering_device_type", t.bitmap8),
        0x0307: ("site_id", t.LimitedCharString(32)),
        0x0308: ("meter_serial_number", t.LimitedCharString(24)),
        0x0309: ("energy_carrier_unit_of_meas", t.enum8),
        0x030A: ("energy_carrier_summ_formatting", t.bitmap8),
        0x030B: ("energy_carrier_demand_formatting", t.bitmap8),
        0x030C: ("temperature_unit_of_meas", t.enum8),
        0x030D: ("temperature_formatting", t.bitmap8),
        0x030E: ("module_serial_number", t.LVBytes),
        0x030F: ("operating_tariff_level", t.LVBytes),
        0x0400: ("instantaneous_demand", t.int24s),
        0x0401: ("currentday_consump_delivered", t.uint24_t),
        0x0402: ("currentday_consump_received", t.uint24_t),
        0x0403: ("previousday_consump_delivered", t.uint24_t),
        0x0404: ("previousday_consump_received", t.uint24_t),
        0x0405: ("cur_part_profile_int_start_time_delivered", t.uint32_t),
        0x0406: ("cur_part_profile_int_start_time_received", t.uint32_t),
        0x0407: ("cur_part_profile_int_value_delivered", t.uint24_t),
        0x0408: ("cur_part_profile_int_value_received", t.uint24_t),
        0x0409: ("current_day_max_pressure", t.uint48_t),
        0x040A: ("current_day_min_pressure", t.uint48_t),
        0x040B: ("previous_day_max_pressure", t.uint48_t),
        0x040C: ("previous_day_min_pressure", t.uint48_t),
        0x040D: ("current_day_max_demand", t.int24s),
        0x040E: ("previous_day_max_demand", t.int24s),
        0x040F: ("current_month_max_demand", t.int24s),
        0x0410: ("current_year_max_demand", t.int24s),
        0x0411: ("currentday_max_energy_carr_demand", t.int24s),
        0x0412: ("previousday_max_energy_carr_demand", t.int24s),
        0x0413: ("cur_month_max_energy_carr_demand", t.int24s),
        0x0414: ("cur_month_min_energy_carr_demand", t.int24s),
        0x0415: ("cur_year_max_energy_carr_demand", t.int24s),
        0x0416: ("cur_year_min_energy_carr_demand", t.int24s),
        0x0500: ("max_number_of_periods_delivered", t.uint8_t),
        0x0600: ("current_demand_delivered", t.uint24_t),
        0x0601: ("demand_limit", t.uint24_t),
        0x0602: ("demand_integration_period", t.uint8_t),
        0x0603: ("number_of_demand_subintervals", t.uint8_t),
        0x0604: ("demand_limit_arm_duration", t.uint16_t),
        0x0800: ("generic_alarm_mask", t.bitmap16),
        0x0801: ("electricity_alarm_mask", t.bitmap32),
        0x0802: ("gen_flow_pressure_alarm_mask", t.bitmap16),
        0x0803: ("water_specific_alarm_mask", t.bitmap16),
        0x0804: ("heat_cool_specific_alarm_mask", t.bitmap16),
        0x0805: ("gas_specific_alarm_mask", t.bitmap16),
        0x0806: ("extended_generic_alarm_mask", t.bitmap48),
        0x0807: ("manufacture_alarm_mask", t.bitmap16),
        0x0A00: ("bill_to_date", t.uint32_t),
        0x0A01: ("bill_to_date_time_stamp", t.uint32_t),
        0x0A02: ("projected_bill", t.uint32_t),
        0x0A03: ("projected_bill_time_stamp", t.uint32_t),
    }
    server_commands = {
        0x0000: ("get_profile", (), False),
        0x0001: ("req_mirror", (), False),
        0x0002: ("mirror_rem", (), False),
        0x0003: ("req_fast_poll_mode", (), False),
        0x0004: ("get_snapshot", (), False),
        0x0005: ("take_snapshot", (), False),
        0x0006: ("mirror_report_attr_response", (), True),
    }
    client_commands = {
        0x0000: ("get_profile_response", (), True),
        0x0001: ("req_mirror_response", (), True),
        0x0002: ("mirror_rem_response", (), True),
        0x0003: ("req_fast_poll_mode_response", (), True),
        0x0004: ("get_snapshot_response", (), True),
    }