Assistance finishing a new quirk? (Moes Tuya Switch TS0726/TZ3002)

Hiya, I’ve been bashing my head against this quirk for the last few weeks. It relates to the device handler request here: Github link (Not my original request but it’s for the same device.) I have commented there but trying here too - anywhere I can get either help, or a suggestion of where I should go next for help, would be great!

This is a Moes Tuya 6-gang mains scene switch, with 3 ‘true’ switch buttons and 3 scene-only buttons. It is supported by Zigbee2MQTT, but we have ZHA so I am trying to get it working there. There are several features which do not appear via ZHA by default - for example, ‘switch mode’ which controls whether a button is a switch or scene-only. They apparently do appear with Z2M.

I don’t have a Tuya gateway, so I’m not able to personally scan for the DPs, but I have been relying on this documentation: Tuya Dev site

It has a separate endpoint for each switch, with clusters duplicated across all/some of them. I also keep reading about and seeing in the code, reference to an 0xEF00 cluster which is apparently a Tuya standard for receiving commands? However there is no mention of this at the link above, or in my scans of the device.

I HAVE been able to get it so that the additional attributes (like ‘switch mode’) are readable and writable via the Manage Zigbee Device menu in HA.

Then via the v2 methods, I have been able to expose those attributes as entities, and they seem to read correctly when the device is paired. However, I am unable to change those attributes via those entities, and it’s driving me mad trying to figure out why. I’m guessing maybe it is trying to do that via EF00, which may not exist for this device?

If anyone may be able to help me, or point me in the right direction to get help, I’m happy to share what I’ve got so far!

Could you provide your v2 way quirks file ?
I just got an 2 gang switch TS0726/TZ3002 having ths same issue.

After 12 hours of continuous debugging, I found the solution for 3 gang bseed switch TS0726 _TZ3002_iedhxgyi

"""BSEED Tuya TS0726 Switches"""

from zigpy.profiles import zgp, zha
from zigpy.zcl.clusters.general import (
    Basic,
    GreenPowerProxy,
    Groups,
    Identify,
    OnOff,
    Ota,
    Scenes,
    Time,
)

from zhaquirks.const import (
    DEVICE_TYPE,
    ENDPOINTS,
    INPUT_CLUSTERS,
    MODEL,
    OUTPUT_CLUSTERS,
    PROFILE_ID,
)
from zhaquirks.tuya import (
    TuyaZBE000Cluster,
    TuyaZBExternalSwitchTypeCluster,
    TuyaZBOnOffAttributeCluster,
)
from zhaquirks.tuya.mcu import EnchantedDevice


class Switch_3G_GPP_Var2(EnchantedDevice):
    """BSEED Tuya 3 gang switch module with."""

    signature = {
        MODEL: "TS0726",
        ENDPOINTS: {
            1: {
                PROFILE_ID: 0x0104,
                DEVICE_TYPE: 0x0004,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    0xE000,
                    0xE001,
                ],
                OUTPUT_CLUSTERS: [
                    Time.cluster_id,
                    Ota.cluster_id,
                ],
            },
            2: {
                PROFILE_ID: 0x0104,
                DEVICE_TYPE: 0x0004,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    0xE001,
                ],
                OUTPUT_CLUSTERS: [],
            },
            3: {
                PROFILE_ID: 0x0104,
                DEVICE_TYPE: 0x0004,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    0xE001,
                ],
                OUTPUT_CLUSTERS: [],
            },
            242: {
                PROFILE_ID: 0xa1e0,
                DEVICE_TYPE: 0x0061,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [
                    0x0021,
                ],
            },
        },
    }

    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: 0x0104,
                DEVICE_TYPE: 0x0004,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                    TuyaZBE000Cluster,
                    TuyaZBExternalSwitchTypeCluster,
                ],
                OUTPUT_CLUSTERS: [
                    Time.cluster_id,
                    Ota.cluster_id,
                ],
            },
            2: {
                PROFILE_ID: 0x0104,
                DEVICE_TYPE: 0x0004,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                    TuyaZBE000Cluster,
                    TuyaZBExternalSwitchTypeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            },
            3: {
                PROFILE_ID: 0x0104,
                DEVICE_TYPE: 0x0004,
                INPUT_CLUSTERS: [
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                    TuyaZBE000Cluster,
                    TuyaZBExternalSwitchTypeCluster,
                ],
                OUTPUT_CLUSTERS: [],
            },
            242: {
                PROFILE_ID: 0xa1e0,
                DEVICE_TYPE: 0x0061,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [
                    0x0021,
                ],
            },
        },
    }