Skip to content

Conversation

Bruners
Copy link

@Bruners Bruners commented May 3, 2025

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

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

Bruners and others added 4 commits May 3, 2025 13:55
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.
Copy link

codecov bot commented May 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.13%. Comparing base (500e74e) to head (b5467e5).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fweffort
Copy link

fweffort commented May 4, 2025

Any chance we get something for this one as well?
_TZE204_lbbg34rj

@Bruners
Copy link
Author

Bruners commented May 5, 2025

Any chance we get something for this one as well? _TZE204_lbbg34rj

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
.applies_to("_TZE204_lbbg34rj", "TS0601")
and load the custom quirk file to be loaded in HA.

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?

@TheJulianJES TheJulianJES added Tuya Request/PR regarding a Tuya device needs review This PR should be reviewed soon, as it generally looks good. labels May 25, 2025
@TheJulianJES TheJulianJES changed the title Add Tuya mmWave 24Ghz radar, _TZE204_gkfbdvyx Add Tuya mmWave 24Ghz radar _TZE204_gkfbdvyx May 25, 2025
@caevv
Copy link

caevv commented Sep 9, 2025

Can this be merged?

@TheJulianJES TheJulianJES self-assigned this Sep 9, 2025
@puddly puddly added the smash This PR is close to be merged soon label Sep 9, 2025
@PersistentCloud
Copy link

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
@Bruners
Copy link
Author

Bruners commented Oct 1, 2025

Any chance we get something for this one as well? _TZE204_lbbg34rj

Not sure if you have figured out your device yet, but in z2m your device seems to be matched with _TZE204_ex3rcdha

TuyaQuirkBuilder("_TZE204_ex3rcdha", "TS0601")

Copy link
Collaborator

@TheJulianJES TheJulianJES left a 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:

Comment on lines +1648 to +1695
.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",
)
Copy link
Collaborator

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:

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()
)

Copy link
Author

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review This PR should be reviewed soon, as it generally looks good. smash This PR is close to be merged soon Tuya Request/PR regarding a Tuya device

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants