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 quirk for TZ3000 #3481

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Add quirk for TZ3000 #3481

wants to merge 3 commits into from

Conversation

hangy
Copy link

@hangy hangy commented Nov 3, 2024

Adds support for UseeLink 302EU-Zigbee, based on #1632 (comment)

hangy and others added 2 commits November 3, 2024 15:35
Adds support for UseeLink 302EU-Zigbee, based onhttps://github.com/zigpy/issues/1632#issuecomment-1627072807

Co-authored-by: ingoratsdorf <[email protected]>
Copy link

codecov bot commented Nov 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.44%. Comparing base (728ee42) to head (f8e2119).
Report is 15 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #3481   +/-   ##
=======================================
  Coverage   89.44%   89.44%           
=======================================
  Files         311      311           
  Lines       10033    10036    +3     
=======================================
+ Hits         8974     8977    +3     
  Misses       1059     1059           

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


🚨 Try these New Features:

@kender65
Copy link

kender65 commented Nov 5, 2024

Hi!
Based on the description "UseeLink 302EU-Zigbee" I guess this is the device in question.
Wouldn't it be better to name the class "Plug_4AC_4USB_TZ3000_cfnprab5" to make it clear, that it has 4 USB (3 x USB-A, 1 x USB-C) ports?
I got this SM-302Ez-PA20 which looks nearly the same. But I think mine has the ability to set "child_lock" and at least to control the "power_outage_memory" (or "power_on_state") as mentioned here. Initially I integrated this power strip with Z2M on HAOS although not listed as a supported device. Pairing went well but surprisingly it showed up as SM-0306E-2W which caused the wrong picture of the device on the Z2M UI. I was able to toggle the outlets and USB ports like in ZHA and additionally could set the "power_outage_memory" to it's expected values "on", "off", "restore" from the Z2M UI and it worked as expected although I got an error message for an "UNSUPPORTED_ATTRIBUTE". The same goes for the "child_lock". Setting from the UI to both values worked as expected despite an "UNSUPPORTED_ATTRIBUTE" message. I think the behaviour matches the comment from @javicalle as the "power_outage_memory" was only visible for endpoint 1 (and as general attribute which may be forced the error message).

To figure out what was the problem I tried the other way with ZHA, which I haven't used until then.
I got it working with your quirk, thanks for that. Toggling the 4 AC outlets and the USB ports as a group from the ZHA UI and / or from the developer tools works without issues.
image
Further configuration for "power_on_state", "power_outage_memory" or "start_up_on_off", or whatever you would call it, doesn't work so I extended your quirk with "quirk_id = TUYA_PLUG_ONOFF" in the hope of getting "child_lock" and "power_outage_memory" / "power_on_state" working. I got additional attributes in the "TuyaZBOnOffAttributeCluster"
image
but haven't been able to get it working. I couldn't set the value to "on", "off" or "restore". Initially it has the value "None".
The same is for
image
Any idea how to get it working, for at least endpoint 1?

@hangy
Copy link
Author

hangy commented Nov 13, 2024

Hi!

🙋‍♂️

Based on the description "UseeLink 302EU-Zigbee" I guess this is the device in question.

That's the one.

Wouldn't it be better to name the class "Plug_4AC_4USB_TZ3000_cfnprab5" to make it clear, that it has 4 USB (3 x USB-A, 1 x USB-C) ports?

Fair point! Maybe just _USB_ or _1USB_, as all USB ports can only be switched on or off as one group? I haven't looked at that many quirks, yet, so I'm not aware of a naming convention for a case like this.

I got this SM-302Ez-PA20 which looks nearly the same. But I think mine has the ability to set "child_lock" and at least to control the "power_outage_memory" (or "power_on_state") as mentioned here. Initially I integrated this power strip with Z2M on HAOS although not listed as a supported device. Pairing went well but surprisingly it showed up as SM-0306E-2W which caused the wrong picture of the device on the Z2M UI. I was able to toggle the outlets and USB ports like in ZHA and additionally could set the "power_outage_memory" to it's expected values "on", "off", "restore" from the Z2M UI and it worked as expected although I got an error message for an "UNSUPPORTED_ATTRIBUTE". The same goes for the "child_lock". Setting from the UI to both values worked as expected despite an "UNSUPPORTED_ATTRIBUTE" message. I think the behaviour matches the comment from @javicalle as the "power_outage_memory" was only visible for endpoint 1 (and as general attribute which may be forced the error message).

To figure out what was the problem I tried the other way with ZHA, which I haven't used until then. I got it working with your quirk, thanks for that. Toggling the 4 AC outlets and the USB ports as a group from the ZHA UI and / or from the developer tools works without issues. image Further configuration for "power_on_state", "power_outage_memory" or "start_up_on_off", or whatever you would call it, doesn't work so I extended your quirk with "quirk_id = TUYA_PLUG_ONOFF" in the hope of getting "child_lock" and "power_outage_memory" / "power_on_state" working. I got additional attributes in the "TuyaZBOnOffAttributeCluster" image but haven't been able to get it working. I couldn't set the value to "on", "off" or "restore". Initially it has the value "None". The same is for image Any idea how to get it working, for at least endpoint 1?

I'm not too experience with zigpy or ZHA, so I guess we're both figuring it out in parallel. 😉
For my device, the "Startverhalten" also seems to accept the start_up_on_off value:
ZHA screen in Home Assistant showing the different switches of the board with different power-on states
THA screen of Home Assistant showing the 0x4003 property of the 0x0006 cluster endpoint 2
Unfortunately, I cannot test whether this actually works right now, because the plug is neatly hidden behind a cabinet. It does look like the values are mapped and accepted by the device, though.

As for the child_lock, my power strip doesn't accept setting them at all, and only returns None. To be honest, that sounds about right, though. The child_lock property seems to be displayed for each switch, but if it was actually supported/worked, I'd expect there to be one child_lock setting for the main power button, and the main button as a separate cluster. Having different child lock settings for each socket doesn't make too much sense

@TheJulianJES TheJulianJES added the Tuya Request/PR regarding a Tuya device label Nov 24, 2024
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.

3 participants