Zigbee plug *without* power monitoring

I think I have it figured out, but any feedback is welcome/posting this for anyone who like me was tearing their hair out after nuking their zigbee network with one (or twenty) too many of these plugs.

I installed this as a custom quirk: zha-device-handlers/zhaquirks/tuya/ts011f_plug.py at 728ee427263d89a9c9186eacefc90e4994d81b82 · zigpy/zha-device-handlers · GitHub

Then under

class plug_v2(EnchantedDevice):
......
    replacement = {
        ENDPOINTS: {
            1: {
                PROFILE_ID: zha.PROFILE_ID,
                DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    TuyaZBOnOffAttributeCluster,
                    TuyaZBMeteringClusterWithUnit,
                    TuyaZBElectricalMeasurement,
                    TuyaZBExternalSwitchTypeCluster,

I deleted the following lines:
TuyaZBMeteringClusterWithUnit,
TuyaZBElectricalMeasurement,

That seems to have solved the issue but I will be diving into the logs after work. So far devices are snappy, but there are a few I still need to re-add; and will need to verify the logs are no longer being spammed with energy statistics for um 41 smart plugs all at once

Edit:
That does indeed seem to have done the trick. All my devices are back online and seem to be stable and responsive; the error logs don’t show any zigbee related errors that I could see. Says a lot that a 10 second snippet of debug logging was ~15mb when I had all the energy reporting swamping my network, now it’s more like 1mb.

I also have a lot of thirdreality smart plugs on my net so in places where I needed the energy monitoring from the aliexpress tuya plugs I just swapped the thirdreality and the tuya plugs (there were only 2 so not too big a deal to redo the entities). I’ve never had any slowdowns with the thirdreality plugs and my understanding is that their energy reporting is much more sane (minutes rather than multiple times a second) so in case anyone needs a recommendation that is mine.

For anyone dealing with this issue like me who had zero experience with the more technical aspects of zigbee:

  1. Create a custom quirk as in this guide. Zigbee Guide: How-to add/setup local custom ZHA Device Handlers (also known as ”quirks”) in the ZHA integration
  2. Use the custom quirk file as linked at the top of this post (if doing this for the particular tuya plug in question, otherwise use the corresponding quirk.py file); I ssh’d into the machine with my HA docker container and pasted the contents of the link into nano editor. Give it a memorable/unique name to make the next step easier on yourself.
  3. When you restart HA to get it to load the custom quirk, then go to the device page of the plug in question, on the left under “device info” click the dropdown arrow to the right of “zigbee info” and verify that the “quirk” at the bottom is the custom one you created.
    If it’s not, it may be a mapping issue for the directory you created in 1), or as I found out, I was editing the wrong model in the quirk file I downloaded. I found the right one with a control + f search for my exact model number, or, whatever the default quirk is in the “zigbee info” row of the device page (screenshot below), search for that.
  4. Once you verify that your custom quirk is being detected and used, edit the quirk file as I describe at the top of this post, basically removing the energy monitoring clusters in the “replacement” section.
  5. Reboot HA, pull up an example of that plug, and the energy monitoring entities should all be unavailable or no longer being provided by the integration while the switch still works fine. I then went into ZHA “entities” and used filters to isolate the energy monitoring entities for my switch type and could “select all” and “delete”.

That’s all I can think of that would be helpful in case anyone else comes across this issue.
screen