Driver for Zigbee Tuya Power Monitoring

This device will require a specific driver in Hubitat to support all three channels as child devices.

If any developer is willing to try writing such a HE-specific driver, I can help if needed.

Thanks for reply and support.

I picked up a 2 channel power monitor similar to that described above. Differences are manufacturer (_TZE200_rks0sgb7) and inClusters:"0000,0004,0005,EF00,FF66". There is also a line in the logs that reads "ZCL version:03"; I'm guessing this indicates Zigbee 3?
I'd rather not go the Home Assistant route, but unless someone comes out with an HE driver for this or can guide me on how to modify the existing Tuya driver (with 2500+ lines of code) I don't have any other options.

ZCL 3.0 means nothing in regard to whether a device will follow the Zigbee Home Automation (ZHA) 1.2 standards or not. A lot of Tuya devices do not .. : (

If you are using a lot of AliExpress stuff, the safest way to go is to have a HA 'çompanion', where all the new Tuya gadgets are usually added very quickly (in Zigbe2MQTT). Hopefully, in the near future with the inclusion of the Power and Energy monitoring in the Matter standard there will be alternative ways to bring these devices to Hubitat.

I have added this device to the current dev. branch version of the Tuya driver ver 1.9.0 2024/01/18 8:19 PM - you can update the driver clicking on the Import button within the HE driver editor, or directly from here.

Note, that only the first channel is expected to work - this driver is not suited for multi-channel devices.

Thanks kkossev. I updated the driver and while it shows energy used, for voltage and amperage it only shows n/a. Power is usually zero, although it occasionally changes to 93.1. The logs do show this error message:
"groovy.lang.MissingMethodException: No signature of method: user_driver_kkossev_Tuya_Zigbee_Metering_Plug_1827.currentEvent() is applicable for argument types: (java.math.BigDecimal) values: [0.06] on line 1356 (method parse)"

Ideally I would like to see current or power from this device.Again, I appreciate your help on this.

I have found a bug in the code, fixed in new dev. branch version 1.9.1 2024/01/24 10:52 AM
It affects the amperage readings only. I still have no idea why the power readings are not shown.
Can you post some debug logs that include a keyword 'power' in the text (use Control-F on the live logs page to search for the text). I have also reduced the debug logs a bit so that it is easier to read.

I expect the Voltage, Frequency and PowerFactor to be working. If you see 'n/a', this means that these are disabled in the Preferences section - just enable these options there.

It may be a good idea to use both clamps (even if only clamp A should generate events), in case A/B is interpreted wrongly in the driver. Make sure you have active load > 10 watts ( a single LED bulb may have bad powerFactor and may not be detected by a 63A clamp).

I updated the code and it is moving things in the right direction. Voltage and amperage are now 0 instead of n/a and the error message is gone. I also extracted some lines from the logs that may be helpful.

dev:23882024-01-30 08:43:29.085 AMinfoPC311 power is 0.0 W
dev:23882024-01-30 08:43:29.083 AMinfoPC311 (103) Real Active Power : 0E+1 W (raw 0)
dev:23882024-01-30 08:43:28.085 AMinfoPC311 power is 93.2 W
dev:23882024-01-30 08:43:28.082 AMinfoPC311 (101) PJ1203A power_a : 93.2 raw (932)
dev:23882024-01-30 08:43:11.066 AMdebugPC311 (105) PJ1203A power_b : 1372.6 raw (13726)
dev:23882024-01-30 08:42:41.034 AMdebugPC311 (105) PJ1203A power_b : 1360.9 raw (13609)

dev:23882024-01-30 08:42:58.128 AMinfoPC311 power is 93.2 W
dev:23882024-01-30 08:42:58.125 AMinfoPC311 (101) PJ1203A power_a : 93.2 raw (932)

dev:23882024-01-30 08:43:04.134 AMdebugPC311 ignored powerFactorEvent (0) - reportPowerFactor is disabled
dev:23882024-01-30 08:43:04.131 AMinfoPC311 (110) PJ1203A power_factor_a : 0 raw (0)

dev:23882024-01-30 08:43:27.085 AMwarnPC311 map= [raw:catchall: 0104 EF00 01 01 0040 00 3A23 01 00 0000 02 01 0053020200040000048D, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:3A23, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 53, 02, 02, 00, 04, 00, 00, 04, 8D]]

dev:23882024-01-30 08:43:27.082 AMwarnPC311 Tuya unknown attribute: 0053=02=0200 data.size() = 10 value: 1165}

dev:23882024-01-30 08:43:28.075 AMdebugPC311 parse: description is catchall: 0104 EF00 01 01 0040 00 3A23 01 00 0000 02 01 005465020004000003A4

dev:23882024-01-30 08:43:27.080 AMdebugPC311 parse: Desc Map: [raw:catchall: 0104 EF00 01 01 0040 00 3A23 01 00 0000 02 01 0053020200040000048D, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:3A23, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 53, 02, 02, 00, 04, 00, 00, 04, 8D]]

dev:23882024-01-30 08:43:27.075 AMdebugPC311 parse: description is catchall: 0104 EF00 01 01 0040 00 3A23 01 00 0000 02 01 0053020200040000048D

dev:23882024-01-30 08:43:26.081 AMdebugPC311 Tuya switch event cmd=(01) value=938

dev:23882024-01-30 08:43:26.078 AMdebugPC311 parse: Desc Map: [raw:catchall: 0104 EF00 01 01 0040 00 3A23 01 00 0000 02 01 005201020004000003AA, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:3A23, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 52, 01, 02, 00, 04, 00, 00, 03, AA]]

dev:23882024-01-30 08:43:26.073 AMdebugPC311 parse: description is catchall: 0104 EF00 01 01 0040 00 3A23 01 00 0000 02 01 005201020004000003AA

dev:23882024-01-30 08:43:20.088 AMdebugPC311 attribute report: cluster=0000 attrId=0001 value=43 status=null data=null

dev:23882024-01-30 08:43:20.086 AMdebugPC311 parse: Desc Map: [raw:3A230100000A01002043, dni:3A23, endpoint:01, cluster:0000, size:0A, attrId:0001, encoding:20, command:01, value:43, clusterInt:0, attrInt:1]

dev:23882024-01-30 08:43:20.081 AMdebugPC311 parse: description is read attr - raw: 3A230100000A01002043, dni: 3A23, endpoint: 01, cluster: 0000, size: 0A, attrId: 0001, encoding: 20, command: 01, value: 43

dev:23882024-01-30 08:43:20.043 AMtracePC311 sendZigbeeCommands : [he raw 0x3A23 1 0x01 0x0000 {10 00 00 01 00}, delay 200]

I bought the gateway for the device to a) ensure that it is working properly and b) try using with the cloud integration for HA. As the screen shot shows, it does indeed work. The cloud integration for HA is not worth it for me because it only reports total energy and is pretty slow to respond. My ideal scenario is to access it directly from Hubitat, but if I'm not able to do that I plan to try a local integration for HA.

I now have it working in Home Assistant, bridged back to Hubitat.

I don't know if this information will help getting it working in Hubitat directly, but here goes for anyone interested:
When I first set it up in HA it was recognized as a PJ1203A which looks identical but didn't work (the results were the same as I was seeing with the Hubitat driver).
I then found specific support for it by adding an external converter created by KPfff, posted Oct 31, 2023. Here is a link to that thread. It is important to note that the ZHA integration won't work. You need to use Zigbee2MQTT Edge integration.

1 Like

I bought one of these as well - except mines blue! Maybe they ran out of white plastic that day. :wink:

When I first did the add device, it came up as a garage door opener!?
HE is reporting:

  • manufacturer: _TZE204_81yrt3lo
  • model: TS0601

I got this one in particular since it's 2 channel (and being in Canada, we are of course split phase 240) - and it's bidirectional - so I could then hopefully tell if my solar system is over generating and dumping back into the grid. I'm shooting for zero!

Only JUST hooked it up, and tried using the metered plug option. Seems that I'm at about 83hz, and I've used ~$8 of power in the last 15 minutes. Boy do I hope it's wrong. Ha ha....

Hopefully, Matter 1.3 specifications will be released in a couple of months; the rumors are that it should bring power and energy monitoring. Then, once the power and energy monitoring is also implemented in the Tuya Matter Bridges - all these issues will be in the past...

Until this happens, Home Assistant (Zigbee2MQTT) integration to HE is the most time and money-effective way to bring all the cheap Tuya-based gadgets to Hubitat.

An all-in-one solution would sure be nice. Even if it means yet another box.

Not that it matters much, but this is the one I got: https://www.aliexpress.com/item/1005006217976032.html

@john.craker
I bought exactly the same sensor but with one clamp.
@kkossev
Driver works ok but one thing.
I am not sure if i choose the right settings.
I am not getting any changes in "power state".
Amperage is changing but not the state, it is always off even amperage is bigger than 0.
Is there any minimum amperage to change it to on?

If you enable the debug logs and search the live logs for ‘power’, do you see anything there?

I don't know if this helps any, but.... since I couldn't even get the 'smart life' app to recognize the device, I grabbed one of the cheap Zigbee 3.0 wired hubs. The hub found it within seconds, and SEEMS to be reporting good data.

There's no way to pull logs or data off though? I don't think?

I meant the debug logs in HE, using the Tuya Metering plug driver. It is possible that the forward and reverse power readings are mixed up... The reverse power readings are not sent as events in the driver, but will be shown in the live logs when Debug preference is enabled. If you search for 'power' text in the logs, do you see readings that make sense?

Hi.
Attached log file

Does 'power_a' 6.4 watts make sense?

It is connected to split HVAC system.
It is in stand by mode now. So current 0.048amp is making sense. For 236V x 0.048A ~ 11.3W so....

1 Like

Right, I knew you meant HE logs - I just thought if there was a way to extract something from a live working system it might help.

At this point I'm semi dead in the water though. I can add the device to my new hub, and via the mfg's app it all works as expected. For about 5-10 minutes. Then shows disconnected. :frowning:
I then have to delete and add it back to the app. Somewhat not useful. Sigh.

So until I resolve that (or replace it) there's not much I can do to help.

1 Like

Well, I can't explain it... but after moving things around (like 6 or 8 inches!)... it's been online (for the iOS Smart Life app) for a few days now! Clearly had it too close to SOMETHING it didn't like.

Only thing that's strange (and thankfully really easy to fix) is that phase A and B are reading backwards. With no solar coming off my inverters, one shows all inbound flow, and the other one outbound! Ha! Guess they wired the leads on a CT backwards or something.

1 Like