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

Believe the webCoRE graphing is based on Hubigraph…

3 Likes

I am glad to hear that Hubigraph is living a second life atm! It's really one of the most advanced community apps for HE!

@iEnam congratulations on your first successful graphs!

I have updated the dev. branch (timeStamp "2022/09/18 8:42 PM") with some improvements related to the energy values reset when Initialize button is pressed or when a new plug is added using this driver. The last version is now also compatible with the new Quick Charts, although I still have a problem with the long-term Data Storage. Probably for now and for this kind of graphs the Hubigraph is better, I like the possibility to display two different types of data in a timeline graph using the left axis for one data and the right axis (respectively - different scaling!) for the other data.

If the 'Automatic Reporting Configuration' option is working for your smart plug, there should be power reading records every 15 minutes (if you use the default value of 900 seconds), even if the power consumption didn't change for this period. I am not 100% sure for this, as I can't test it at the moment, but I expect a Frient mini plug to come next week here, so I will be able to test it then.

For these plugs which do not support automatic reporting (as most of my AliExpress devices) we will need software timers to force a 'state change' update event, if more than 15 minutes (or whatever the 'Longest reporting interval' period is) has passed without a change event. This is normally not needed for the automations, but makes the graphs look much better! : )

If the latest dev. version is working stable, I will push it to HPM after a few days, as there were a lot of changes in the last week.

1 Like

I enabled automatic reporting on the Samsung plug but it doesn't report anything for Energy
Below is THAT info. I turned off the automatic reporting and still don't get energy.
You mentioned you weren't going to add this fingerprint... is that why it doesn't work?
The regular HE driver doesn't have the energy reporting (which I could live without) ....but it would be cool : )

That's because this Samsung plug model does not support energy reporting:
image

So this is an interesting case, which is in the middle between 'no power and no energy reporting at all' ( IKEA, OSRAM plugs ) and 'both power and energy reporting (automatic or by polling) '.

Theoretically, the energy consumption for this Samsung plug can be calculated inside the driver - by multiplying the last (or better the previous!) power value by the time period between two consecutive power readings. And it will be relatively precise!

I have added this to my long Backlog ... But I need to fix first a nasty bug that I have introduced in the last week - the software polling scheduled job stops after several hours, and I can't find the reason why yet.

@iEnam thank you for this report, the bug is confirmed. I will hold the HPM update until the reason for the bug is found and confirmed to be fixed.

2 Likes

I hope in the latest update (timeStamp: 2022/09/19 11:02 PM) the problem with the automatic polling was demystified and fixed. After the manual update to the latest dev. branch version, please click on the 'Save Preferences' button to update the scheduler.

Developers note: if a runIn() scheduled method is used for periodic tasks and it fails to execute because the HE hub was not operational at the scheduled run time (for example - the hub was updating/rebooting at that time), then the scheduled function will not be executed and the next runIn() job will not be scheduled again... As less the runIn() time period is, as bigger the chance to miss the next scheduled period is (where the timer should be restarted again).

The solution is well known - use a schedule("CRON expression") for the periodic tasks.

2 Likes

Thank you for the update, will test this evening.
Also, I connected a metering plug to my washing machine last night.
I can't access my graphs remotely now, but I recall the energy being about 0.22kWh for one cycle.
This does not seem to be correct; it should be 0.22x10=2.2kWh?
2.2kWhx0.282 = £0.62 - which seems reasonable.
Please check. Thanks

1 Like

2.2 kWh (2200 Watts power consumed for 60 minutes) seems too much to me for a washing machine...

Electricity Costs for 10 Key Household Products.

1 Like

Even if it's having to heat the water from cold?

I think that The water heating is not switched on all the time

I will move one of the measuring plugs to the washing machine tonight and will check.

I really like what your doing with deriving Energy costs so I just tried this driver with a Telstra (local Telco) branded zigbee smart metering plug and it seems to work OK.
I believe the device also goes under the Salus brand name.

Here's the finger print.

Telstra Outlet
ID: 3B25
Manufacturer : Sercomm Corp.
Product Name: Zigbee H1.2
Model Number: SZ-ESW01-AU
deviceTypeId: 14
manufacturer : Sercomm Corp.
idAsInt : 1
inClusters : 0000,0001,0003,0004,0005,0006,0B04,0B05,0702
endpointId : 01
profileId : 0104
application : 12
outClusters : 0003,000A,0B05,0019
initialized : true
model : SZ-ESW01-AU
stage : 4
manufacturer :
idAsInt : 2
inClusters : 0000,0001,0003
endpointId : 02
profileId : 0104
application :
outClusters : 0003,0006
initialized : true
model :
stage : 4

I ran out of time playing around but weirdly the Voltage reporting, which should be something around 240v, is way off.

Current States

  • energy : 0.67
  • energyCost : 0.38
  • power : 0
  • presence : present
  • switch : off
  • voltage : 30729

When I find some time I will investigate things further as like I said above, I really like how you've provided Energy Cost etc. Great stuff. Thanks

1 Like

Please see graph below.

Summary

I believe it was a 30 degrees wash cycle, and graph shows it was over a two-hour period if I recall correctly; 7:53pm-9.53pm.
If this cost is correct, then I will be a very happy man as this is not even a penny (£0.04)! Edit: it's 4p lol.
Will await your findings (will try a few tests with a kettle tonight). Thanks

1 Like

@kkossev,
I tried to compare the energy readings to boil a cup of water yesterday using my ZigBee plug and Wi-Fi plugs. Unfortunately, I could not get my old Wi-Fi plugs to give a reading for boiling a cup of water, no idea why as they all worked previously (good thing I've decided to get rid of all Wi-Fi plugs!).
Anyway, I have come to the conclusion that to boil a cup of water using a 3kW kettle will only cost £0.01 based on the calculation below (Note: ZigBee plug also reported energy of 0.05kWh for one cup):
3/60x0.282=0.01

1 cup = 0.05kWh = £0.01

Summary

I am not sure, why the readings for my washing machine were low, but it could be that the heating element is not working properly?
Thanks

My TS011F isn't working with Hubitat (works fine with the Tuya hub)

  • endpointId: 01
  • model: TS011F
  • application: A0
  • manufacturer: _TZ3000_okaz9tjs

Coming up as "not present" with 0 rxCounter, and the rxCounter almost being matched by the noPresentCounter.

What additional information is needed to get this driver working with these?

Unfortunately, I couldn't make this device work with HE.
Its Zigbee fingerprint is very non-standard, it lacks completely the outClusters list that is present for every other Zigbee device I have seen so far.

We've already tested this device a few weeks ago without success :

Can you post the link to the site where you purchased this US plug?
I will put a warning on the first post of this thread that this plug does not work with HE .

I have pushed the previous version ver. 1.6.1 update via HPM. If you are using it, please update the driver first from HPM, then you can manually update to the new dev. branch version 1.6.2 from the link on the second post.

I am still waiting for my Frient mini plug to arrive (hopefully will be able to test the automatic reporting configuration with this device), but meanwhile, I have started to prepare the code for calculating the energy costs also for some NON-Tuya smart plugs, including the Telstra outlet @njanda . Please let me know if the voltage and the power scaling work OK, it has a strange 125 divisor...

The voltage and power scalings are now corrected also for the Samsung plug @tim.ocallag

These are mine (UK plugs) - aliexpress item 1005002675027731.html ( I can't post links )

I'll have a play around with wireshark when I add it back to the Tuya hub and see what its actually doing.

Thanks for the update... the voltage looks right now : )
The html sometimes has power 0 and sometimes a value
No energy showing

setting as such

@kkossev,
Love all your drivers/apps.
Just wanted to ask, will you consider adding an option for "DailyEnergy" in a future version or can you advise how I can log the DailyEnergy consumptions?
Thanks again.

I bought 5 20A plugs that Ali mentioned last time, but only one power is reflected, and the rest of the logs are not uploaded. It's the same firmware...What kind of problem?
ml Presence present


Switch off
Power
Voltage 220 V
Amperage
Energy 0.0 kWh
Cost 0.0 $
Duration 10.98 Hours DEVICE test1plug 2022-09-25 02:36:49.613 AM KST

Summary

dev:3262022-09-25 02:27:01.197 amdebugformatAttrib

dev:3262022-09-25 02:27:00.213 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:27:00.167 aminfotest1plug voltage is 218 V

dev:3262022-09-25 02:27:00.166 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:27:00.155 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DA00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DA00080500210000

dev:3262022-09-25 02:27:00.062 amtracetest1plug polling all

dev:3262022-09-25 02:27:00.061 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:27:00.059 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:26:00.163 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:26:00.161 amdebugtest1plug IGNORED voltage 219 V (change from 219 is less than 1 V)

dev:3262022-09-25 02:26:00.160 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:26:00.149 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:26:00.059 amtracetest1plug polling all

dev:3262022-09-25 02:26:00.058 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:26:00.055 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:25:26.061 amdebugformatAttrib

dev:3262022-09-25 02:25:25.024 aminfotest1plug voltage is 219 V

dev:3262022-09-25 02:25:25.013 amdebugtest1plug parse: description is read attr - raw: 506C010B041E050521DB0008052100000B05290000, dni: 506C, endpoint: 01, cluster: 0B04, size: 1E, attrId: 0505, encoding: 21, command: 0A, value: DB0008052100000B05290000

dev:3262022-09-25 02:25:24.983 amdebugtest1plug energy is 0.0 kWh (no change)

dev:3262022-09-25 02:25:24.981 amtraceenergy_total=0, state.lastResetEnergy=0.0

dev:3262022-09-25 02:25:24.974 amdebugtest1plug parse: description is read attr - raw: 506C01070212000025000000000000, dni: 506C, endpoint: 01, cluster: 0702, size: 12, attrId: 0000, encoding: 25, command: 0A, value: 000000000000

dev:3262022-09-25 02:25:01.194 amdebugformatAttrib

dev:3262022-09-25 02:25:00.207 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:25:00.169 aminfotest1plug voltage is 218 V

dev:3262022-09-25 02:25:00.167 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:25:00.156 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DA00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DA00080500210000

dev:3262022-09-25 02:25:00.061 amtracetest1plug polling all

dev:3262022-09-25 02:25:00.060 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:25:00.057 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:24:51.725 amdebugtest1plug Tuya Cluster 0000 attrId FFE4 value 00)

dev:3262022-09-25 02:24:51.724 amdebugtest1plug Tuya Cluster 0000 attrId FFE2 value 36)

dev:3262022-09-25 02:24:51.722 amdebugtest1plug Tuya check-in Cluster 0 attrId 1 (application version is 4D)

dev:3262022-09-25 02:24:51.717 amdebugtest1plug parse: description is read attr - raw: 506C010000180100204DE2FF2036E4FF2000, dni: 506C, endpoint: 01, cluster: 0000, size: 18, attrId: 0001, encoding: 20, command: 0A, value: 4DE2FF2036E4FF2000

dev:3262022-09-25 02:24:06.866 amdebugtest1plug Event enter: [name:switch, value:off]

dev:3262022-09-25 02:24:06.861 amdebugtest1plug parse: description is read attr - raw: 506C0100060800001000, dni: 506C, endpoint: 01, cluster: 0006, size: 08, attrId: 0000, encoding: 10, command: 0A, value: 00

dev:3262022-09-25 02:24:00.174 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:24:00.172 amdebugtest1plug IGNORED voltage 219 V (change from 219 is less than 1 V)

dev:3262022-09-25 02:24:00.171 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:24:00.161 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:24:00.068 amtracetest1plug polling all

dev:3262022-09-25 02:24:00.067 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:24:00.065 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:23:00.172 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:23:00.170 amdebugtest1plug IGNORED voltage 219 V (change from 219 is less than 1 V)

dev:3262022-09-25 02:23:00.168 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:23:00.158 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:23:00.059 amtracetest1plug polling all

dev:3262022-09-25 02:23:00.058 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:23:00.055 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:22:03.492 amdebugtest1plug Tuya Cluster 0000 attrId FFE4 value 00)

dev:3262022-09-25 02:22:03.491 amdebugtest1plug Tuya Cluster 0000 attrId FFE2 value 36)

dev:3262022-09-25 02:22:03.490 amdebugtest1plug Tuya check-in Cluster 0 attrId 1 (application version is 4D)

dev:3262022-09-25 02:22:03.484 amdebugtest1plug parse: description is read attr - raw: 506C010000180100204DE2FF2036E4FF2000, dni: 506C, endpoint: 01, cluster: 0000, size: 18, attrId: 0001, encoding: 20, command: 0A, value: 4DE2FF2036E4FF2000

dev:3262022-09-25 02:22:00.172 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:22:00.170 amdebugtest1plug IGNORED voltage 219 V (change from 219 is less than 1 V)

dev:3262022-09-25 02:22:00.168 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:22:00.158 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:22:00.061 amtracetest1plug polling all

dev:3262022-09-25 02:22:00.060 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:22:00.058 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:21:01.190 amdebugformatAttrib

dev:3262022-09-25 02:21:00.210 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:21:00.166 aminfotest1plug voltage is 219 V

dev:3262022-09-25 02:21:00.165 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:21:00.154 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:21:00.058 amtracetest1plug polling all

dev:3262022-09-25 02:21:00.057 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:21:00.054 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:20:04.036 amdebugformatAttrib

dev:3262022-09-25 02:20:03.054 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:20:03.052 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:20:03.007 aminfotest1plug voltage is 218 V

dev:3262022-09-25 02:20:02.997 amdebugtest1plug parse: description is read attr - raw: 506C010B041E050521DA0008052100000B05290000, dni: 506C, endpoint: 01, cluster: 0B04, size: 1E, attrId: 0505, encoding: 21, command: 0A, value: DA0008052100000B05290000

dev:3262022-09-25 02:20:02.987 aminfotest1plug energy is 0.0 kWh, energyCost=$0.0 (rate=$0.12), duration=10.7 Hours

dev:3262022-09-25 02:20:02.884 amtraceenergy_total=0, state.lastResetEnergy=0.0

dev:3262022-09-25 02:20:02.877 amdebugtest1plug parse: description is read attr - raw: 506C01070212000025000000000000, dni: 506C, endpoint: 01, cluster: 0702, size: 12, attrId: 0000, encoding: 25, command: 0A, value: 000000000000

dev:3262022-09-25 02:20:01.212 amdebugformatAttrib

dev:3262022-09-25 02:20:00.226 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:20:00.187 aminfotest1plug voltage is 219 V

dev:3262022-09-25 02:20:00.185 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:20:00.174 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:20:00.074 amtracetest1plug polling all

dev:3262022-09-25 02:20:00.071 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:20:00.066 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:19:27.477 amdebugtest1plug Tuya Cluster 0000 attrId FFE4 value 00)

dev:3262022-09-25 02:19:27.476 amdebugtest1plug Tuya Cluster 0000 attrId FFE2 value 36)

dev:3262022-09-25 02:19:27.475 amdebugtest1plug Tuya check-in Cluster 0 attrId 1 (application version is 4D)

dev:3262022-09-25 02:19:27.469 amdebugtest1plug parse: description is read attr - raw: 506C010000180100204DE2FF2036E4FF2000, dni: 506C, endpoint: 01, cluster: 0000, size: 18, attrId: 0001, encoding: 20, command: 0A, value: 4DE2FF2036E4FF2000

dev:3262022-09-25 02:19:01.189 amdebugformatAttrib

dev:3262022-09-25 02:19:00.208 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:19:00.164 aminfotest1plug voltage is 218 V

dev:3262022-09-25 02:19:00.162 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:19:00.152 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DA00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DA00080500210000

dev:3262022-09-25 02:19:00.060 amtracetest1plug polling all

dev:3262022-09-25 02:19:00.058 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:19:00.056 amdebugtest1plug autoPoll()

dev:3262022-09-25 02:18:01.248 amdebugformatAttrib

dev:3262022-09-25 02:18:00.264 amdebugtest1plug IGNORED amperage 0 A (change from 0.0 is less than 25 mA)

dev:3262022-09-25 02:18:00.224 aminfotest1plug voltage is 219 V

dev:3262022-09-25 02:18:00.222 amdebugtest1plug IGNORED power 0 W (change from 0.0 is less than 1 W)

dev:3262022-09-25 02:18:00.212 amdebugtest1plug parse: description is read attr - raw: 506C010B04240B0529000005050021DB00080500210000, dni: 506C, endpoint: 01, cluster: 0B04, size: 24, attrId: 050B, encoding: 29, command: 01, value: 000005050021DB00080500210000

dev:3262022-09-25 02:18:00.063 amtracetest1plug polling all

dev:3262022-09-25 02:18:00.062 amtracetest1plug polling.. refreshAll is false

dev:3262022-09-25 02:18:00.059 amdebugtest1plug autoPoll()