Repository: zigpy/zha-device-handlers
Pull request #3056 (2024-03-20 19:57:24)

Add Moes/Tuya cover `_TZE200_icka1clh`
## Proposed change
adds Moes/Tuya _TZE200_icka1clh cover


## Checklist

I have tested this on my Home assistant instance using a custom quirk.

- [x] The changes are tested and work correctly
- [x] `pre-commit` checks pass / the code has been formatted using Black
- [x] Tests have been added to verify that the new code works


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/zigpy/zha-device-handlers/pull/3056?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 87.91%. Comparing base [(`86fafd6`)](https://app.codecov.io/gh/zigpy/zha-device-handlers/commit/86fafd6aec7501dbe07f00cb0261b909310124af?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy) to head [(`23ace2b`)](https://app.codecov.io/gh/zigpy/zha-device-handlers/pull/3056?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy).
> Report is 5 commits behind head on dev.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##              dev    #3056      +/-   ##
==========================================
+ Coverage   87.86%   87.91%   +0.05%     
==========================================
  Files         301      301              
  Lines        9219     9229      +10     
==========================================
+ Hits         8100     8114      +14     
+ Misses       1119     1115       -4     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/zigpy/zha-device-handlers/pull/3056?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy).


Patch:
diff --git a/zhaquirks/thirdreality/button.py b/zhaquirks/thirdreality/button.py
index fb11d0d..5b0a306 100644
--- a/zhaquirks/thirdreality/button.py
+++ b/zhaquirks/thirdreality/button.py
@@ -107,5 +107,5 @@ class Button(CustomDevice):
         (DOUBLE_PRESS, DOUBLE_PRESS): {COMMAND: COMMAND_DOUBLE},
         (SHORT_PRESS, SHORT_PRESS): {COMMAND: COMMAND_SINGLE},
         (LONG_PRESS, LONG_PRESS): {COMMAND: COMMAND_HOLD},
-        (LONG_RELEASE, LONG_RELEASE): {COMMAND: COMMAND_HOLD},
+        (LONG_RELEASE, LONG_RELEASE): {COMMAND: COMMAND_RELEASE},
     }
diff --git a/zhaquirks/tuya/ts0601_cover.py b/zhaquirks/tuya/ts0601_cover.py
index 570c159..a95b490 100644
--- a/zhaquirks/tuya/ts0601_cover.py
+++ b/zhaquirks/tuya/ts0601_cover.py
@@ -1,4 +1,5 @@
 """Tuya based cover and blinds."""
+
 from zigpy.profiles import zha
 from zigpy.zcl.clusters.general import Basic, Groups, Identify, OnOff, Ota, Scenes, Time
 
@@ -375,6 +376,7 @@ class TuyaMoesCover0601(TuyaWindowCover):
             ("_TZE200_bv1jcqqu", "TS0601"),
             ("_TZE200_nw1r9hp6", "TS0601"),
             ("_TZE200_gaj531w3", "TS0601"),
+            ("_TZE200_icka1clh", "TS0601"),
         ],
         ENDPOINTS: {
             1: {
diff --git a/zhaquirks/tuya/ts0601_dimmer.py b/zhaquirks/tuya/ts0601_dimmer.py
index 70b5713..7359a06 100644
--- a/zhaquirks/tuya/ts0601_dimmer.py
+++ b/zhaquirks/tuya/ts0601_dimmer.py
@@ -151,6 +151,7 @@ class TuyaSingleSwitchDimmerGP(TuyaDimmerSwitch):
             ("_TZE200_ip2akl4w", "TS0601"),
             ("_TZE200_vucankjx", "TS0601"),  # Loratap
             ("_TZE200_y8yjulon", "TS0601"),
+            ("_TZE204_n9ctkb6j", "TS0601"),  # For BSEED switch
         ],
         ENDPOINTS: {
             # <SimpleDescriptor endpoint=1 profile=260 device_type=0x0100


Test patch:
diff --git a/tests/test_tuya_cover.py b/tests/test_tuya_cover.py
new file mode 100644
index 0000000..15279fd
--- /dev/null
+++ b/tests/test_tuya_cover.py
@@ -0,0 +1,21 @@
+"""Test units for Tuya covers."""
+from zhaquirks.tuya.ts0601_cover import TuyaMoesCover0601
+
+
+def test_ts601_moes_signature(assert_signature_matches_quirk):
+    """Test TS0121 cover signature is matched to its quirk."""
+    signature = {
+        "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
+        "endpoints": {
+            "1": {
+                "profile_id": 0x0104,
+                "device_type": "0x0051",
+                "in_clusters": ["0x0000", "0x0004", "0x0005", "0xef00"],
+                "out_clusters": ["0x000a", "0x0019"],
+            }
+        },
+        "manufacturer": "_TZE200_icka1clh",
+        "model": "TS0601",
+        "class": "zigpy.device.Device",
+    }
+    assert_signature_matches_quirk(TuyaMoesCover0601, signature)