[RELEASE] Tuya Zigbee Metering Plug (w/ healthStatus)

Dang, I only bought 1 ....wanted to make sure it works...in retrospect I should have gotten 2
When I press the button on the side it does change the physical state of the light but nothing is reflected in the logs
Here is my zigbee channel
image

All looks good... Is this the 16A or 20A version?
Are you pairing it really close (1-2 meters away) from the HE hub?

not so close...let me try that

Delete it first and pair as a new device

Did that....unfortunately i think the logs are the same for initialize
dev:8202022-09-09 01:14:06.515 pm infoHotTub refresh()...

dev:8202022-09-09 01:14:06.512 pm infoHotTub configure()..

dev:8202022-09-09 01:14:06.511 pm infoHotTub configuring the switch and energy reporting..

dev:8202022-09-09 01:14:06.510 pm infoHotTub Auto polling is enabled, polling interval is 60 seconds

dev:8202022-09-09 01:14:06.469 pm infoHotTub Debug logging is false Description text logging is true

dev:8202022-09-09 01:14:06.468 pm infoHotTub Updating HotTub (Tuya Zigbee Metering Plug) model TS011F presence: null AlwaysOn is false

dev:8202022-09-09 01:14:06.377 pm infoHotTub Initialize()...

dev:8202022-09-09 01:14:04.110 pm traceHotTub sendZigbeeCommands received : [he raw 0x5CD3 1 0x01 0x0000 {10 00 00 04 00 00 00 01 00 05 00 07 00 FE FF}, delay 200, he rattr 0x5CD3 0x01 6 0 {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 00 0B 05 05 05 08 05}, delay 200, he raw 0x5CD3 1 0x01 0x0702 {10 00 00 00 00}, delay 2000, zdo bind 0x5CD3 0x01 0x01 6 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 6 0 16 0 600 {}, delay 2000, zdo bind 0x5CD3 0x01 0x01 0x0702 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 1794 0 37 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0702 {10 00 08 00 0000}, delay 250, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 2820 1291 41 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 08 00 0B05}, delay 250, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 2820 1285 33 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 08 00 0505}, delay 250, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 2820 1288 33 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 08 00 0805}, delay 250]

dev:8202022-09-09 01:14:04.107 pm traceHotTub configureReporting operation=Write, measurement=Amperage minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:14:04.104 pm traceHotTub configureReporting operation=Write, measurement=Voltage minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:14:04.101 pm traceHotTub configureReporting operation=Write, measurement=Power minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:14:04.098 pm traceHotTub configureReporting operation=Write, measurement=Energy minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:14:04.068 pm traceHotTub polling all

dev:8202022-09-09 01:14:04.067 pm traceHotTub polling.. refreshAll is true

dev:8202022-09-09 01:14:04.066 pm infoHotTub refresh()...

dev:8202022-09-09 01:14:04.063 pm infoHotTub configure()..

dev:8202022-09-09 01:14:04.062 pm infoHotTub configuring the switch and energy reporting..

dev:8202022-09-09 01:14:04.061 pm infoHotTub Auto polling is enabled, polling interval is 60 seconds

dev:8202022-09-09 01:14:04.035 pm infoHotTub Debug logging will be automatically switched off after 24 hours

dev:8202022-09-09 01:14:04.007 pm infoHotTub Debug logging is true Description text logging is true

dev:8202022-09-09 01:14:03.979 pm infoHotTub Updating HotTub (Tuya Zigbee Metering Plug) model TS011F presence: null AlwaysOn is false

dev:8202022-09-09 01:14:03.978 pm traceHotTub destinationEP = 01

dev:8202022-09-09 01:14:03.977 pm traceHotTub model = TS011F

dev:8202022-09-09 01:14:03.945 pm infoHotTub InitializeVars()... fullInit = true

dev:8202022-09-09 01:14:03.928 pm infoHotTub Initialize()...

dev:8202022-09-09 01:13:50.069 pm traceHotTub sendZigbeeCommands received : [he raw 0x5CD3 1 0x01 0x0000 {10 00 00 04 00 00 00 01 00 05 00 07 00 FE FF}, delay 200, he rattr 0x5CD3 0x01 6 0 {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 00 0B 05 05 05 08 05}, delay 200, he raw 0x5CD3 1 0x01 0x0702 {10 00 00 00 00}, delay 2000, zdo bind 0x5CD3 0x01 0x01 6 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 6 0 16 0 600 {}, delay 2000, zdo bind 0x5CD3 0x01 0x01 0x0702 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 1794 0 37 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0702 {10 00 08 00 0000}, delay 250, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 2820 1291 41 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 08 00 0B05}, delay 250, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 2820 1285 33 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 08 00 0505}, delay 250, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, delay 2000, he cr 0x5CD3 0x01 2820 1288 33 60 3600 {} {}, delay 2000, he raw 0x5CD3 1 0x01 0x0B04 {10 00 08 00 0805}, delay 250]

dev:8202022-09-09 01:13:50.064 pm traceHotTub configureReporting operation=Write, measurement=Amperage minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:13:50.061 pm traceHotTub configureReporting operation=Write, measurement=Voltage minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:13:50.057 pm traceHotTub configureReporting operation=Write, measurement=Power minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:13:50.053 pm traceHotTub configureReporting operation=Write, measurement=Energy minTime=60, maxTime=3600, delta=0 )

dev:8202022-09-09 01:13:50.023 pm traceHotTub polling all

dev:8202022-09-09 01:13:50.022 pm traceHotTub polling.. refreshAll is true

dev:8202022-09-09 01:13:50.021 pm infoHotTub refresh()...

dev:8202022-09-09 01:13:50.017 pm infoHotTub configure()..

dev:8202022-09-09 01:13:50.017 pm infoHotTub configuring the switch and energy reporting..

dev:8202022-09-09 01:13:50.015 pm infoHotTub Auto polling is enabled, polling interval is 60 seconds

dev:8202022-09-09 01:13:49.983 pm infoHotTub Debug logging will be automatically switched off after 24 hours

dev:8202022-09-09 01:13:49.957 pm infoHotTub Debug logging is true Description text logging is true

dev:8202022-09-09 01:13:49.956 pm infoHotTub Updating HotTub (Tuya Zigbee Metering Plug) model TS011F presence: null AlwaysOn is false

dev:8202022-09-09 01:13:12.451 pm infoTuya Zigbee Metering Plug refresh()...

dev:8202022-09-09 01:13:12.447 pm infoTuya Zigbee Metering Plug configure()..

dev:8202022-09-09 01:13:12.445 pm infoTuya Zigbee Metering Plug configuring the switch and energy reporting..

dev:8202022-09-09 01:13:12.444 pm infoTuya Zigbee Metering Plug Auto polling is enabled, polling interval is 60 seconds

dev:8202022-09-09 01:13:12.411 pm infoTuya Zigbee Metering Plug Debug logging is false Description text logging is true

dev:8202022-09-09 01:13:12.409 pm infoTuya Zigbee Metering Plug Updating null (Tuya Zigbee Metering Plug) model TS011F presence: null AlwaysOn is false

dev:8202022-09-09 01:13:12.333 pm infoTuya Zigbee Metering Plug Initialize()...

dev:8202022-09-09 01:13:07.348 pm infoTuya Zigbee Metering Plug refresh()...

dev:8202022-09-09 01:13:07.344 pm infoTuya Zigbee Metering Plug configure()..

dev:8202022-09-09 01:13:07.278 pm infoTuya Zigbee Metering Plug Installed()...

and for test

dev:8202022-09-09 01:17:51.115 pm tracesending test: [zdo bind 0x5CD3 0x01 0x01 0x0006 {70B3D52B6000F426} {}, zdo bind 0x5CD3 0x01 0x01 0x0702 {70B3D52B6000F426} {}, zdo bind 0x5CD3 0x01 0x01 0x0B04 {70B3D52B6000F426} {}, he cmd 0x5CD3 0x01 6 2 {}, delay 200]

so its quite possible this is defective....

Yes, the logs are the same - nothing received from the device.
So it may be either defective, or something specific for HE during the inital pairing procedure prevents it from working here. Probably the fastest solution would be to return it of you can an get another zigbee plug.

will do...i really appreciate all of your help.... your driver really has a lot of options for digging in.Thx

1 Like

The development branch was updated to version 1.6.0, timeStamp 2022/09/10 1:02 PM .

The first major change is the return of the automatic reporting configuration for energy, power, voltage and amperate readings changes. Many thanks to @guyeeba for the feedback and bug fixes! In the recent Tuya firmware updates, it seems like the automatic reporting is back for some plugs. Whether the automatic reporting (not by polling!) will work or not for your device depends on the particular model and manufacturer and most importantly - depends on the Tuya device firmware version. In the past years Tuya was periodiclaly enabling, then disabling, then again enabling the automatic reporting for power/voltaga/amperage. So there is not a 100% sure way to determine whether a Tuya metering plug requres polling or not. The only way is to test it..

image
This new option (enabled by default!) will try to configure the automatic reporting each time when the 'Save' button from the Preferences section is clicked. As mentioned, even if the device returns 'succes' code (can be seen in the debug logs), there is no guarantee that the automaic reporting will work. This can be checked by switching off the old option " Automatic polling" and observing the logs. If there are new W/V/A events in the next few hours - then the automatic reporting works, otherwise - it does not work for your device and you must continue to use the software polling option in this driver. Both the new "Automatic Reporting Configuration" and the old "Automatic polling" can be enabled at the same time.

There are also individual reporting threshold parameters for the Energy, Power, Voltage and Amperage. If any of these are not needed for your use case, the reporting can be disabled using the existing 'off or on' switches.

The second addition is the "Reset Energy" command. Unlike the zWave devices, most of the Zigbee devices do not have an explicit Reset command supported in the firmware, so resetting the energy reading is simulated by storing the actual energy reading in a state and then subtracting it from the new energy readings. The custom 'resetEnergy' command can be invoked from RM5 rule every month or every week, etc..

3 Likes

On this development version I'm not getting anything in logs, or on the device as power level goes on, off, increases, or decreases.

Summary



image

1 Like

If you switch the Debug logging on, you should see info logs when a reading was ignored, because the changed value is less than the configured threshold.

The easiest way to check is to switch the plug off and then back on. The readings are updated after 5.5 seconds.

Your settings are enabled only for energy and amperage ( power and voltage updates are disabled). What is your load? Have in mind, that a single LED bulb as example may not trigger amperage reading with these plugs, if the power consumed is less than 9 watts. The power will be updated, but the amperage reading may not be correct at low currents and highly capacitive or inductive loads.

Update: I see where the problem is now - you have configured the energy minimum change as 0.1 Wh ( Watt per Hour). This is 0.0001 KWh ... So yes, it is confusing to have two different units for one and the same measurement parameter (energy). I will see what will happen if I change the energy delta value from Wh to KWh.

2 Likes

As you stated.

1 Like

I will need more complete debug logs to analyze the responses that your plug is returning.
Can you copy and paste the the text from HE logs page for this device and send it to me? You can do it in a PM to avoid filling in this thread with logs.. Or use the wheel cog tool in the forum editor to hide the logs like this

Summary

dev:1273](http://192.168.0.151/logs?tab=past&deviceId=1273#)2022-09-10 21:20:14.733debugTS0121 IGNORED amperage 0.342 A (change from 0.342 is less than 10 mA)

dev:12732022-09-10 21:20:14.730debugTS0121 IGNORED voltage 221 V (change from 221 is less than 1 V)

dev:12732022-09-10 21:20:14.727debugTS0121 IGNORED power 71 W (change from 71 is less than 1 W)

dev:12732022-09-10 21:20:14.717debugTS0121 parse: description is read attr - raw: 3F13010B04240B0529470005050021DD00080500215601, dni: 3F13, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 470005050021DD00080500215601

dev:12732022-09-10 21:20:14.615traceTS0121 polling all

Make sure with this version the energy delta value is at least 1 ( not 0.1)
And in the next update I will make the "Automatic reporting configuration" switch disabled by default, obviously, most of the plugs that are on the market now do not support the automatic reporting. In your case the configuration commands are returning 'Failure', but this is not very obvious when the debug logs are turned off (as should be in a normal operation).

1 Like

@mpoole32 thank you for the tests and the feedback!
As a summary from my side: your plug does not support automatic reporting, so you must continue to use the old 'automatic polling' option. We've also found that these cheap measuring plugs do not behave very well with pure inductive kind of loads, such as low-power fans. Also, it is confusing that The minimum Energy change that will trigger reporting. parameter is currently presented as Watts per hour, while the total Energy is sent and shown in the Current States as Kilo Watts per hour (KWh). I will try to change the energy delta parameter to be also presented in KWh in one of the next updates.

  • ver. 1.6.0 2022-09-11 (dev. branch) : TimeStamp 2022/09/11 10:36 AM
    • autoReportingEnabled switch is now by default false;
    • unused (disabled) attributes states are now deleted (example: if Power reporting is Off, the Power attribute will not be shown in the Current States;
    • added energyPrice (decimal) preference;
    • added setEnergyPrice command;
    • added energyCost calculation and event

The energyCost is calculated incrementally, i.e. when a new Energy reading is reported, the difference between the new and the old Energy values are multiplied by the current energyPrice and then added to the accumulated energyPrice from the previous reports.. This means, that we can change dynamically the energyPrice, using the custom command setEnergyPrice from a RM5 rule. In my country we have energy daily rates and energy night rates, in which prices differ significantly. So when the energyPrice is changed based on the time of the day, RM5 rule can change the energy rate used for calculating the price for all devices, that use this driver.

Next update should add the energyDuration as in the Zooz driver.

3 Likes

@kkossev,
Thank you for your excellent drivers and apps.
Sorry for the newbie question, but I was looking to get the daily energy reading for my devices.
But, it seems that doing a reset shows the current energy consumption then it reverts to the total energy consumption on the plug again... so, I am not sure how to generate a daily energy consumption log. Any suggestion will be much appreciated.
Thank you.

Summary


1 Like

@iEnam probably the best approach would be to implement inside the driver "hourlyEnergy" and "dailyEnergy" custom attributes and events. hourlyEnergy will be auto-reset each hour, dailyEnergy will be reset each day. This will greatly simplify graphs like this:

Currently, the above graphs require 4 Hub Variables, the relatively complex RM5 rule as in the link above, etc. Not very convenient.

2 Likes

Yes, that would be great if you can implement the "hourlyEnergy" and "dailyEnergy" custom attributes in the driver.
I am currently using Quick chart as this seems to be the easiest to use for a newbie like me, all other graphing methods seem a bit complex for me.
Thanks again.

1 Like

Thank you for the report - yes, there was a bug in the energy reset logic in the previous test version. Hopefully, this is now corrected in the new update (ver 1.6.0 2022/09/11 1:31 PM).

1 Like

Thanks for the quick bug fix!

Summary

image


image

Summary

dev:6522022-09-11 01:26:17.975 pminfoKettle voltage is 241 V

dev:6522022-09-11 01:25:18.043 pminfoKettle voltage is 242 V

dev:6522022-09-11 01:24:17.938 pminfoKettle amperage is 0.023 A

dev:6522022-09-11 01:24:17.935 pminfoKettle voltage is 240 V

dev:6522022-09-11 01:24:17.932 pminfoKettle power is 0 W

dev:6522022-09-11 01:23:36.193 pminfoKettle energy is 0.07 kWh energyCost=0.02 (rate=0.282)

dev:6522022-09-11 01:23:23.247 pminfoKettle energy is 0.06 kWh energyCost=0.02 (rate=0.282)

dev:6522022-09-11 01:23:17.922 pminfoKettle amperage is 11.786 A

dev:6522022-09-11 01:23:17.920 pminfoKettle voltage is 236 V

dev:6522022-09-11 01:23:17.917 pminfoKettle power is 2812 W

dev:6522022-09-11 01:23:10.307 pminfoKettle energy is 0.05 kWh energyCost=0.01 (rate=0.282)

dev:6522022-09-11 01:22:58.365 pminfoKettle energy is 0.04 kWh energyCost=0.01 (rate=0.282)

dev:6522022-09-11 01:22:45.438 pminfoKettle energy is 0.03 kWh energyCost=0.01 (rate=0.282)

dev:6522022-09-11 01:22:32.542 pminfoKettle energy is 0.02 kWh energyCost=0.01 (rate=0.282)

dev:6522022-09-11 01:22:23.348 pminfoKettle amperage is 11.949 A

dev:6522022-09-11 01:22:23.345 pminfoKettle voltage is 242 V

dev:6522022-09-11 01:22:23.343 pminfoKettle power is 2850 W

dev:6522022-09-11 01:22:19.561 pminfoKettle energy is 0.01 kWh energyCost=0.0 (rate=0.282)

dev:6522022-09-11 01:22:17.823 pminfoKettle Kettle was turned on [physical]

dev:6522022-09-11 01:22:12.025 pminfoKettle voltage is 240 V

dev:6522022-09-11 12:08:10.174 pminfoKettle voltage is 240 V

dev:6522022-09-11 12:07:10.211 pminfoKettle voltage is 241 V

dev:6522022-09-11 12:01:23.262 pminfoKettle Energy (total:9.1 kWh) was reset on 2022-09-11 12:01:23.244

dev:6522022-09-11 12:01:23.254 pminfoKettle energy is 0.0 kWh energyCost=0.0 (rate=0.282)

dev:6522022-09-11 12:01:21.111 pminfoKettle energy is 9.1 kWh energyCost=1.09 (rate=0.282)

dev:6522022-09-11 12:01:18.789 pminfoKettle refresh()...

dev:6522022-09-11 12:01:15.279 pminfoKettle energy price was set to 0.282 on 2022-09-11 12:01:15.278

dev:6522022-09-11 12:01:11.963 pminfoKettle energy is 9.1 kWh energyCost=1.09 (rate=0.12)

dev:6522022-09-11 12:01:11.768 pminfoKettle voltage is 240 V

dev:6522022-09-11 12:01:09.940 pminfoKettle Kettle switch is off

dev:6522022-09-11 12:01:09.465 pminfoKettle refresh()...

dev:6522022-09-11 12:01:09.460 pminfoKettle configure()..

dev:6522022-09-11 12:01:09.459 pminfoKettle configuring the switch and energy reporting..

dev:6522022-09-11 12:01:09.458 pminfoKettle Auto polling is enabled, polling interval is 60 seconds

dev:6522022-09-11 12:01:09.420 pminfoKettle Debug logging is false Description text logging is true

dev:6522022-09-11 12:01:09.419 pminfoKettle Updating Kettle (Ajax Socket) model TS011F presence: present AlwaysOn is false

dev:6522022-09-11 12:01:09.317 pminfoKettle Initialize()...

1 Like

I really like these energy graphs... but the complex RM5 rules just scare me...
Can someone please share some simple RM5 rules that you are using with the latest development version to show "daily" and "hourly" energy consumption and corresponding costs if possible?
Thanks

If you are not in a hurry, better wait until the next weekend, hopefully then I will have a simpler solution.

2 Likes