|
38 | 38 | def create_read(include_reachable: bool = False, include_max_paths: bool = False, include_vendor_id: bool = True) -> Attribute.AsyncReadTransaction.ReadResponse:
|
39 | 39 | # Attribute read here is set to match the example_pics_xml_basic_info.xml in this directory
|
40 | 40 | bi = Clusters.BasicInformation.Attributes
|
41 |
| - attrs = {bi.DataModelRevision: 1, |
42 |
| - bi.VendorName: 'testVendor', |
43 |
| - bi.ProductName: 'testProduct', |
44 |
| - bi.ProductID: 0x8000, |
45 |
| - bi.NodeLabel: 'label', |
46 |
| - bi.Location: 'XX', |
47 |
| - bi.HardwareVersion: 1, |
48 |
| - bi.HardwareVersionString: 'one', |
49 |
| - bi.SoftwareVersion: 2, |
50 |
| - bi.SoftwareVersionString: 'two', |
51 |
| - bi.ManufacturingDate: 'today', |
52 |
| - bi.PartNumber: 'three', |
53 |
| - bi.ProductURL: 'example.com', |
54 |
| - bi.ProductLabel: 'myProduct', |
55 |
| - bi.SerialNumber: 'ABCD1234', |
56 |
| - bi.LocalConfigDisabled: False, |
57 |
| - bi.UniqueID: 'Hashy-McHashface'} |
| 41 | + lvl = Clusters.LevelControl.Attributes |
| 42 | + attrs_bi = {bi.DataModelRevision: 1, |
| 43 | + bi.VendorName: 'testVendor', |
| 44 | + bi.ProductName: 'testProduct', |
| 45 | + bi.ProductID: 0x8000, |
| 46 | + bi.NodeLabel: 'label', |
| 47 | + bi.Location: 'XX', |
| 48 | + bi.HardwareVersion: 1, |
| 49 | + bi.HardwareVersionString: 'one', |
| 50 | + bi.SoftwareVersion: 2, |
| 51 | + bi.SoftwareVersionString: 'two', |
| 52 | + bi.ManufacturingDate: 'today', |
| 53 | + bi.PartNumber: 'three', |
| 54 | + bi.ProductURL: 'example.com', |
| 55 | + bi.ProductLabel: 'myProduct', |
| 56 | + bi.SerialNumber: 'ABCD1234', |
| 57 | + bi.LocalConfigDisabled: False, |
| 58 | + bi.UniqueID: 'Hashy-McHashface'} |
58 | 59 | if include_reachable:
|
59 |
| - attrs[bi.Reachable] = True |
| 60 | + attrs_bi[bi.Reachable] = True |
60 | 61 | if include_max_paths:
|
61 |
| - attrs[bi.MaxPathsPerInvoke] = 2 |
| 62 | + attrs_bi[bi.MaxPathsPerInvoke] = 2 |
62 | 63 | if include_vendor_id:
|
63 |
| - attrs[bi.VendorID] = 0xFFF1 |
| 64 | + attrs_bi[bi.VendorID] = 0xFFF1 |
64 | 65 |
|
65 |
| - attrs[bi.AttributeList] = [a.attribute_id for a in attrs.keys()] |
66 |
| - attrs[bi.AcceptedCommandList] = [] |
67 |
| - attrs[bi.GeneratedCommandList] = [] |
68 |
| - attrs[bi.FeatureMap] = 0 |
| 66 | + attrs_bi[bi.AttributeList] = [a.attribute_id for a in attrs_bi.keys()] |
| 67 | + attrs_bi[bi.AcceptedCommandList] = [] |
| 68 | + attrs_bi[bi.GeneratedCommandList] = [] |
| 69 | + attrs_bi[bi.FeatureMap] = 0 |
| 70 | + |
| 71 | + attrs_lvl = {} |
| 72 | + attrs_lvl[lvl.AttributeList] = [] |
| 73 | + attrs_lvl[lvl.AcceptedCommandList] = [] |
| 74 | + attrs_lvl[lvl.GeneratedCommandList] = [] |
| 75 | + attrs_lvl[lvl.FeatureMap] = 0 |
69 | 76 |
|
70 | 77 | resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {})
|
71 |
| - resp.attributes = {0: {Clusters.BasicInformation: attrs}} |
| 78 | + resp.attributes = {0: {Clusters.BasicInformation: attrs_bi, Clusters.LevelControl: attrs_lvl}} |
72 | 79 |
|
73 |
| - tlv_attrs = {a.attribute_id: value for a, value in attrs.items()} |
74 |
| - resp.tlvAttributes = {0: {Clusters.BasicInformation.id: tlv_attrs}} |
| 80 | + tlv_attrs_bi = {a.attribute_id: value for a, value in attrs_bi.items()} |
| 81 | + tlv_attrs_lvl = {a.attribute_id: value for a, value in attrs_lvl.items()} |
| 82 | + resp.tlvAttributes = {0: {Clusters.BasicInformation.id: tlv_attrs_bi, Clusters.LevelControl.id: tlv_attrs_lvl}} |
75 | 83 |
|
76 | 84 | return resp
|
77 | 85 |
|
|
0 commit comments