Mercator Power Point - Power usage in the billions!

Just added to my Mercator (Mercator White Smart Zigbee Isaac Double Outlet Power Point) setup a whole bunch of their smart power points. All seems well (not officially supported but pairs, reports in HA and can turn on/off switches) other than the ‘metering_summation_delivered’ which shows an insane amount of power used in kWh (this example is after a couple weeks): 18,281,013,456.0 kWh which is quite annoying as I got them to measure power usage on devices etc.

A new switch out the box shows: 2,097,168.0 kWh where I assume it should be 0?

These entities show up for the device (plug named Laundry Smart Plug)

sensor.laundry_smart_plug_electrical_measurement
sensor.laundry_smart_plug_electrical_measurement_rms_current
sensor.laundry_smart_plug_electrical_measurement_rms_voltage
sensor.laundry_smart_plug_smartenergy_metering_summation_delivered

This is the device descriptor:

{
  "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=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, 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": "0x0051",
      "in_clusters": [
        "0x0000",
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0x0702",
        "0x0b04",
        "0xef00"
      ],
      "out_clusters": [
        "0x000a",
        "0x0019"
      ]
    },
    "2": {
      "profile_id": 260,
      "device_type": "0x0051",
      "in_clusters": [
        "0x0003",
        "0x0004",
        "0x0005",
        "0x0006",
        "0xef00"
      ],
      "out_clusters": []
    },
    "242": {
      "profile_id": 41440,
      "device_type": "0x0061",
      "in_clusters": [],
      "out_clusters": [
        "0x0021"
      ]
    }
  },
  "manufacturer": "_TZ3210_pfbzs1an",
  "model": "TS011F",
  "class": "zigpy.device.Device"
}

And my HA details:

System Health

version: core-2022.2.9
installation_type: Home Assistant OS
dev: false
hassio: true
docker: true
user: root
virtualenv: false
python_version: 3.9.7
os_name: Linux
os_version: 5.10.98
arch: x86_64
timezone: Australia/Melbourne

host_os: Home Assistant OS 7.4
update_channel: stable
supervisor_version: supervisor-2022.01.1
docker_version: 20.10.9
disk_total: 228.5 GB
disk_used: 13.7 GB
healthy: true
supported: true
board: generic-x86-64
supervisor_api: ok
version_api: ok

The question now - is the ‘right’ way to solve this to raise it as a feature request/bug as I have (perhaps incorrectly) here: Fix multiplier and divisor for TS011F (TZ3210) (Mercator White Smart Zigbee Isaac Double Outlet Power Point) · Issue #1350 · zigpy/zha-device-handlers (github.com) or are there other ways I should be going about this?

Cheers!

1 Like

Either write your own custom “quirk” for ZHA or submit a new “Device support request” issue to Issues · zigpy/zha-device-handlers · GitHub as any device deviating from the Zigbee standards will require a ZHA Device Handler (a.k.a. ZHA quirk) which translate/convert non-standard like example multiplier and divisor attribute value into standard attributes values.

So in your case, you used a blank issue but should have used the " Device support request" form:

https://github.com/zigpy/zha-device-handlers/issues/new/choose

image

You can read why here → https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling

More about “quirks” for ZHA here → https://github.com/zigpy/zha-device-handlers/blob/e4e62504738ced0c54c983ee5094a3a6af0a741d/README.md

Just to clarify, most of such issues are not a bug in ZHA but instead rather a bug or design flaw in the device firmware in that the manufacturer has probably not followed the standard Zigbee Cluster Library Specification from the Zigbee Alliance. So to properly fix such issues in all Zigbee solutions the problem should really be reported to the device manufacturer so that they can fix it in a new firmware for the device.

@Hedda - awesome, thanks for the reply. If I were to attempt to write a custom quirk, is it similar to other HA customizations (i.e JSON) or is it more involved than that. Happy to give it a go but not keen if I need another HA setup running on separate code etc etc.

Cheers!

Quirks are written in Python script language but as I understand editing quirks or writting a new based on copy and paste from an existing similar quirk it is not as complicated as programming from scratch.

Best read explaination here → https://github.com/zigpy/zha-device-handlers/blob/e4e62504738ced0c54c983ee5094a3a6af0a741d/README.md

Suggest trying to find existing quirk(s) for plug/outlet that is designed to fix similar power meter issues to base your new quirk. Use an existing quirk as a template sensor and adjust values to test. A tip there is to also search for “multiplier” OR “divisor” OR “divider” in closed pull requests → https://github.com/zigpy/zha-device-handlers/pulls?q=is%3Apr+is%3Aclosed+%22multiplier%22+OR+%22divisor%22+OR+%22divider%22

There are many and one example of multiplier and divisor fix is the quirks for the innr sp120 smart plug:

https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/innr/innr_sp120_plug.py

Post Zigbee device signature in an issue and try to estimate the “factor” of being off? Ex. 100 or 1000?

From ZHA device panel, go to Manage Clusters → Metering cluster (0x0702) _> read these attributes:

  • multiplier
  • divisor

You don’t need separate Home Assistant setup to test experimental quirks that are still in development.

ZHA integration support enables a custom quirks path that allow you to test a custom quirk, which makes testing custom quirks much easier. Custom quirks allows users to test and develop new quirks without having to manually edit the whole zha-device-handlers (zha-quirks) Python package. What you need to do is enable custom_quirks_path in YAML configuration for ZHA, see:

https://www.home-assistant.io/integrations/zha#configuration—yaml

https://www.home-assistant.io/integrations/zha#custom_quirks_path

You enable a custom quirks path ZHA config option via the YAML configuration and it will let you load more or more custom quirks from a specific folder/directory of your choosing, after that, you can copy the custom quirk into that folder/directory (over example SMB via the Samba Share add-on) and restart Home Assistant or the ZHA integration. ZHA will overwrite and use that custom quirk instead of the quirk that comes with the latest release package of zha-device-handlers (zha-quirks).

Note that using custom_quirks_path is not meant to be a permanent solution but as a way to test experimental quirks before they are merged into GitHub - zigpy/zha-device-handlers: ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices. and released as part of a new Python package release of it.

1 Like

@Hedda Thanks for the detailed update. Have gone through the suggested links and found this, which looks like a recent version which matches the model number:

Codecov

I’ve added the custom quirk folder to the config, and uploaded the above .py file but get this error when it tries to load:

File "/config/custom_quirks/TS011F_plug.py", line 26, in <module>
    from zhaquirks.tuya import TuyaZBOnOffRestorePowerCluster
ImportError: cannot import name 'TuyaZBOnOffRestorePowerCluster' from 'zhaquirks.tuya' (/usr/local/lib/python3.9/site-packages/zhaquirks/tuya/__init__.py)

Tried to work out if something was missing, but got thrown when I couldn’t even find the /usr/local/lib/python folder (is it different with Home Assistant Core?). Any suggestions on what I could try next?

Cheers!

Have done some more playing around (just removed that line that was causing issues) but I can’t seem to get the custom quirk to apply. I’ve updated the .py file to match, I’m pretty sure the ‘simpledescriptor’ bit is fine (does the order of the list of cluster items need to match the cluster ids in the simpledescriptor?) which leaves another issue I’ve spotted (might also prevent the custom quirk from applying?) in that ID 61184 is ‘unknown’ - meaning I’m not sure what to put there as the related INPUT_CLUSTER entry…

Post to Issues · zigpy/zha-device-handlers · GitHub and also add unique ID in issue description

Have done :slight_smile: - [Device Support Request] - TS011F by _TZ3210_pfbzs1an · Issue #1403 · zigpy/zha-device-handlers (github.com)

FYI if anyone else needs to know / is curious, the reason the power metering is insane is due to the fact that for some reason, the multiplier is 209,716,800. If you take the power meter number and divide by 209,716,800 you will get the power metering value in w/h (not kw/h).

Hey mate just wondering how you have got on with your mercator GPOs. I have two installed and they functions as expected with correct power readings etc however…

Mine turn off randomly. It is extremely painful as I bought these to power monitor my server equipment. For the time being I have had to move my main servers out of there due to the shutdowns (2-3 a week). Because (for now) it also powers off one of my switches i lose connection from HA to my zigbee coordinator and therefore can’t even automate it turning back on until i reconfigure my hardware.

Out of curiosity, do you see any drops to 0 volts in the HA history for the GPOs? I see a bunch every day, but never at th time they turn off so unsure if actually related.

Had half my switches added to HA and the other half to the Mercator app/hub. Was working fine in HA for ages and then started to move them all across to HA again this week and the random power off issue started happening again. No idea what’s causing it as the logs don’t show anything other than the device going offline. I also have seen the drop to 0, doesn’t seem to be related:

image

Read somewhere that it could be related to the overvoltage protection circuit being bugged or something. My guess is that it happens when the zigbee connection is lost. I’ve had the switches turn off when I reboot HA.

Another part that isn’t integrated yet is the default power on behavior (and child lock but who cares about that…), so if you switches don’t turn on/save state, you can set that in the Mercator app. I think if you then add them to HA (without resetting when removing from the Mercator app) they will retain that behavior.

Sounds like identical behaviour. Mine also switch off more often than not if I’m restarting HA. The pain is that the switch was planned to be powering my HA server.

Really glad that you are having the same experience. (Not glad it’s happeneing but glad we can discuss)
I wonder if we can convince Mercator to do something about it.

Mercator told me I needed a hub before they would troubleshoot. And also told me I can’t get firmware updates without the hub.

Yep - happy to know there are others out there with the issue :slight_smile: Re firmware updates, understand their hub is probably required but I’ve not seen any firmware updates for any of the Mercator devices (I don’t have auto update on) and its been almost a year since I installed.

Mercator sent me a hub to try, and unfortunately it fixed all the issues with the switches resetting. I’ve been running ~20 x GPOs on it for a month and none have reset, where on HA/ZHA most were resetting many times a day. There have been no firmware updates available in the Mercator app though.

I want to move them back to ZHA, but need to be sure they are stable first. I can’t see any way to integrate the Ikuu hub with HA?

It can be integrated by first adding the hub to tuya and not using it in the Mercator app.

What do you mean by they sent you a hub? For free? I’ve been arguing with them for a long time via email and on Whirlpool have about 5 more people with the same power off issue.

Yeah they wanted me to replicate with a hub, and eventually just sent me one. It is rock solid stable with more than 20 GPOs and TBH their app is not that bad, but I want to get it across to HA.

Did either of you ever figure this out?
I’ve just installed a few of the light/fan controllers and so far they have worked pretty well so I was considering some power points until I found this.

1 Like