TS0121 - what value am I seeing through ZHA? Also Energy

I’ve bought few Zigbee Smart Sockets. All based on popular TS0121 device (Blitzwolf also makes sockets based on that). I have two questions regarding those devices:

  1. I’ve already read that ZHA is limited to the number of sensors for some reasons unknown to me…Does it mean that the only solution would be to discard ZHA in favour of Z2M if I’d like to add available sensors to the Energy tab? That would be quite inconvenient…
  2. Pairing through ZHA gave me two sensors and one switch. One of the sensor doesn’t work (like for all the people that wants kWh) and the second shows some number that suppose to be W. But is it? I have my PC plugged, with two LCDs and two wall chargers and it shows values between ~1600-5000W depending on PCs load. I’m pretty sure my 650W power supply can’t deliver 5kW of power. :wink: So I wonder…does it simply need to be multiplied by 0.1 to get real value? Or there is something wrong?

Oh come on…really no one knows the answer, to the second question at least? :stuck_out_tongue:

Same as BlitzWolf SHP13 which like many other plugs with energy meter is a rebranded Tuya TS0121

FYI, when specifially talking about the ZHA integration component for Home Assistant there are loads of related discussions/explainations here about this and the current ZHA limitation of 1 sensor per cluster:

and here

There is also an issue posted to the HA core about ZHA energy consumption sensors not showing up:

All those applies to most Zigbee power plugs or other Zigbee devices with integrated energy meters:

  1. Tuya TS0121 → [Device Support Request] BlitzWolf BW-SHP13 smart plug (aka Tuya TS0121) · Issue #605 · zigpy/zha-device-handlers · GitHub
  2. BlitzWolf BW-SHP13 (OEM version of Tuya TS0121) → [Device Support Request] BlitzWolf BW-SHP13 smart plug (aka Tuya TS0121) · Issue #605 · zigpy/zha-device-handlers · GitHub
  3. Develco Norwegian HAN Adapter (Develco EMIZB-132) → Add support for Develco Products A/S EMIZB-132 Norwegian HAN adapter · Issue #267 · zigpy/zha-device-handlers · GitHub
  4. Develco Prosumer Meter (Develco SMMZB-310101)
  5. Develco Smart Plug Mini (Develco Frient SPLZB-131) → [Device Support Request] Develco Frient SPLZB-131 Smart Plug Mini · Issue #857 · zigpy/zha-device-handlers · GitHub
  6. Immax Plug-230V-ZB3.0 Smart Plug
  7. Innr SP 120 (a.k.a. Innr SP120) → No power consumption readings from Innr smart plug SP120? · Issue #34090 · home-assistant/core · GitHub
  8. Lonsonho 16A Energy Monitoring Plug (OEM version of Tuya TS0121) → [Device Support Request] BlitzWolf BW-SHP13 smart plug (aka Tuya TS0121) · Issue #605 · zigpy/zha-device-handlers · GitHub
  9. SmartThings Smart Plug (UK)
  10. Schwaiger ZHS15 → ZHA plugs - smartenergy_metering > wrong cluster · Issue #44539 · home-assistant/core · GitHub
  11. Rehentele 16A Energy Monitoring Plug (OEM version of Tuya TS0121) → [Device Support Request] BlitzWolf BW-SHP13 smart plug (aka Tuya TS0121) · Issue #605 · zigpy/zha-device-handlers · GitHub
  12. Aqara LUMI lumi.plug → ZHA plugs - smartenergy_metering > wrong cluster #44539

and a possible workaround being working on here

Not if you are good at coding in Python + are willing to extend ZHA to add support for more clusters.

https://github.com/zigpy/zha-device-handlers/issues/605#issuecomment-753713044

It will be an limitation in ZHA until someone with the skills, time and interest extend clusters support.

Please take note that currently only developer volenteers work on ZHA as a hobby in their spare time.

Hm…so basically for noobs like me the only solution would be to either use this integration or move to Z2M…Anyway, thanks for answer.

Do you happen to know what about the second question? The one about reading.

Edit: I’ve got my hands on regular light bulb that should draw 60W of power. And it does according to other smart plug I have. So what’s the deal with 5kW of power when my PC is loaded? It doesn’t make sense…

And does your TS0121 show 60W ?

Yup, that’s exactly what I meant - I have few TS0121 to play with. My next step will be to check that other unit with each device connected to the power extension where my PC sits.

if your TS0121 measures 60W with the 60W bulb, and it shows values between ~1600-5000W depending on PCs load, your PC power supply must not be very clean.

There are more devices there: two LCDs and wall charger. Anyway if that setup would draw 5kW then smart plug would break because it’s rated at max 3.6kW. So the issue must be somewhere else. Also I’d pay very, very high power bills. :smiley:
I need to find a little bit of time to replace one connected with PC with the one I tested bulb. And I need to check each device individually to try find the culprit. LCDs should have relatively stable power consumption as well as charger without load.

Edit: So I’ve manage to hook PC directly to the plug I was testing with bulb, which gives me temporary setup of: PC->smart plug 2->power strip->smart plug 1->outlet. And that additional plug have very reasonable reading of ~130W when idle and up to ~360W when loaded. At the same time #1 gave me those weird readings. I need to check also both LCDs and wall charger and if the readings will be good I’ll have to move #2 in place of #1 to check if maybe the plug itself is broken in this regard.

Point 2 of my issue is solved…to the extent. I’ve finally manage to do more tests and it looks like one of the power plugs shows completely wrong values. When 60W light bulb was plugged in it showed 777W and when I used another plug on my PC setup it showed the same reasonable values as previous tests.

problem is: you can’t calibrate them.

Yeah, I thought so but at least now I know where the problem is. This was especially important for me because those are the first power plugs with energy monitoring I have so I didn’t know if I did something wrong. And now I know I can try to contact seller and try to get replacement or refund.

It is not uncommon for these devices to have wrong scaling factors that have to be corrected in ‘quirks’ files and similar.

Your PC is not using 5kW. My guess: it’s 10x out and varying between 160W and 500W depending on CPU load.

Wait…is it possible to correct the value for this one device only?
It doesn’t look like 10x. The bulb shows 777W when it should be 60W. But I think it is linear. It looks like something around 12.95 would work also for the values from PC.

Config: It’s possible to correct these per device type by modifying the zigpy/zha library. I have no idea how to do this. I had a partial understanding of how to do it in Zigbee2mqtt, but ZHA seems more complex. I believe the default is standard scaling factors or factors read from the device, so I think corrections are special exceptions to the default.
If someone can give some pointers that would really help!

Electrical: Depending on how advanced the metering circuit is and how reactive your load is (or if it only takes power from certain parts of the voltage cycle) you might get quite a lot of error vs a calibrated RMS meter.

That would be nice because I’m not sure I will get any kind of refund from Aliexpress seller…And I’d rather have working device then deal with replacements…
But what you’ve said made me think - wouldn’t it be possible to use some dummy sensor (sorry HA nomenclature is like dark arts for me ;)) that would read faulty plug and add correction so I could then use it with new Energy tab?

Yes, that is what the ZHA device handlers project is doing.

The GitHub page gives quite a thorough description.

Aren’t quirks work for all devices from given manufacturer of given type? The issue here that some units are working fine and some don’t. So the global solution wouldn’t work here.

For the moment I’ve created a template sensor that have simple correction: device value * factor, and that’s the one I’m feeding to the integration sensor.

BTW That description is really thorough and worth reading! :slight_smile:

If you have just one device that is wildly different I suggest looking at the firmware version in the device info section of HA.

Firmware can be upgraded on some devices if they are different. I have had this happen before.