Skip to content

Commit 9ccb69a

Browse files
authored
Fix Aqara motion sensor erroneous motion events (#2779)
1 parent ef83953 commit 9ccb69a

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

zhaquirks/xiaomi/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import zigpy.device
1212
from zigpy.profiles import zha
1313
from zigpy.quirks import CustomCluster, CustomDevice
14+
from zigpy.typing import AddressingMode
1415
from zigpy.zcl import foundation
1516
from zigpy.zcl.clusters.general import (
1617
AnalogInput,
@@ -543,6 +544,19 @@ class MotionCluster(LocalDataCluster, MotionOnEvent):
543544
reset_s: int = 70
544545

545546

547+
class LocalOccupancyCluster(LocalDataCluster, OccupancyCluster):
548+
"""Local occupancy cluster that ignores messages from device."""
549+
550+
def handle_cluster_general_request(
551+
self,
552+
hdr: zigpy.zcl.foundation.ZCLHeader,
553+
args: list,
554+
*,
555+
dst_addressing: AddressingMode | None = None,
556+
) -> None:
557+
"""Ignore occupancy attribute reports on this cluster, as they're invalid and sent by the sensor every hour."""
558+
559+
546560
class DeviceTemperatureCluster(LocalDataCluster, DeviceTemperature):
547561
"""Device Temperature Cluster."""
548562

zhaquirks/xiaomi/aqara/motion_agl02.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Xiaomi aqara T1 motion sensor device."""
2+
from __future__ import annotations
3+
24
from zigpy.profiles import zha
35
from zigpy.zcl.clusters.general import Identify, Ota
46
from zigpy.zcl.clusters.measurement import IlluminanceMeasurement, OccupancySensing
@@ -16,8 +18,8 @@
1618
LUMI,
1719
BasicCluster,
1820
IlluminanceMeasurementCluster,
21+
LocalOccupancyCluster,
1922
MotionCluster,
20-
OccupancyCluster,
2123
XiaomiAqaraE1Cluster,
2224
XiaomiCustomDevice,
2325
XiaomiPowerConfiguration,
@@ -78,7 +80,7 @@ def __init__(self, *args, **kwargs):
7880
BasicCluster,
7981
XiaomiPowerConfiguration,
8082
Identify.cluster_id,
81-
OccupancyCluster,
83+
LocalOccupancyCluster,
8284
MotionCluster,
8385
IlluminanceMeasurementCluster,
8486
XiaomiManufacturerCluster,

zhaquirks/xiaomi/aqara/motion_agl04.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
)
2020
from zhaquirks.xiaomi import (
2121
DeviceTemperatureCluster,
22+
LocalOccupancyCluster,
2223
MotionCluster,
23-
OccupancyCluster,
2424
XiaomiAqaraE1Cluster,
2525
XiaomiCustomDevice,
2626
XiaomiPowerConfiguration,
@@ -98,7 +98,7 @@ def __init__(self, *args, **kwargs):
9898
XiaomiPowerConfiguration,
9999
Identify.cluster_id,
100100
DeviceTemperatureCluster,
101-
OccupancyCluster,
101+
LocalOccupancyCluster,
102102
LocalMotionCluster,
103103
OppleCluster,
104104
],

0 commit comments

Comments
 (0)