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_sxm7l9xa #2485

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

arbrandes
Copy link

@arbrandes arbrandes commented Jul 21, 2023

Proposed change

This primarily adds support for the _TZE204_sxm7l9xa Tuya millimeter wave sensor, and in doing so moves TS0601 radar support out of ts0601_motion.py to its own file, ts0601_radar.py.

This should also add control support to previously supported devices.

Additional information

This is a mashup of proposed quirks found mostly on #2378.

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

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Jul 21, 2023
@arbrandes arbrandes force-pushed the ts0601-motion branch 5 times, most recently from d47ce54 to 3c56b06 Compare July 21, 2023 13:10
@arbrandes
Copy link
Author

arbrandes commented Jul 21, 2023

Ok, I'll have to figure out later where we're duplicating 0x000C in the endpoint replacements. Otherwise, this seems to work with my devices when the file as-is is dropped in as a local quirk on Home Assistant 2023.7.2.

(Thought this might be an easy port, but I'm still too much of a quirk newb.)

arbrandes added a commit to arbrandes/zha-device-handlers that referenced this pull request Jul 21, 2023
@arbrandes arbrandes changed the title Add support for more TS0601 sensors and configuration (#2378) Add support for more TS0601 sensors and configuration Jul 21, 2023
arbrandes added a commit to arbrandes/zha-device-handlers that referenced this pull request Jul 25, 2023
Comment on lines 517 to 518
TuyaMmwRadarTargetDistance,
TuyaMmwRadarSensitivity,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AnalogInput cluster ID (extended) is duplicated here.
This Tuya stuff is already somewhat of a workaround everywhere. Are both clusters working correctly here like this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work, yes, though in any case I now removed AnalogInput from the cluster. Not sure if the duplication is gone: I don't think all the tests are running against this PR.

@@ -398,6 +565,7 @@ class MmwRadarMotionGPP(CustomDevice):
("_TZE200_ar0slwnd", "TS0601"),
("_TZE200_sfiy5tfs", "TS0601"),
("_TZE200_mrf6vtua", "TS0601"),
("_TZE204_sxm7l9xa", "TS0601"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

("_TZE204_qasjif9e", "TS0601"), can be added here as well.
I tested locally on my machine and the sensor _TZE204_qasjif9e works perfectly with this quirk.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_TZE204_qasjif9e is not the same as the other devices, the main properties are, however the settings are different and can't be changed this way

Copy link
Author

@arbrandes arbrandes Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. @pgroene has been kind enough to provide a separate PR for that one. 👍🏼

@isoutham
Copy link

isoutham commented Aug 9, 2023

Just to conform this patch fixes ZHA integration for _TZE204_qasjif9e (motion_sensor)

@rrooggiieerr
Copy link

Hi! I'm using this patch for my _TZE204_sxm7l9xa and Occupancy, Detection Delay, Min Range and Max Range are working, however Fading Time and Sensitivity are always set back to 53000 mili seconds and 9, changing these values doesn't work. Also Illuminance is not working.

For the quirk mentioned here Illuminance does work but Occupancy doesn't.

@seanw18
Copy link

seanw18 commented Aug 26, 2023

Hi! I'm using this patch for my _TZE204_sxm7l9xa and Occupancy, Detection Delay, Min Range and Max Range are working, however Fading Time and Sensitivity are always set back to 53000 mili seconds and 9, changing these values doesn't work. Also Illuminance is not working.

Thanks @rrooggiieerr

I've tried this quirk (after removing, restarting, and re-adding device) and I still don't seem to get the ability to change behaviour via "max range".

@danieljonce
Copy link

Thanks for the work on this! I can confirm the occupancy detection is working on my _TZE204_sxm7l9xa. For me all five sliders all seem to reset their values after the occupancy changes state.

arbrandes added a commit to arbrandes/zha-device-handlers that referenced this pull request Sep 4, 2023
And in doing so:

* Move the Tuya MMW radar devices to their own file
* Get the controls working for more devices
@arbrandes arbrandes changed the title Add support for more TS0601 sensors and configuration Add support for _TZE204_sxm7l9xa Sep 4, 2023
@codecov
Copy link

codecov bot commented Sep 4, 2023

Codecov Report

Patch coverage: 62.35% and project coverage change: -0.28% ⚠️

Comparison is base (f99806a) 86.54% compared to head (4c40dba) 86.26%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #2485      +/-   ##
==========================================
- Coverage   86.54%   86.26%   -0.28%     
==========================================
  Files         276      277       +1     
  Lines        8502     8564      +62     
==========================================
+ Hits         7358     7388      +30     
- Misses       1144     1176      +32     
Files Changed Coverage Δ
zhaquirks/tuya/ts0601_radar.py 61.44% <61.44%> (ø)
zhaquirks/tuya/ts0601_motion.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

arbrandes added a commit to arbrandes/zha-device-handlers that referenced this pull request Sep 4, 2023
And in doing so:

* Move the Tuya MMW radar devices to their own file
* Get the controls working for more devices
And in doing so:

* Move the Tuya MMW radar devices to their own file
* Get the controls working for more devices
@arbrandes
Copy link
Author

arbrandes commented Sep 4, 2023

@danieljonce, @seanw18

For me all five sliders all seem to reset their values after the occupancy changes state.

I just updated the PR to fix this, based on some more info I found laying around. It should now be possible to actually change settings on _TZE204_sxm7l9xa.

@danieljonce
Copy link

@arbrandes

I just updated the PR to fix this, based on some more info I found laying around. It should now be possible to actually change settings on _TZE204_sxm7l9xa.

I can confirm that after removing and re-adding my _TZE204_sxm7l9xa in ZHA while having only the ts0601_radar.py file from the commit 4c40dba in the custom quirks folder:

  • Slider settings are saved as expected
  • Presence works
  • Lux works (after a whole system restart)

Thanks again!

@TheJulianJES
Copy link
Collaborator

So #2525 somewhat copied some of this. Since my review comments aren't addressed there (yet?), can you take a look at them? (They mostly apply to this PR too, especially: https://github.com/zigpy/zha-device-handlers/pull/2525/files#r1340849012)

@Kefut
Copy link

Kefut commented Nov 7, 2023

@arbrandes

I just updated the PR to fix this, based on some more info I found laying around. It should now be possible to actually change settings on _TZE204_sxm7l9xa.

I can confirm that after removing and re-adding my _TZE204_sxm7l9xa in ZHA while having only the ts0601_radar.py file from the commit 4c40dba in the custom quirks folder:

  • Slider settings are saved as expected
  • Presence works
  • Lux works (after a whole system restart)

Thanks again!

Did you get target distance working as well? If so, how?

@Kefut
Copy link

Kefut commented Nov 9, 2023

Adding to my last question, one very basic question:
Where can I find general information on how quirks a created/structured. I cannot figure it out 100% by just reading the one above, but would like to understand why I don't see Target distance and illuminance for my _TZE204_ztc6ggyl using this quirk.

@Eiritj
Copy link

Eiritj commented Nov 27, 2023

Any chance this sensor can be supported natively without using quirks?

@adey
Copy link

adey commented Mar 23, 2024

Using this quirk have been successful in adding the device. But somehow it keeps going offline and then coming back online frequently. This is my only zigbee device does this out of about 50 devices I have integrated via ZHA.

Any tips on how to fix this?
Thanks.

image

@chimeranzl
Copy link

Can you add support for _TZE204_mtoaryre please? I tried adding to signatures in .py, it picks up the sensor but all entities are missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet