|
8 | 8 | from zigpy.profiles import zha
|
9 | 9 | from zigpy.quirks import CustomDevice
|
10 | 10 | from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration
|
11 |
| -from zigpy.zcl.clusters.measurement import IlluminanceMeasurement, OccupancySensing |
12 | 11 |
|
13 | 12 | from zhaquirks import Bus, LocalDataCluster
|
14 | 13 | from zhaquirks.const import (
|
|
23 | 22 | LocalIlluminanceMeasurementCluster,
|
24 | 23 | MotionCluster,
|
25 | 24 | OccupancyCluster,
|
26 |
| - XiaomiAqaraE1Cluster, |
| 25 | + XiaomiMotionManufacturerCluster, |
27 | 26 | XiaomiPowerConfiguration,
|
28 | 27 | )
|
29 | 28 |
|
|
34 | 33 | _LOGGER = logging.getLogger(__name__)
|
35 | 34 |
|
36 | 35 |
|
37 |
| -class OppleCluster(XiaomiAqaraE1Cluster): |
38 |
| - """Opple cluster.""" |
| 36 | +class OppleCluster(XiaomiMotionManufacturerCluster): |
| 37 | + """Xiaomi manufacturer cluster. |
| 38 | +
|
| 39 | + This uses the shared XiaomiMotionManufacturerCluster implementation |
| 40 | + which parses motion and illuminance reports from Xiaomi devices. |
| 41 | + """ |
39 | 42 |
|
40 | 43 | attributes = {
|
41 | 44 | DETECTION_INTERVAL: ("detection_interval", types.uint8_t, True),
|
42 | 45 | MOTION_SENSITIVITY: ("motion_sensitivity", types.uint8_t, True),
|
43 | 46 | TRIGGER_INDICATOR: ("trigger_indicator", types.uint8_t, True),
|
44 | 47 | }
|
45 | 48 |
|
46 |
| - def _update_attribute(self, attrid: int, value: Any) -> None: |
47 |
| - super()._update_attribute(attrid, value) |
48 |
| - if attrid == MOTION_ATTRIBUTE: |
49 |
| - value = value - 65536 |
50 |
| - self.endpoint.illuminance.update_attribute( |
51 |
| - IlluminanceMeasurement.AttributeDefs.measured_value.id, value |
52 |
| - ) |
53 |
| - self.endpoint.occupancy.update_attribute( |
54 |
| - OccupancySensing.AttributeDefs.occupancy.id, |
55 |
| - OccupancySensing.Occupancy.Occupied, |
56 |
| - ) |
57 |
| - |
58 | 49 | async def write_attributes(
|
59 | 50 | self, attributes: dict[str | int, Any], manufacturer: int | None = None
|
60 | 51 | ) -> list:
|
|
0 commit comments