Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Device Support Request] TS011F Smart Plug (_TZ3000_cehuw1lw) #2573

Closed
ozhound opened this issue Sep 7, 2023 · 26 comments · Fixed by #2592
Closed

[Device Support Request] TS011F Smart Plug (_TZ3000_cehuw1lw) #2573

ozhound opened this issue Sep 7, 2023 · 26 comments · Fixed by #2592
Labels
likely easy fix It's likely that this issue is easily fixable Tuya Request/PR regarding a Tuya device

Comments

@ozhound
Copy link

ozhound commented Sep 7, 2023

Problem description

I have a frustrating issue with this power plug. The first lot of 5 that I installed worked great and the power measurement sensors work accurately and consitently

So 2 weeks later i purchased another 5 from the same seller (sixwgh store on Aliexpress) and when they came, they look and function identically. when installed in HA however, they are missing the Child Lock and the Backlight Settings, and the amperage is approximately 100 times what it is supposed to be (220 AMPS for a fridge?) power draw and Voltage seems accurate.

The difference i can see is that the new plugs mfg code is different and it isnt being picked up correctly by ZHA and the class is "zigpy.device.Device"

Solution description

For it to work the same way as the existing TS011F Plugs that look indentical

Screenshots/Video

Screenshots/Video

Existing (working correctly) Plug
image

New - Partially Functioning Plug
image

Device signature

Device signature

Partly-working Device Sig

  "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.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4107, 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": "0x0104",
      "device_type": "0x0051",
      "input_clusters": [
        "0x0000",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x000a",
        "0x0702",
        "0x0b04",
        "0x1000",
        "0x1888",
        "0xe000"
      ],
      "output_clusters": [
        "0x0019"
      ]
    },
    "242": {
      "profile_id": "0xa1e0",
      "device_type": "0x0061",
      "input_clusters": [],
      "output_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "_TZ3000_0zfrhq4i",
  "model": "TS011F",
  "class": "zigpy.device.Device"

Correct 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.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 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": "0x0104",
      "device_type": "0x010a",
      "input_clusters": [
        "0x0000",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0702",
        "0x0b04",
        "0xe000",
        "0xe001"
      ],
      "output_clusters": [
        "0x000a",
        "0x0019"
      ]
    }
  },
  "manufacturer": "_TZ3000_cehuw1lw",
  "model": "TS011F",
  "class": "zhaquirks.tuya.ts011f_plug.Plug"

Diagnostic information

Diagnostic information [zha-0c688e36739db66388192a6b6d74d7b7-_TZ3000_0zfrhq4i TS011F-479ba64ed9e6ce5acde8be5383d9c027.json.txt](https://github.com/zigpy/zha-device-handlers/files/12544417/zha-0c688e36739db66388192a6b6d74d7b7-_TZ3000_0zfrhq4i.TS011F-479ba64ed9e6ce5acde8be5383d9c027.json.txt)

Logs

Logs
[Paste the logs here]

Custom quirk

Custom quirk
[Paste your custom quirk here]

Additional information

No response

@TheJulianJES TheJulianJES added Tuya Request/PR regarding a Tuya device likely easy fix It's likely that this issue is easily fixable labels Sep 7, 2023
@erkr
Copy link

erkr commented Sep 10, 2023

@TheJulianJES
I have a device with a totally different model info ("_TZ3000_xkap8wtb"), but it has exactly the same zigbee signature and the same issue of 100x higher current.
I wrote a custom quirk for my device that works:

https://gist.github.com/erkr/5d4addf1b4c8e18d68d2adb154c6be93

I wonder if that quirk also works for this device, and if so can be added to the official distribution.

Best Eric

@ozhound
Copy link
Author

ozhound commented Sep 13, 2023

when is it likely this will be resolved? Ive just got 5 of these sitting here doing nothing

@erkr
Copy link

erkr commented Sep 13, 2023

I guess It will take a while to resolve this. Someone needs to test new code before it will included in the release.

Why don't you try my custom quirk? Comment out the model part (regering my plug) and uncomment models_info set with your device info. It will help the developers to know if that works. As the zigbee signature is equal, that would not surprise me.
Success Eric

@ozhound
Copy link
Author

ozhound commented Sep 14, 2023 via email

@erkr
Copy link

erkr commented Sep 16, 2023

Step 1 is to enable custom quirks in your configuration.yaml:
https://www.home-assistant.io/integrations/zha#configuration---yaml

Step 2 is to copy the custom quirk file inthe configured folder

Step 3 is restart HA and check your log for errors.

If no errors, check in the zigbee info of the device is the quirk is loaded

@TheJulianJES
Copy link
Collaborator

TheJulianJES commented Sep 17, 2023

Please try this custom quirk:

Possible custom quirk to try
"""TS011F plug."""

from zigpy.profiles import zgp, zha
from zigpy.zcl.clusters.general import (
    Basic,
    GreenPowerProxy,
    Groups,
    Identify,
    OnOff,
    Ota,
    Scenes,
    Time,
)
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
from zigpy.zcl.clusters.lightlink import LightLink
from zigpy.zcl.clusters.smartenergy import Metering

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


class Plug_v3(EnchantedDevice):
    """Tuya TS011F plug. One plug is _Tz3000_0Zfrhq4I."""

    signature = {
        MODEL: "TS011F",
        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,
                    OnOff.cluster_id,
                    Time.cluster_id,
                    Metering.cluster_id,
                    ElectricalMeasurement.cluster_id,
                    LightLink.cluster_id,
                    0x1888,
                    TuyaZBE000Cluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
            242: {
                PROFILE_ID: zgp.PROFILE_ID,
                DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [
                    GreenPowerProxy.cluster_id,
                ],
            },
        },
    }

    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,
                    Time.cluster_id,
                    TuyaZBMeteringClusterWithUnit,
                    TuyaZBElectricalMeasurement,
                    LightLink.cluster_id,
                    0x1888,
                    TuyaZBE000Cluster,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
            242: {
                PROFILE_ID: zgp.PROFILE_ID,
                DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC,
                INPUT_CLUSTERS: [],
                OUTPUT_CLUSTERS: [
                    GreenPowerProxy.cluster_id,
                ],
            },
        },
    }

@TheJulianJES
Copy link
Collaborator

when is it likely this will be resolved? Ive just got 5 of these sitting here doing nothing

Also note that this is all/mostly community-maintained. At least I'm doing this in my free time. So it's always possible that your devices may never be supported.
Tuya is notorious for explicitly making it hard to have their devices work on third-party hubs. If they followed Zigbee spec, it would just work without any quirks.

If you need help installing the custom quirk I've posted above, let me know.
(Basic steps are: put the content in a file called something like tuya_plug.py, put that file in your custom quirks directory that should be located in the /config directory of your HA installation. Then, make sure the custom quirk directory is set in your HA configuration.yaml, restart HA after that and see if the quirk applies to your device.
If everything works, let me know and we'll merge the quirk for the next major HA release. You should remove the custom quirk by then.)

@ozhound
Copy link
Author

ozhound commented Sep 17, 2023 via email

@ozhound
Copy link
Author

ozhound commented Sep 17, 2023

@TheJulianJES

I tried that quirk and the LOGS say that its loaded custom quirks but it isn't applied to that device.

image

Is there a reason we cant take an inbuilt quirk , create a custom quirk, changing the model to make it work? I have 5 or these exact same units that work beautifully and have a quirk applied to it automatically. These last 5, bought from the same supplied 2 weeks later have the different model code but are the same unit?

This is the working unit showing the quirk being applied by ZHA automatically

image

Thanks again for responding initially.

@TheJulianJES
Copy link
Collaborator

I've updated my above comment. Please try the updated quirk.

Is there a reason we cant take an inbuilt quirk , create a custom quirk, changing the model to make it work?

Yes, it's not the model that is different. The exposed clusters are different. It's basically an entirely different plug (under the hood) (or at least running different firmware).

@ozhound
Copy link
Author

ozhound commented Sep 17, 2023

@TheJulianJES Brilliant, that worked!. Power delivered looks right, the other sensors seem to have registered properly. Ill do some more testing but it looks like its working.

Thankyou so much.

@henklietaert
Copy link

I can confirm that this custom quirk mentioned earlier works perfectly, so should be integrated in the main code.
My plugs are the following: _TZ3000_0zfrhq4i TS011F

@TheJulianJES
Copy link
Collaborator

Thanks for testing!

This PR adds support for the plug: #2592
It should be available in HA 2023.10.0

@phil-lipp
Copy link

I'm (kind of?) in the same boat as OP. I got two batches of plugs labelled as "_TZ3000_cehuw1lw TS011F" however only one batch works with zha, the one I ordered first. The batch of plugs I ordered after that all don't work, even though they look the same and show the same device info in Homeassistant.

working_plug_zha

broken_plug_zha

The one in the first picture is working fine. All data is being reported correctly and there is no connection loss whatsoever. The one in the second picture only works during pairing, where I can turn if on and off for some time until the light on the plugs stops blinking (= pairing mode stops).

Here are the diagnostics from one plug of each batch.

Device Info from broken Plug

{
  "home_assistant": {
    "installation_type": "Home Assistant Core",
    "version": "2023.9.3",
    "dev": false,
    "hassio": false,
    "virtualenv": true,
    "python_version": "3.11.4",
    "docker": false,
    "arch": "aarch64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.1.21-v8+",
    "run_as_root": false
  },
  "custom_components": {
    "dwd": {
      "version": "2023.8.2",
      "requirements": []
    },
    "dwd_pollenflug": {
      "version": "1.0.2",
      "requirements": [
        "pytz"
      ]
    },
    "dwd_weather": {
      "version": "v2.0.1",
      "requirements": [
        "simple_dwd_weatherforecast==2.0.14",
        "markdownify==0.6.5"
      ]
    },
    "localtuya": {
      "version": "5.2.1",
      "requirements": []
    },
    "hacs": {
      "version": "1.33.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "better_thermostat": {
      "version": "1.3.0",
      "requirements": []
    },
    "ble_monitor": {
      "version": "12.6.0",
      "requirements": [
        "pycryptodomex>=3.18.0",
        "janus>=1.0.0",
        "aioblescan>=0.2.14",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "dwains_dashboard": {
      "version": "3.4.3",
      "requirements": []
    },
    "tapo_control": {
      "version": "5.2.4",
      "requirements": [
        "pytapo==3.2.14"
      ]
    },
    "holidays": {
      "version": "1.9.6",
      "requirements": [
        "python-dateutil>=2.8.2",
        "holidays>=0.14.2"
      ]
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp",
      "universal_silabs_flasher"
    ],
    "requirements": [
      "bellows==0.36.4",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.103",
      "zigpy-deconz==0.21.1",
      "zigpy==0.57.1",
      "zigpy-xbee==0.18.2",
      "zigpy-zigate==0.11.0",
      "zigpy-znp==0.11.4",
      "universal-silabs-flasher==0.0.14"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "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": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_uzg-01._tcp.local.",
        "name": "uzg-01*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 11615,
    "manufacturer": "_TZ3000_cehuw1lw",
    "model": "TS011F",
    "name": "_TZ3000_cehuw1lw TS011F",
    "quirk_applied": true,
    "quirk_class": "zhaquirks.tuya.ts011f_plug.Plug",
    "manufacturer_code": 4417,
    "power_source": "Mains",
    "lqi": 196,
    "rssi": -51,
    "last_seen": "2023-09-27T12:59:37",
    "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.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 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": "0x0104",
          "device_type": "0x010a",
          "input_clusters": [
            "0x0000",
            "0x0003",
            "0x0004",
            "0x0005",
            "0x0006",
            "0x0702",
            "0x0b04",
            "0xe000",
            "0xe001"
          ],
          "output_clusters": [
            "0x000a",
            "0x0019"
          ]
        }
      },
      "manufacturer": "_TZ3000_cehuw1lw",
      "model": "TS011F"
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_rms_current_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_rms_voltage_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_power_factor_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_active_power_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_summation_delivered_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "switch.tz3000_cehuw1lw_ts011f_switch_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "switch.tz3000_cehuw1lw_ts011f_child_lock_9",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "button.tz3000_cehuw1lw_ts011f_identify_10",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "select.tz3000_cehuw1lw_ts011f_power_on_state_9",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "select.tz3000_cehuw1lw_ts011f_backlight_mode_9",
        "name": "_TZ3000_cehuw1lw TS011F"
      }
    ],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "ON_OFF_PLUG_IN_UNIT"
      }
    ],
    "user_given_name": null,
    "device_reg_id": "2f1e668185164d54d1abc479a9c593c2",
    "area_id": null,
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "ON_OFF_PLUG_IN_UNIT",
          "id": 266
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0001": {
                "attribute_name": "app_version",
                "value": 77
              },
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZ3000_cehuw1lw"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS011F"
              },
              "0x0007": {
                "attribute_name": "power_source",
                "value": 1
              },
              "0xfffe": {
                "attribute_name": "reporting_status",
                "value": 0
              },
              "0x0000": {
                "attribute_name": "zcl_version",
                "value": 3
              }
            },
            "unsupported_attributes": {}
          },
          "0x0003": {
            "endpoint_attribute": "identify",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0006": {
            "endpoint_attribute": "on_off",
            "attributes": {
              "0x8001": {
                "attribute_name": "backlight_mode",
                "value": 1
              },
              "0x8000": {
                "attribute_name": "child_lock",
                "value": 0
              },
              "0x0000": {
                "attribute_name": "on_off",
                "value": 1
              },
              "0x8002": {
                "attribute_name": "power_on_state",
                "value": 0
              }
            },
            "unsupported_attributes": {
              "0x4003": {
                "attribute_name": "start_up_on_off"
              }
            }
          },
          "0x0702": {
            "endpoint_attribute": "smartenergy_metering",
            "attributes": {
              "0x0000": {
                "attribute_name": "current_summ_delivered",
                "value": 0
              },
              "0x0302": {
                "attribute_name": "divisor",
                "value": 100
              },
              "0x0306": {
                "attribute_name": "metering_device_type",
                "value": 0
              },
              "0x0301": {
                "attribute_name": "multiplier",
                "value": 1
              },
              "0x0200": {
                "attribute_name": "status",
                "value": 0
              },
              "0x0303": {
                "attribute_name": "summation_formatting",
                "value": 0
              },
              "0x0300": {
                "attribute_name": "unit_of_measure",
                "value": 0
              }
            },
            "unsupported_attributes": {
              "0x0400": {
                "attribute_name": "instantaneous_demand"
              },
              "0x0100": {
                "attribute_name": "current_tier1_summ_delivered"
              },
              "0x0102": {
                "attribute_name": "current_tier2_summ_delivered"
              },
              "0x0104": {
                "attribute_name": "current_tier3_summ_delivered"
              },
              "0x0304": {
                "attribute_name": "demand_formatting"
              },
              "0x0106": {
                "attribute_name": "current_tier4_summ_delivered"
              },
              "0x0108": {
                "attribute_name": "current_tier5_summ_delivered"
              },
              "0x010a": {
                "attribute_name": "current_tier6_summ_delivered"
              }
            }
          },
          "0x0b04": {
            "endpoint_attribute": "electrical_measurement",
            "attributes": {
              "0x0603": {
                "attribute_name": "ac_current_divisor",
                "value": 1000
              },
              "0x0602": {
                "attribute_name": "ac_current_multiplier",
                "value": 1
              },
              "0x050b": {
                "attribute_name": "active_power",
                "value": 0
              },
              "0x0508": {
                "attribute_name": "rms_current",
                "value": 0
              },
              "0x0505": {
                "attribute_name": "rms_voltage",
                "value": 235
              }
            },
            "unsupported_attributes": {
              "0x0300": {
                "attribute_name": "ac_frequency"
              },
              "0x0601": {
                "attribute_name": "ac_voltage_divisor"
              },
              "0x0302": {
                "attribute_name": "ac_frequency_max"
              },
              "0x0600": {
                "attribute_name": "ac_voltage_multiplier"
              },
              "0x0604": {
                "attribute_name": "ac_power_multiplier"
              },
              "0x0605": {
                "attribute_name": "ac_power_divisor"
              },
              "0x0401": {
                "attribute_name": "ac_frequency_divisor"
              },
              "0x050f": {
                "attribute_name": "apparent_power"
              },
              "0x0507": {
                "attribute_name": "rms_voltage_max"
              },
              "0x0400": {
                "attribute_name": "ac_frequency_multiplier"
              },
              "0x050a": {
                "attribute_name": "rms_current_max"
              },
              "0x0000": {
                "attribute_name": "measurement_type"
              },
              "0x0403": {
                "attribute_name": "power_divisor"
              },
              "0x050d": {
                "attribute_name": "active_power_max"
              },
              "0x0402": {
                "attribute_name": "power_multiplier"
              }
            }
          },
          "0xe000": {
            "endpoint_attribute": "tuya_is_pita_0",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xe001": {
            "endpoint_attribute": "tuya_external_switch_type",
            "attributes": {},
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}

Device Info from Working Plug

{
  "home_assistant": {
    "installation_type": "Home Assistant Core",
    "version": "2023.9.3",
    "dev": false,
    "hassio": false,
    "virtualenv": true,
    "python_version": "3.11.4",
    "docker": false,
    "arch": "aarch64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.1.21-v8+",
    "run_as_root": false
  },
  "custom_components": {
    "dwd": {
      "version": "2023.8.2",
      "requirements": []
    },
    "dwd_pollenflug": {
      "version": "1.0.2",
      "requirements": [
        "pytz"
      ]
    },
    "dwd_weather": {
      "version": "v2.0.1",
      "requirements": [
        "simple_dwd_weatherforecast==2.0.14",
        "markdownify==0.6.5"
      ]
    },
    "localtuya": {
      "version": "5.2.1",
      "requirements": []
    },
    "hacs": {
      "version": "1.33.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "better_thermostat": {
      "version": "1.3.0",
      "requirements": []
    },
    "ble_monitor": {
      "version": "12.6.0",
      "requirements": [
        "pycryptodomex>=3.18.0",
        "janus>=1.0.0",
        "aioblescan>=0.2.14",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "dwains_dashboard": {
      "version": "3.4.3",
      "requirements": []
    },
    "tapo_control": {
      "version": "5.2.4",
      "requirements": [
        "pytapo==3.2.14"
      ]
    },
    "holidays": {
      "version": "1.9.6",
      "requirements": [
        "python-dateutil>=2.8.2",
        "holidays>=0.14.2"
      ]
    }
  },
  "integration_manifest": {
    "domain": "zha",
    "name": "Zigbee Home Automation",
    "after_dependencies": [
      "onboarding",
      "usb"
    ],
    "codeowners": [
      "@dmulcahey",
      "@adminiuga",
      "@puddly"
    ],
    "config_flow": true,
    "dependencies": [
      "file_upload"
    ],
    "documentation": "https://www.home-assistant.io/integrations/zha",
    "iot_class": "local_polling",
    "loggers": [
      "aiosqlite",
      "bellows",
      "crccheck",
      "pure_pcapy3",
      "zhaquirks",
      "zigpy",
      "zigpy_deconz",
      "zigpy_xbee",
      "zigpy_zigate",
      "zigpy_znp",
      "universal_silabs_flasher"
    ],
    "requirements": [
      "bellows==0.36.4",
      "pyserial==3.5",
      "pyserial-asyncio==0.6",
      "zha-quirks==0.0.103",
      "zigpy-deconz==0.21.1",
      "zigpy==0.57.1",
      "zigpy-xbee==0.18.2",
      "zigpy-zigate==0.11.0",
      "zigpy-znp==0.11.4",
      "universal-silabs-flasher==0.0.14"
    ],
    "usb": [
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*2652*",
        "known_devices": [
          "slae.sh cc2652rb stick"
        ]
      },
      {
        "vid": "1A86",
        "pid": "55D4",
        "description": "*sonoff*plus*",
        "known_devices": [
          "sonoff zigbee dongle plus v2"
        ]
      },
      {
        "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": "0403",
        "pid": "6015",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate+"
        ]
      },
      {
        "vid": "10C4",
        "pid": "EA60",
        "description": "*zigate*",
        "known_devices": [
          "ZiGate"
        ]
      },
      {
        "vid": "10C4",
        "pid": "8B34",
        "description": "*bv 2010/10*",
        "known_devices": [
          "Bitron Video AV2010/10"
        ]
      }
    ],
    "zeroconf": [
      {
        "type": "_esphomelib._tcp.local.",
        "name": "tube*"
      },
      {
        "type": "_zigate-zigbee-gateway._tcp.local.",
        "name": "*zigate*"
      },
      {
        "type": "_zigstar_gw._tcp.local.",
        "name": "*zigstar*"
      },
      {
        "type": "_uzg-01._tcp.local.",
        "name": "uzg-01*"
      },
      {
        "type": "_slzb-06._tcp.local.",
        "name": "slzb-06*"
      }
    ],
    "is_built_in": true
  },
  "data": {
    "ieee": "**REDACTED**",
    "nwk": 793,
    "manufacturer": "_TZ3000_cehuw1lw",
    "model": "TS011F",
    "name": "_TZ3000_cehuw1lw TS011F",
    "quirk_applied": true,
    "quirk_class": "zhaquirks.tuya.ts011f_plug.Plug",
    "manufacturer_code": 4417,
    "power_source": "Mains",
    "lqi": 180,
    "rssi": -55,
    "last_seen": "2023-09-27T14:21:16",
    "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.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 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": "0x0104",
          "device_type": "0x010a",
          "input_clusters": [
            "0x0000",
            "0x0003",
            "0x0004",
            "0x0005",
            "0x0006",
            "0x0702",
            "0x0b04",
            "0xe000",
            "0xe001"
          ],
          "output_clusters": [
            "0x000a",
            "0x0019"
          ]
        }
      },
      "manufacturer": "_TZ3000_cehuw1lw",
      "model": "TS011F"
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_rms_current_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_rms_voltage_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_power_factor_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_active_power_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "sensor.tz3000_cehuw1lw_ts011f_summation_delivered_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "switch.tz3000_cehuw1lw_ts011f_switch_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "switch.tz3000_cehuw1lw_ts011f_child_lock_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "button.tz3000_cehuw1lw_ts011f_identify_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "select.tz3000_cehuw1lw_ts011f_power_on_state_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      },
      {
        "entity_id": "select.tz3000_cehuw1lw_ts011f_backlight_mode_8",
        "name": "_TZ3000_cehuw1lw TS011F"
      }
    ],
    "neighbors": [
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Parent",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0x55F2",
        "permit_joining": "Unknown",
        "depth": "2",
        "lqi": "124"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0x011C",
        "permit_joining": "Unknown",
        "depth": "3",
        "lqi": "221"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0xBF3D",
        "permit_joining": "Unknown",
        "depth": "2",
        "lqi": "197"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0xB9B0",
        "permit_joining": "Unknown",
        "depth": "2",
        "lqi": "170"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0x02DE",
        "permit_joining": "Unknown",
        "depth": "0",
        "lqi": "0"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0xEA54",
        "permit_joining": "Unknown",
        "depth": "3",
        "lqi": "75"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0x5E1A",
        "permit_joining": "Unknown",
        "depth": "2",
        "lqi": "0"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0xC096",
        "permit_joining": "Unknown",
        "depth": "2",
        "lqi": "36"
      },
      {
        "device_type": "Coordinator",
        "rx_on_when_idle": "On",
        "relationship": "Sibling",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0x0000",
        "permit_joining": "Unknown",
        "depth": "0",
        "lqi": "91"
      },
      {
        "device_type": "Router",
        "rx_on_when_idle": "On",
        "relationship": "Child",
        "extended_pan_id": "**REDACTED**",
        "ieee": "**REDACTED**",
        "nwk": "0x40D2",
        "permit_joining": "Unknown",
        "depth": "3",
        "lqi": "145"
      }
    ],
    "routes": [],
    "endpoint_names": [
      {
        "name": "ON_OFF_PLUG_IN_UNIT"
      }
    ],
    "user_given_name": "Under Bed Socket",
    "device_reg_id": "a0cee8daae5d914bc3988f937b71704a",
    "area_id": "bedroom",
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "ON_OFF_PLUG_IN_UNIT",
          "id": 266
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0001": {
                "attribute_name": "app_version",
                "value": 77
              },
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "_TZ3000_cehuw1lw"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "TS011F"
              },
              "0x0007": {
                "attribute_name": "power_source",
                "value": 1
              },
              "0xfffe": {
                "attribute_name": "reporting_status",
                "value": 0
              },
              "0x0000": {
                "attribute_name": "zcl_version",
                "value": 3
              }
            },
            "unsupported_attributes": {}
          },
          "0x0003": {
            "endpoint_attribute": "identify",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0004": {
            "endpoint_attribute": "groups",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0005": {
            "endpoint_attribute": "scenes",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0006": {
            "endpoint_attribute": "on_off",
            "attributes": {
              "0x8001": {
                "attribute_name": "backlight_mode",
                "value": 0
              },
              "0x8000": {
                "attribute_name": "child_lock",
                "value": 1
              },
              "0x4002": {
                "attribute_name": "off_wait_time",
                "value": 0
              },
              "0x0000": {
                "attribute_name": "on_off",
                "value": 1
              },
              "0x4001": {
                "attribute_name": "on_time",
                "value": 0
              },
              "0x8002": {
                "attribute_name": "power_on_state",
                "value": 1
              }
            },
            "unsupported_attributes": {
              "0x4003": {
                "attribute_name": "start_up_on_off"
              }
            }
          },
          "0x0702": {
            "endpoint_attribute": "smartenergy_metering",
            "attributes": {
              "0x0000": {
                "attribute_name": "current_summ_delivered",
                "value": 308
              },
              "0x0302": {
                "attribute_name": "divisor",
                "value": 100
              },
              "0x0306": {
                "attribute_name": "metering_device_type",
                "value": 0
              },
              "0x0301": {
                "attribute_name": "multiplier",
                "value": 1
              },
              "0x0200": {
                "attribute_name": "status",
                "value": 0
              },
              "0x0303": {
                "attribute_name": "summation_formatting",
                "value": 0
              },
              "0x0300": {
                "attribute_name": "unit_of_measure",
                "value": 0
              }
            },
            "unsupported_attributes": {
              "0x0400": {
                "attribute_name": "instantaneous_demand"
              },
              "0x0100": {
                "attribute_name": "current_tier1_summ_delivered"
              },
              "0x0102": {
                "attribute_name": "current_tier2_summ_delivered"
              },
              "0x0104": {
                "attribute_name": "current_tier3_summ_delivered"
              },
              "0x0304": {
                "attribute_name": "demand_formatting"
              },
              "0x0106": {
                "attribute_name": "current_tier4_summ_delivered"
              },
              "0x0108": {
                "attribute_name": "current_tier5_summ_delivered"
              },
              "0x010a": {
                "attribute_name": "current_tier6_summ_delivered"
              }
            }
          },
          "0x0b04": {
            "endpoint_attribute": "electrical_measurement",
            "attributes": {
              "0x0603": {
                "attribute_name": "ac_current_divisor",
                "value": 1000
              },
              "0x0602": {
                "attribute_name": "ac_current_multiplier",
                "value": 1
              },
              "0x050b": {
                "attribute_name": "active_power",
                "value": 0
              },
              "0x0508": {
                "attribute_name": "rms_current",
                "value": 30
              },
              "0x0505": {
                "attribute_name": "rms_voltage",
                "value": 234
              }
            },
            "unsupported_attributes": {
              "0x0300": {
                "attribute_name": "ac_frequency"
              },
              "0x0601": {
                "attribute_name": "ac_voltage_divisor"
              },
              "0x0302": {
                "attribute_name": "ac_frequency_max"
              },
              "0x0600": {
                "attribute_name": "ac_voltage_multiplier"
              },
              "0x0604": {
                "attribute_name": "ac_power_multiplier"
              },
              "0x0605": {
                "attribute_name": "ac_power_divisor"
              },
              "0x0401": {
                "attribute_name": "ac_frequency_divisor"
              },
              "0x050f": {
                "attribute_name": "apparent_power"
              },
              "0x0507": {
                "attribute_name": "rms_voltage_max"
              },
              "0x0400": {
                "attribute_name": "ac_frequency_multiplier"
              },
              "0x050a": {
                "attribute_name": "rms_current_max"
              },
              "0x0000": {
                "attribute_name": "measurement_type"
              },
              "0x0403": {
                "attribute_name": "power_divisor"
              },
              "0x050d": {
                "attribute_name": "active_power_max"
              },
              "0x0402": {
                "attribute_name": "power_multiplier"
              }
            }
          },
          "0xe000": {
            "endpoint_attribute": "tuya_is_pita_0",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0xe001": {
            "endpoint_attribute": "tuya_external_switch_type",
            "attributes": {
              "0xd030": {
                "attribute_name": "external_switch_type",
                "value": 0
              }
            },
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x000a": {
            "endpoint_attribute": "time",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
}

@phil-lipp
Copy link

Following home-assistant/core#98624 (comment) fixed this issue for me

@alka79
Copy link

alka79 commented Feb 28, 2024

Hello. I have this power plug from another manufacturer : _TZ3000_okaz9tjs
I can turn it on and off, all the sensors are present, but :

  • the control is a light instead of a switch.
  • the measured current is deliriously high!

I don't mind the wrong current measurement, but is is annoying to be forced to use it as a light.

I tried the custom quirk linked above: no change.

Extract of the device diagnostics
 "data": {
    "ieee": "**REDACTED**",
    "nwk": 54310,
    "manufacturer": "_TZ3000_okaz9tjs",
    "model": "TS011F",
    "name": "_TZ3000_okaz9tjs TS011F",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "quirk_id": null,
    "manufacturer_code": 4660,
    "power_source": "Mains",
    "lqi": 200,
    "rssi": -50,
    "last_seen": "2024-02-28T22:06:16",
    "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.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 142>, manufacturer_code=4660, maximum_buffer_size=108, maximum_incoming_transfer_size=0, server_mask=11264, maximum_outgoing_transfer_size=0, 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": "0x0104",
          "device_type": "0x0100",
          "input_clusters": [
            "0x0000",
            "0x0003",
            "0x0004",
            "0x0005",
            "0x0006",
            "0x000a",
            "0x0702",
            "0x0b04",
            "0x1000",
            "0xe000",
            "0xe001"
          ],
          "output_clusters": []
        }
      },
      "manufacturer": "_TZ3000_okaz9tjs",
      "model": "TS011F"
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "button.tz3000_okaz9tjs_ts011f_identifier",
        "name": "_TZ3000_okaz9tjs TS011F"
      },
      {
        "entity_id": "light.tz3000_okaz9tjs_ts011f_lumiere",
        "name": "_TZ3000_okaz9tjs TS011F"
      },
      {
        "entity_id": "select.tz3000_okaz9tjs_ts011f_comportement_au_demarrage",
        "name": "_TZ3000_okaz9tjs TS011F"
      },
      {
        "entity_id": "sensor.tz3000_okaz9tjs_ts011f_courant",
        "name": "_TZ3000_okaz9tjs TS011F"
      },
      {
        "entity_id": "sensor.tz3000_okaz9tjs_ts011f_tension",
        "name": "_TZ3000_okaz9tjs TS011F"
      },
      {
        "entity_id": "sensor.tz3000_okaz9tjs_ts011f_puissance",
        "name": "_TZ3000_okaz9tjs TS011F"
      },
      {
        "entity_id": "sensor.tz3000_okaz9tjs_ts011f_summation_delivered",
        "name": "_TZ3000_okaz9tjs TS011F"
      }

Anything else I could try ?

@erkr
Copy link

erkr commented Feb 28, 2024

@alka79
I have several of these plugs and they work fine without custom quirk. On my system they use a released quirk zhaquirks.tuya.ts011f_plug.Plug_v2:
image

Measurement is correct and the control is a switch type.

@alka79
Copy link

alka79 commented Feb 29, 2024

Thanks. So there is hope :)

Whatever I do, it is always a light.
The quirk line is not displayed in the UI for this device. When looking in the diagnostics, I always see that no quirk was applied.
I also tried with no success the custom quirk you published here: https://gist.github.com/erkr/5d4addf1b4c8e18d68d2adb154c6be93

My plug must be different. I could see that the released quirk for TS011F has already 3 versions ! this might be the 4th.

I have to figure out what the differences are and I don't really know where to look.

BTW, printed on my plug:
manufacturer: ELIVCO
model: SPA9

@erkr
Copy link

erkr commented Feb 29, 2024

@alka79 I have exactly the same brand and firmware. Try to remove them. Restart en add them again.
New quirks not always load for existing devices:
image

@alka79
Copy link

alka79 commented Feb 29, 2024

Unbeliveable !
I tried twice already without custom quirk and also with the custom quirk you published and with the one publisher here by TheJulianJES. I'll try again later.
Maybe some traces are left from my previous tries. Is there something else I should do to clean other than remove the device in HA ?

@alka79
Copy link

alka79 commented Mar 1, 2024

I tried again with no success. I started the log before pairing.

As I understand, your plug matches with the tuya.ts011f_plug.Plug_v2 quirk.

For my plug, the matching attempts fail with all the ts011f quirks, mostly "because endpoint list mismatch".
For Plug_v2 the reason is a bit different :

2024-02-29 21:15:57.353 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class 'zhaquirks.tuya.ts011f_plug.Plug_v2'>	
2024-02-29 21:15:57.353 DEBUG (MainThread) [zigpy.quirks.registry] Fail because device_type mismatch on at least one endpoint

Attached is the full diagnostics of my plug. Maybe you could share the full diagnostics of one of yours matching the Plug_v2 quirk so that I can compare and possibly write a custom quirk based on Plug_v2 that would match my plug ?

zha-5a0e0ab5b7ac4ee6cc62b84332364158-_TZ3000_okaz9tjs TS011F-8613104db9ceca9d04729a7b527ee8fa(13).json

@alka79
Copy link

alka79 commented Mar 1, 2024

I found a work around mentioned in the doc ! https://www.home-assistant.io/integrations/zha/#modifying-the-device-type/
RTFM ;)
modify configuration.yaml

zha:
  device_config:
    84:71:27:ff:fe:93:17:24-1:    # format: {ieee}-{endpoint_id}
      type: "switch"              # corrected device type

The current metering is still wrong but at least it is recognized as a switch. Good enough for me.

@erkr
Copy link

erkr commented Mar 1, 2024

I'm running out of suggestions. Sorry

@alka79
Copy link

alka79 commented Mar 3, 2024

the fully working quirk for my devices is here #1764 (comment)

@aqxa1
Copy link

aqxa1 commented Jun 23, 2024

I seem to have a different variant of cehuw1lw which is missing the 242 endpoint. I've only tested it briefly but all looks correct with current and summation power returning sane values. Here's the code:

"""TS011F plug."""

from zigpy.profiles import zgp, zha
from zigpy.zcl.clusters.general import (
    Basic,
    GreenPowerProxy,
    Groups,
    Identify,
    OnOff,
    Ota,
    Scenes,
    Time,
)
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
from zigpy.zcl.clusters.lightlink import LightLink
from zigpy.zcl.clusters.smartenergy import Metering

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


class Plug_v3(EnchantedDevice):
    """Tuya TS011F plug, _TZ3000_cehuw1lw variant."""

    signature = {
        MODEL: "TS011F",
        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,
                    OnOff.cluster_id,
                    Time.cluster_id,
                    Metering.cluster_id,
                    ElectricalMeasurement.cluster_id,
                    LightLink.cluster_id,
                    0x1888,
                    TuyaZBE000Cluster.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
        },
    }

    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,
                    Time.cluster_id,
                    TuyaZBMeteringClusterWithUnit,
                    TuyaZBElectricalMeasurement,
                    LightLink.cluster_id,
                    0x1888,
                    TuyaZBE000Cluster,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
        },
    }

@ge33ek
Copy link

ge33ek commented Aug 22, 2024

I’ve got this unit, but none of the quirks above seem to work, amp is the issue, reporting incorrectly as 1000x that is 84amps instead of 0.84

"node_descriptor": { "logical_type": 1, "complex_descriptor_available": 0, "user_descriptor_available": 0, "reserved": 0, "aps_flags": 0, "frequency_band": 8, "mac_capability_flags": 142, "manufacturer_code": 4107, "maximum_buffer_size": 66, "maximum_incoming_transfer_size": 66, "server_mask": 11264, "maximum_outgoing_transfer_size": 66, "descriptor_capability_field": 0 }, "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0051", "input_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006", "0x000a", "0x0702", "0x0b04", "0x1000", "0x1888", "0xe000" ], "output_clusters": [ "0x0019" ] } }, "manufacturer": "_TZ3000_cehuw1lw", "model": "TS011F", "class": "zigpy.device.Device" }

Anyone got suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
likely easy fix It's likely that this issue is easily fixable Tuya Request/PR regarding a Tuya device
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants