azerty9971 / xtend_tuya

eXtend Tuya's integration
GNU General Public License v3.0
41 stars 4 forks source link

Unable to obtain Zigbee plug "Power" and Wifi plug"Consumption" #80

Open desmondyipyc opened 4 weeks ago

desmondyipyc commented 4 weeks ago

Hi sorry, was multi tasking so my raised issue was messy, Here's a much clearer description, this is gonna be a lenghty issue hahaha

I use Power to track if the device is running at the point of time when i check on the device Consumption will be for energy used.

Currently i am facing two issue that never worked from 2.0.5 as i started using xtend tuya on 2.0.5

Zigbee plug POWER Regardless of version, Zigbee plug is unable to obtain LIVE data for POWER , it requires me to open up the app. For example, i plugged my device out from the smartplug, it was at 10W. but should reflect 0W after unplug, however due to not opening of the app. POWER on HA is stuck at 10W forever until i open up tuya > device > energy it will reflect 0W However Consumption B can be updated and able to retrieve past data as of 2.0.7 BETA

Here is the diagnostic log for zigbee plug POWER issue https://pastecode.io/s/mfz3rsdd

Wifi plug CONSUMPTION

I am unable to update accurate information for consumption and unable to retrieve past data of the plug's consumption as per my tuya account Example, Aircon Plug is with 100+ KW, it does not state so. After using AIrcon App for entire night, app is showing 3 KW, but xtend tuya is indicating less than 0.5KW which is impossible. However power is updated LIVE whenever there is a jump. which i used integral sum as a workaround to get consumption. It is not accurate to the app but it is as close as i can get with the consumption not working for WIFI plug. Will further clarify later as i have reinstall xtend tuya entirely, will check on the consumption and consumption B again with 2.0.7 beta.

Here is the diagnostic log for Wifi plug consumption issue. https://pastecode.io/s/yec5w1om

In conclusion, POWER not updating for zigbee smart plug but it is updating for wifi smart plug Wifi plug is not able to retrieve current total KW reflecting on TUYA app and it cannot accurately update actual consumption. It is tested with consumption A and B but it is doing so for Zigbee smart plug under consumption B.

As per the previous messy issue raise, i apologize for it and please dont be sorry for the issue of xtend tuya, xtend tuya have reduced my hassle to manually check the consumption individually on the TUYA app and supported actual consumption data of tuya app for zigbee device. I am thankful that you have created xtend tuya,

Thank you for your time, dedication and fast response.

azerty9971 commented 4 weeks ago

Hello, Thanks for your kind words :).

For the POWER, this is currently something we can't do much about, the only way to have this updated frequently is through the LocalTuya integration (https://github.com/rospogrigio/localtuya) (I'll try to make XT integrate with it so that it's not too hard in the future). The reason is that currently XT listens to what the cloud is sending, and if the cloud is not sending anything then we can't do much, the reason why it works when you use the Tuya app is that the Tuya app requests more frequent device updates using the same mecanism as LocalTuya.

As per the CONSUMPTION part, the history is not retrieved because the cloud basically only pushes the delta energy consumption (so if your device is consuming 1kW/h, you'll get a message every 30 minutes that say 0.5kW consumed since the last update.

This means that the consumption will only make sense after a full day (so basically, you have the consumption since the time you added the XT integration). Please note that you can use the Consumption entity in the energy dashboard to get some nice statistics: image

The reason why it works correctly with the Zigbee plug is that this one is sending the total consumption since the last reset of the device each time the cloud is pushing its value. Thus you get the exact same data as what you have on the Tuya app.

I hope this is clear, if you want, we can go through the process of configuring your device in LocalTuya together so that the power entity is updated more frequently ;)

Have a nice evening, Azerty

desmondyipyc commented 4 weeks ago

Will monitor on my end for the consumption How do i set up localtuya, is there a better way to contact you, what's your timezone and available timeframe? My timezone is gmt+8.

azerty9971 commented 3 weeks ago

Hello, my timezone is GMT+2.

If you want to contact me don't hesitate to do so via devun999999@gmail.com I'm available at your best convenience :).

Have a nice day, Azerty