Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for _TZE204_ijxvkhd0 #3876

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/test_tuya_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
ZCL_TUYA_MOTION_V5 = b"\tL\x01\x00\x05\x01\x01\x00\x01\x04" # DP 1, motion is 0x04
ZCL_TUYA_MOTION_V6 = b"\tL\x01\x00\x05\x01\x04\x00\x01\x02" # DP 1, enum
ZCL_TUYA_MOTION_v7 = b"\tL\x01\x00\x05\x01\x01\x00\x01\x00" # DP 1, Inv
ZCL_TUYA_MOTION_V8 = (
b"\tL\x01\x00\x05\x70\x01\x00\x01\x01" # DP 112 (0x70), value=1 (occupied)
)


zhaquirks.setup()
Expand Down Expand Up @@ -62,6 +65,7 @@
("_TZE204_dapwryy7", "TS0601", ZCL_TUYA_MOTION_V6),
("_TZE204_uxllnywp", "TS0601", ZCL_TUYA_MOTION_V5),
("_TZE200_gjldowol", "TS0601", ZCL_TUYA_MOTION),
("_TZE204_ijxvkhd0", "TS0601", ZCL_TUYA_MOTION_V8),
],
)
async def test_tuya_motion_quirk_occ(zigpy_device_from_v2_quirk, model, manuf, occ_msg):
Expand Down
71 changes: 71 additions & 0 deletions zhaquirks/tuya/tuya_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,3 +1290,74 @@ class TuyaSensitivityMode(t.enum8):
.skip_configuration()
.add_to_registry()
)

# Tuya 24G MmWave radar human presence motion sensor ZY-M100-24G
(
TuyaQuirkBuilder("_TZE204_ijxvkhd0", "TS0601")
.tuya_dp(
dp_id=112,
ep_attribute=TuyaOccupancySensing.ep_attribute,
attribute_name=OccupancySensing.AttributeDefs.occupancy.name,
converter=lambda x: x == 1,
)
.adds(TuyaOccupancySensing)
.tuya_illuminance(dp_id=104)
.tuya_sensor(
dp_id=109,
attribute_name="distance",
type=t.uint16_t,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.DISTANCE,
unit=UnitOfLength.METERS,
multiplier=0.01, # Correct conversion from cm to meters
translation_key="distance",
fallback_name="Target distance",
)
.tuya_number(
dp_id=107,
attribute_name="max_range",
type=t.uint16_t,
device_class=SensorDeviceClass.DISTANCE,
unit=UnitOfLength.METERS,
min_value=1.5, # Direct meter values instead of cm
max_value=5.5,
step=1.0,
multiplier=0.01, # Replaces divisor=100
translation_key="max_range",
fallback_name="Maximum range",
)
.tuya_number(
dp_id=106,
attribute_name="motion_sensitivity",
type=t.uint8_t,
min_value=1,
max_value=10,
step=1,
translation_key="motion_sensitivity",
fallback_name="Motion sensitivity",
)
.tuya_number(
dp_id=111,
attribute_name="presence_sensitivity",
type=t.uint8_t,
min_value=1,
max_value=10,
step=1,
translation_key="presence_sensitivity",
fallback_name="Presence sensitivity",
)
.tuya_number(
dp_id=110,
attribute_name="presence_timeout",
type=t.uint16_t,
device_class=SensorDeviceClass.DURATION,
unit=UnitOfTime.SECONDS,
min_value=1,
max_value=1500,
step=1,
translation_key="presence_timeout",
fallback_name="Presence timeout",
)
.skip_configuration()
.add_to_registry()
)
Loading