Repository: zigpy/zha-device-handlers

Issue:
[Device Support Request] TS011F _TZ3000_3zofvcaa Zemismart Zigbee Smart Wall Socket ZTB242 (2 AC plugs + 1 USB type A + 1 USB type C)
**Is your feature request related to a problem? Please describe.**
Device is detected and reports status OK when the command is made from the device itself.
When the command is made from the HA, it triggers all endpoints at once.

**Describe the solution you'd like**
Add support for sending commands from HA for each endpoint separately.

<details>
<!-- Device signature can be acquired by clicking on the "Zigbee Device Signature" button in the device settings view -->
<summary>Device signature</summary>

```yaml
{
  "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x010a",
      "in_clusters": [
        "0x0000",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0xe000",
        "0xe001"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "2": {
      "profile_id": 260,
      "device_type": "0x010a",
      "in_clusters": [
        "0x0004",
        "0x0005",
        "0x0006",
        "0xe001"
      ],
      "out_clusters": []
    },
    "3": {
      "profile_id": 260,
      "device_type": "0x010a",
      "in_clusters": [
        "0x0004",
        "0x0005",
        "0x0006",
        "0xe001"
      ],
      "out_clusters": []
    },
    "4": {
      "profile_id": 260,
      "device_type": "0x010a",
      "in_clusters": [
        "0x0004",
        "0x0005",
        "0x0006",
        "0xe001"
      ],
      "out_clusters": []
    },
    "242": {
      "profile_id": 41440,
      "device_type": "0x0061",
      "in_clusters": [],
      "out_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "_TZ3000_3zofvcaa",
  "model": "TS011F",
  "class": "zigpy.device.Device"
}
```

</details>

<details>
<!-- Diagnostic information can be acquired by clicking on the "Download Diagnostics" button in the device settings view -->
<summary>Diagnostic information</summary>

```yaml
{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.5.5",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.9",
    "docker": true,
    "arch": "aarch64",
    "timezone": "America/Recife",
    "os_name": "Linux",
    "os_version": "5.15.32-v8",
    "supervisor": "2022.05.3",
    "host_os": "Home Assistant OS 8.0",
    "docker_version": "20.10.14",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "zha_toolkit": {
      "version": "v0.8.8",
      "requirements": []
    },
    "hacs": {
      "version": "1.24.5",
      "requirements": [
        "aiogithubapi>=21.11.0"
      ]
    },
    "multiscrape": {
      "version": "6.2.0",
      "requirements": [
        "lxml",
        "beautifulsoup4==4.10.0"
      ]
    },
    "alexa_media": {
      "version": "3.11.3",
      "requirements": [
        "alexapy==1.25.5",
        "packaging>=20.3",
        "wrapt>=1.12.1"
      ]
    },
    "smartir": {
      "version": "1.17.6",
      "requirements": [
        "aiofiles==0.6.0"
      ]
    },
    "climate_ip": {
      "version": "3.5.2",
      "requirements": [
        "requests>=2.21.0",
        "xmljson>=0.2.0"
      ]
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "requirements": [
      "bellows==0.29.0",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.73",
      "zigpy-deconz==0.16.0",
      "zigpy==0.45.1",
      "zigpy-xbee==0.14.0",
      "zigpy-zigate==0.7.4",
      "zigpy-znp==0.7.0"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*tubeszb*",
        "known_devices": [
          "TubesZB Coordinator"
        ]
      },
      {
        "vid": "1A86",
        "pid": "7523",
        "description": "*zigstar*",
        "known_devices": [
          "ZigStar Coordinators"
        ]
      },
      {
        "vid": "1CF1",
        "pid": "0030",
        "description": "*conbee*",
        "known_devices": [
          "Conbee II"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8A2A",
        "description": "*zigbee*",
        "known_devices": [
          "Nortek HUSBZB-1"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga"
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      }
    ],
    "after_dependencies": [
      "usb",
      "zeroconf"
    ],
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp"
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 22411,
    "manufacturer": "_TZ3000_3zofvcaa",
    "model": "TS011F",
    "name": "_TZ3000_3zofvcaa TS011F",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4417,
    "power_source": "Mains",
    "lqi": 255,
    "rssi": -81,
    "last_seen": "2022-06-06T16:31:38",
    "available": true,
    "device_type": "Router",
    "signature": {
      "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, manufacturer_code=4417, maximum_buffer_size=66, maximum_incoming_transfer_size=66, server_mask=10752, maximum_outgoing_transfer_size=66, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)",
      "endpoints": {
        "1": {
          "profile_id": 260,
          "device_type": "0x010a",
          "in_clusters": [
            "0x0000",
            "0x0003",
            "0x0004",
            "0x0005",
            "0x0006",
            "0xe000",
            "0xe001"
          ],
          "out_clusters": [
            "0x000a",
            "0x0019"
          ]
        },
        "2": {
          "profile_id": 260,
          "device_type": "0x010a",
          "in_clusters": [
            "0x0004",
            "0x0005",
            "0x0006",
            "0xe001"
          ],
          "out_clusters": []
        },
        "3": {
          "profile_id": 260,
          "device_type": "0x010a",
          "in_clusters": [
            "0x0004",
            "0x0005",
            "0x0006",
            "0xe001"
          ],
          "out_clusters": []
        },
        "4": {
          "profile_id": 260,
          "device_type": "0x010a",
          "in_clusters": [
            "0x0004",
            "0x0005",
            "0x0006",
            "0xe001"
          ],
          "out_clusters": []
        },
        "242": {
          "profile_id": 41440,
          "device_type": "0x0061",
          "in_clusters": [],
          "out_clusters": [
            "0x0021"
          ]
        }
      }
    },
    "entities": [
      {
        "entity_id": "button.tz3000_3zofvcaa_ts011f_099182c5_identify",
        "name": "_TZ3000_3zofvcaa TS011F"
      },
      {
        "entity_id": "switch.tz3000_3zofvcaa_ts011f_099182c5_on_off",
        "name": "_TZ3000_3zofvcaa TS011F"
      },
      {
        "entity_id": "switch.tz3000_3zofvcaa_ts011f_099182c5_on_off_2",
        "name": "_TZ3000_3zofvcaa TS011F"
      },
      {
        "entity_id": "switch.tz3000_3zofvcaa_ts011f_099182c5_on_off_3",
        "name": "_TZ3000_3zofvcaa TS011F"
      },
      {
        "entity_id": "switch.tz3000_3zofvcaa_ts011f_099182c5_on_off_4",
        "name": "_TZ3000_3zofvcaa TS011F"
      }
    ],
    "neighbors": [],
    "endpoint_names": [
      {
        "name": "ON_OFF_PLUG_IN_UNIT"
      },
      {
        "name": "ON_OFF_PLUG_IN_UNIT"
      },
      {
        "name": "ON_OFF_PLUG_IN_UNIT"
      },
      {
        "name": "ON_OFF_PLUG_IN_UNIT"
      },
      {
        "name": "unknown 97 device_type of 0xa1e0 profile id"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "273f9b4d5dfea30117bf909a4287836d",
    "area_id": null
  }
}
```

</details>

<details>
<summary>Additional logs</summary>

```
From device (I only pressed to turn ON endpoint 4):

2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received ZCL frame: b'\x08\xd3\n\x00\x00\x10\x01'
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=211, command_id=10, *is_reply=True)
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.true: 1>))])
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received command 0x0A (TSN 211): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.true: 1>))])
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Attribute report received: on_off=<Bool.true: 1>
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=211, command_id=<GeneralCommand.Default_Response: 11>, *is_reply=True)
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Sending reply: Default_Response(command_id=10, status=<Status.SUCCESS: 0>)
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received ZCL frame: b'\x08\xd3\n\x00\x00\x10\x01'
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=0, reserved=0, *is_cluster=False, *is_general=True), tsn=211, command_id=10, *is_reply=True)
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.true: 1>))])
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received command 0x0A (TSN 211): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.true: 1>))])
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Attribute report received: on_off=<Bool.true: 1>
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Sending reply header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=False, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=211, command_id=<GeneralCommand.Default_Response: 11>, *is_reply=True)
2022-06-06 17:11:51 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Sending reply: Default_Response(command_id=10, status=<Status.SUCCESS: 0>)

From HA (I only pressed to turn OFF endpoint 4):

2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=False, is_reply=0, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False), tsn=223, command_id=0, *is_reply=False)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Sending request: off()
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received ZCL frame: b'\x18\xdf\x0b\x00\x00'
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=223, command_id=11, *is_reply=True)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame: OnOff:Default_Response(command_id=0, status=<Status.SUCCESS: 0>)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:1:0x0006] Received ZCL frame: b'\x18\xd4\n\x00\x00\x10\x00'
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:1:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=212, command_id=10, *is_reply=True)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:1:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:1:0x0006] Received command 0x0A (TSN 212): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:1:0x0006] Attribute report received: on_off=<Bool.false: 0>
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:2:0x0006] Received ZCL frame: b'\x18\xd5\n\x00\x00\x10\x00'
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:2:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=213, command_id=10, *is_reply=True)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:2:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:2:0x0006] Received command 0x0A (TSN 213): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:2:0x0006] Attribute report received: on_off=<Bool.false: 0>
2022-06-06 17:13:31 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x578B:4:0x0006]: executed 'off' command with args: '()' kwargs: '{}' result: Default_Response(command_id=0, status=<Status.SUCCESS: 0>)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:3:0x0006] Received ZCL frame: b'\x18\xd6\n\x00\x00\x10\x00'
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:3:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=214, command_id=10, *is_reply=True)
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:3:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:3:0x0006] Received command 0x0A (TSN 214): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:3:0x0006] Attribute report received: on_off=<Bool.false: 0>
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received ZCL frame: b'\x18\xd7\n\x00\x00\x10\x00'
2022-06-06 17:13:31 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, is_reply=1, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=215, command_id=10, *is_reply=True)
2022-06-06 17:13:32 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Decoded ZCL frame: OnOff:Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:32 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Received command 0x0A (TSN 215): Report_Attributes(attribute_reports=[Attribute(attrid=0x0000, value=TypeValue(type=Bool, value=<Bool.false: 0>))])
2022-06-06 17:13:32 DEBUG (MainThread) [zigpy.zcl] [0x578B:4:0x0006] Attribute report received: on_off=<Bool.false: 0>
```

</details>

**Additional context**
Does anyone have any suggestion where I could start ?
I have already copied and modified some examples from https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts011f_plug.py and https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts011f_switch.py but no success.
![VideoEditor_20220606_052113_1](https://user-images.githubusercontent.com/963510/172242800-c5b81e87-f583-4fa3-a2d4-90993325be19.gif)
![20220606_163044](https://user-images.githubusercontent.com/963510/172242857-d8fa2bc8-e62a-4883-86f7-4c929ed40354.jpg)

When paired with Smart Life, all 4 endpoints work independently.


Discussion:
LIDL is having one 3 AC with 4 USB that was working OK but new batch having one new firmware that is making the same as you device.
Try patching this quirk for your device https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/lidl/ts011f_plug.py and very likely you can getting all endpoints working OK from ZHA.

Its called "tuya magic spell" ;-))

Resolving patch:
diff --git a/zhaquirks/tuya/ts011f_plug.py b/zhaquirks/tuya/ts011f_plug.py
--- a/zhaquirks/tuya/ts011f_plug.py
+++ b/zhaquirks/tuya/ts011f_plug.py
@@ -20,6 +20,7 @@
     ENDPOINTS,
     INPUT_CLUSTERS,
     MODEL,
+    MODELS_INFO,
     OUTPUT_CLUSTERS,
     PROFILE_ID,
 )
@@ -31,6 +32,7 @@
     TuyaZBMeteringCluster,
     TuyaZBOnOffAttributeCluster,
 )
+from zhaquirks.tuya.mcu import EnchantedDevice
 
 
 class Plug(CustomDevice):
@@ -151,6 +153,143 @@ class Plug_1AC(CustomDevice):
     }
 
 
+class Plug_2AC_2USB(EnchantedDevice):
+    """Tuya 2 outlet + 2 USB with restore power state support."""
+
+    signature = {
+        MODELS_INFO: [("_TZ3000_3zofvcaa", "TS011F")],
+        ENDPOINTS: {
+            # <SimpleDescriptor endpoint=1 profile=260 device_type=266
+            # device_version=1
+            # input_clusters=[0, 3, 4, 5, 6, 57344, 57345]
+            # output_clusters=[10, 25]>
+            1: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Basic.cluster_id,
+                    Identify.cluster_id,
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                    TuyaZBE000Cluster.cluster_id,
+                    TuyaZBExternalSwitchTypeCluster.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
+            },
+            # <SimpleDescriptor endpoint=2 profile=260 device_type=266
+            # device_version=1
+            # input_clusters=[4, 5, 6, 57345]
+            # output_clusters=[]>
+            2: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                    TuyaZBExternalSwitchTypeCluster.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+            # <SimpleDescriptor endpoint=3 profile=260 device_type=266
+            # device_version=1
+            # input_clusters=[4, 5, 6, 57345]
+            # output_clusters=[]>
+            3: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                    TuyaZBExternalSwitchTypeCluster.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+            # <SimpleDescriptor endpoint=4 profile=260 device_type=266
+            # device_version=1
+            # input_clusters=[4, 5, 6, 57345]
+            # output_clusters=[]>
+            4: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                    TuyaZBExternalSwitchTypeCluster.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+            # <SimpleDescriptor endpoint=242 profile=41440 device_type=97
+            # device_version=1
+            # input_clusters=[]
+            # output_clusters=[33]>
+            242: {
+                PROFILE_ID: 41440,
+                DEVICE_TYPE: 97,
+                INPUT_CLUSTERS: [],
+                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
+            },
+        },
+    }
+    replacement = {
+        ENDPOINTS: {
+            1: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                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: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+            3: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+            4: {
+                PROFILE_ID: zha.PROFILE_ID,
+                DEVICE_TYPE: zha.DeviceType.ON_OFF_PLUG_IN_UNIT,
+                INPUT_CLUSTERS: [
+                    Groups.cluster_id,
+                    Scenes.cluster_id,
+                    OnOff.cluster_id,
+                ],
+                OUTPUT_CLUSTERS: [],
+            },
+            242: {
+                PROFILE_ID: 41440,
+                DEVICE_TYPE: 97,
+                INPUT_CLUSTERS: [],
+                OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
+            },
+        },
+    }
+
+
 class Plug_3AC_4USB(CustomDevice):
     """Tuya 3 outlet + 4 USB with restore power state support."""
 


Test patch: