-
Notifications
You must be signed in to change notification settings - Fork 881
Add Tuya mmWave 24Ghz radar _TZE204_gkfbdvyx
#4044
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
base: dev
Are you sure you want to change the base?
Conversation
This commits adds support for Tuya compatible mmWave 24Ghz ceiling mounted human presence sensor. The unit seems to be in line with _TZE204_ya4ft0w so they could possible be merged if tested. This unit does not like sensitivity set to 0.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4044 +/- ##
=======================================
Coverage 92.12% 92.13%
=======================================
Files 358 358
Lines 11917 11922 +5
=======================================
+ Hits 10979 10984 +5
Misses 938 938 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Any chance we get something for this one as well? |
Would need some more information about the device for that to be possible, you could try to add the identifying string to any of the different models and test for yourself. Just add this to under any of the many tuy motion sensors in zhaquirks/tuya/tuya_motion.py After adding the line in the custom quirk file, you need to restart HA and possibly remove and add the device again. The sensors are different in what data point they use so it is impossible to do without the device on hand. Does it have any labels or anything on the "bottom" of the sensor? |
_TZE204_gkfbdvyx
Can this be merged? |
I've tested this as a custom quirk in ZHA and it works fine. Can someone tell us, when it will be merged? |
Add _TZE_200_gkfbdvyx as reported in comments for zigpy#3990 Add a new presence state that reflects what is reported by the Tuya app. Change from radar sensitivity to motion sensitivity to mimic the tuya app
Not sure if you have figured out your device yet, but in z2m your device seems to be matched with _TZE204_ex3rcdha zha-device-handlers/zhaquirks/tuya/tuya_motion.py Line 1524 in 500e74e
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, finally got to this. This looks good for the most part. Three small things:
move
->movement
presence_timeout
->fading_time
(for consistency)- and maybe consider if we wanna clone
base_tuya_motion
for the first DPs: https://github.com/zigpy/zha-device-handlers/pull/4044/files#r2408042537. Not a must, as the values don't really match, just a suggestion.
.tuya_number( | ||
dp_id=2, | ||
attribute_name="motion_sensitivity", | ||
type=t.uint16_t, | ||
min_value=1, | ||
max_value=10, | ||
step=1, | ||
translation_key="motion_sensitivity", | ||
fallback_name="Motion sensitivity", | ||
) | ||
.tuya_number( | ||
dp_id=3, | ||
attribute_name="detection_distance_min", | ||
type=t.uint16_t, | ||
multiplier=0.01, | ||
device_class=SensorDeviceClass.DISTANCE, | ||
unit=UnitOfLength.METERS, | ||
min_value=0, | ||
max_value=6, | ||
step=0.5, | ||
translation_key="detection_distance_min", | ||
fallback_name="Minimum range", | ||
) | ||
.tuya_number( | ||
dp_id=4, | ||
attribute_name="detection_distance_max", | ||
type=t.uint16_t, | ||
multiplier=0.01, | ||
device_class=SensorDeviceClass.DISTANCE, | ||
unit=UnitOfLength.METERS, | ||
min_value=0.5, | ||
max_value=9, # tested on 6m | ||
step=0.5, | ||
translation_key="detection_distance_max", | ||
fallback_name="Maximum range", | ||
) | ||
.tuya_sensor( | ||
dp_id=9, | ||
attribute_name="distance", | ||
type=t.uint16_t, | ||
state_class=SensorStateClass.MEASUREMENT, | ||
device_class=SensorDeviceClass.DISTANCE, | ||
unit=UnitOfLength.METERS, | ||
multiplier=0.1, | ||
entity_type=EntityType.STANDARD, | ||
translation_key="target_distance", | ||
fallback_name="Target distance", | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to clone base_tuya_motion.clone()
for DP IDs 2, 3, 4, and 9? Or are the values too different? The values for base_tuya_motion
for reference:
zha-device-handlers/zhaquirks/tuya/tuya_motion.py
Lines 182 to 234 in 500e74e
base_tuya_motion = ( | |
TuyaQuirkBuilder() | |
.adds(TuyaOccupancySensing) | |
.tuya_number( | |
dp_id=2, | |
attribute_name="move_sensitivity", | |
type=t.uint16_t, | |
min_value=0, | |
max_value=10, | |
step=1, | |
translation_key="move_sensitivity", | |
fallback_name="Motion sensitivity", | |
) | |
.tuya_number( | |
dp_id=3, | |
attribute_name="detection_distance_min", | |
type=t.uint16_t, | |
device_class=SensorDeviceClass.DISTANCE, | |
unit=UnitOfLength.METERS, | |
min_value=0, | |
max_value=8.25, | |
step=0.75, | |
multiplier=0.01, | |
translation_key="detection_distance_min", | |
fallback_name="Minimum range", | |
) | |
.tuya_number( | |
dp_id=4, | |
attribute_name="detection_distance_max", | |
type=t.uint16_t, | |
device_class=SensorDeviceClass.DISTANCE, | |
unit=UnitOfLength.METERS, | |
min_value=0.75, | |
max_value=9.0, | |
step=0.75, | |
multiplier=0.01, | |
translation_key="detection_distance_max", | |
fallback_name="Maximum range", | |
) | |
.tuya_sensor( | |
dp_id=9, | |
attribute_name="distance", | |
type=t.uint16_t, | |
divisor=100, | |
state_class=SensorStateClass.MEASUREMENT, | |
device_class=SensorDeviceClass.DISTANCE, | |
unit=UnitOfLength.METERS, | |
entity_type=EntityType.STANDARD, | |
translation_key="distance", | |
fallback_name="Target distance", | |
) | |
.skip_configuration() | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sensor model (i have two) does not like sensitivity set to 0, it seems to crash and stops responding until it is reset and paired again. i don't know how much the different steps and values do to the sensor or if they work at all in between values but this allegedly what the Tuya app says for this sensor.
My best guess is to not copy the base and i don't see a reason to do it unless it can be verified that it is actually working correctly with those numbers. In the long run with more sensors with different capabilites coming all the time, it is not better for readability or code maintenance to continue to use that base.
Change enum from Move to Movement Change attribute name from presence_timeout to fading_time
Proposed change
This commits adds support for Tuya compatible mmWave 24Ghz ceiling mounted human presence sensor. The unit seems to be in line with _TZE204_ya4ft0w so they could possible be merged if tested. This unit does not like sensitivity set to 0.
Checklist
pre-commit
checks pass / the code has been formatted using Black