Skip to content

Commit

Permalink
Fix _TZ3000_zl1kmjqx with empty model string (zigpy#3264)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpizquierdo authored Sep 26, 2024
1 parent 2bdd076 commit 7816838
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
13 changes: 12 additions & 1 deletion tests/test_quirks.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,18 @@ def test_quirk_quickinit(quirk: zigpy.quirks.CustomDevice) -> None:
assert isinstance(ep_data[OUTPUT_CLUSTERS], list)


@pytest.mark.parametrize("quirk", ALL_QUIRK_CLASSES)
@pytest.mark.parametrize(
"quirk",
[
quirk_cls
for quirk_cls in ALL_QUIRK_CLASSES
if quirk_cls
not in (
# Some devices have empty model info:
zhaquirks.tuya.ty0201.TuyaTempHumiditySensorNoModel,
)
],
)
def test_signature(quirk: CustomDevice) -> None:
"""Make sure signature look sane for all custom devices."""

Expand Down
14 changes: 13 additions & 1 deletion zhaquirks/tuya/ty0201.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class TuyaTempHumiditySensor(CustomDevice):
# <SimpleDescriptor endpoint=1, profile=260, device_type="0x0302"
# input_clusters=["0x000", "0x0001", "0x0003", "0x0402", "0x0405"]
# output_clusters=["0x0019"]>
MODELS_INFO: [("_TZ3000_bjawzodf", "TY0201"), ("_TZ3000_zl1kmjqx", "TY0201")],
MODELS_INFO: [
("_TZ3000_bjawzodf", "TY0201"),
("_TZ3000_zl1kmjqx", "TY0201"),
],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
Expand Down Expand Up @@ -59,3 +62,12 @@ class TuyaTempHumiditySensor(CustomDevice):
},
},
}


class TuyaTempHumiditySensorNoModel(TuyaTempHumiditySensor):
"""Temu/Aliexpress temperature and humidity sensor with empty model."""

signature = {
MODELS_INFO: [("_TZ3000_zl1kmjqx", "")],
ENDPOINTS: TuyaTempHumiditySensor.signature[ENDPOINTS],
}

0 comments on commit 7816838

Please sign in to comment.