Skip to content

Conversation

@SimonIT
Copy link
Contributor

@SimonIT SimonIT commented Dec 8, 2025

Proposed change

Adds a quirk to support HOBEIAN ZG-101ZL. Fixes #4413

Additional information

Device diagnostics

zha-01K4JWJ9DDNB1VAA06YSTX8NTT-HOBEIAN ZG-101ZL-9abbcf89b43dd44cc8d4c2eb4a75505f.json

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
  • Device diagnostics data has been attached

@SimonIT
Copy link
Contributor Author

SimonIT commented Dec 8, 2025

Not sure how I can prevent the test to fail. I tried to make a quirk v2, but it doesn't work:

"""HOBEIAN ZG-101ZL button quirk."""

from zigpy.profiles import zha
from zigpy.quirks.v2 import QuirkBuilder

from zhaquirks.const import (
    BUTTON_1,
    COMMAND,
    DOUBLE_PRESS,
    ENDPOINT_ID,
    LONG_PRESS,
    SHORT_PRESS,
)

"""HOBEIAN ZG-101ZL button quirk for proper button event handling."""
(
    QuirkBuilder("HOBEIAN", "ZG-101ZL")
    .replaces_endpoint(1, device_type=zha.DeviceType.REMOTE_CONTROL)
    .device_automation_triggers(
        {
            (SHORT_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: SHORT_PRESS},
            (DOUBLE_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: DOUBLE_PRESS},
            (LONG_PRESS, BUTTON_1): {ENDPOINT_ID: 1, COMMAND: LONG_PRESS},
        }
    )
    .add_to_registry()
)

@Ivoz
Copy link

Ivoz commented Jan 4, 2026

@SimonIT I followed the example for the sonoff, here and both my buttons seem to work (different names / designs / companies, but seemingly have exactly the same behaviour).

This makes both eWelink CK-TLSR8656-SS5-01(7000) and this HOBEIAN ZG-101ZL button have valid press / double press / continuous press events show up

I added

config/zha_quirks/ewelink_TLSR8656.py
"""Device handler for CK-TLSR8656-SS5-01(7000)"""

from zigpy.quirks.v2 import QuirkBuilder

from zhaquirks.const import (
    BUTTON,
    COMMAND,
    COMMAND_OFF,
    COMMAND_ON,
    COMMAND_TOGGLE,
    DOUBLE_PRESS,
    LONG_PRESS,
    SHORT_PRESS,
)

(
    QuirkBuilder("eWeLink", "CK-TLSR8656-SS5-01(7000)")
    .also_applies_to("HOBEIAN", "ZG-101ZL")
    .device_automation_triggers(
        {
            (SHORT_PRESS, BUTTON): {COMMAND: COMMAND_TOGGLE},
            (DOUBLE_PRESS, BUTTON): {COMMAND: COMMAND_ON},
            (LONG_PRESS, BUTTON): {COMMAND: COMMAND_OFF},
        }
    )
    .add_to_registry()
)

and in

configuration.yaml

zha:
  database_path: /config/zigbee.db
  enable_quirks: true
  custom_quirks_path: /config/zha_quirks/

So, I would guess we could just add both these buttons as also_applies_to's of the sonoff button in the above file I linked

@SimonIT
Copy link
Contributor Author

SimonIT commented Jan 6, 2026

Are you sure that adding the device_automation_triggers is enough? In the v1 quirk, I think a TuyaSmartRemoteOnOffCluster is added and the DEVICE_TYPE is changed. But I'm no expert

@Ivoz
Copy link

Ivoz commented Jan 7, 2026

All I know is that it makes ZHA recognise the proper events firing when I do the three types of button press, and then I can use those easily as triggers for automations. I'm quite new to home assistant / ZHA so I'm not sure if there's anything else that's needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Device Support Request] HOBEIAN ZG-101ZL

2 participants