Zigbee plug via ZHA reports summary energy consumption with huge delay

Recently I bought Zigbee plug.

Vendor: (should be Tuya but shows in ZHA like this): _TZ3000_iksasdbv
Model: TS011F

Current energy consumption is updated every 30 seconds as you can see here:

However - when you look at total energy consumption it looks like it’s value is updated once, maybe twice a day. Graph for same period of time:

What can be a reason for such odd behaviour? It doesn’t make any sense. It shows true values but with significant delay.

EDIT: Also it never gets offline. Even if you unplug it from power it will never become offline in HA. Another thing is that if you switch it using button on plug it will not change state in HA. Only if you change state via HA.

Check out Howto avoid Timeout errors with attr_read -> 'tries' & 'conf_report' · Issue #72 · mdeweerd/zha-toolkit · GitHub .

Regarding the consumption reporting, it is likely that the reporting configuration is not configured as expected.

Regarding the on/off state report: I have several where the “Vendor” is set to “_TZ3000_wamqdr3f” that report the on/off state as expected. However Tuya has a tendency of doing things differently from the Zigbee specifiation. We even have a “Magic spell” for some Tuya devices to unlock their normal behavoir.
I think you could increase the zipy log level to see the incoming packets sot that you can can if HA actually receives somthing from the plug when you change the state.

Well… I had to install this ZHA Toolbox cause I never had it before BUT… IT WORKS! :slight_smile:
Thank you very much.

And what is this “magical spell” you are reffering to?

See: GitHub - mdeweerd/zha-toolkit: 🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant initially called so in SilverCrest PowerStrip 3 AC (16A) with 4 USB Model HG06338 · Issue #9564 · Koenkk/zigbee2mqtt · GitHub .

Happy to hear that the toolkit provided the tool to fix it for you ;-).

Man… you ROCK!

This Tuya Magic thing actually fixed manual button switch reporting. Now even when pressed on device itself it reports new state immediatelly to HA. Does it have to be done only once per device or maybe each device reboot or HA restart? Would it also fixed power reporting? I already fixed it using your automation but maybe this magic spell works also for that so automation is not needed anymore?

I suppose that you implemented the first solution: attr_read, but you can send a report configuration to the device ass well - read on in the link I shared first above.

The reporting configuration is a standard Zigbee command. Normally when you add a device, some report configuration configuration is sent by ZHA, but if this configuration is not received by the device, it just stays as is because the initialisation commands are not repeated (unless you trigger reinitialize in HA’s UI).

So I guess that is what happened and you ended up with default device settings.
Normally those settings should remain velid until reconfigured or factory reset, but I can’t vouich for how they implemented it.

the magic spell shoul only be needed once, and typically until factory reset or sometimes when you add the device to the network again.

The fact that the spell works, means that a quirk is warrented for this device. Actually the devices ‘signature’ before and after the spell would best be known to apply the spell only once/when needed. You can share your experience in an issue on GitHub - zigpy/zha-device-handlers: ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices. .

It was finally a good idea to add the ‘tuya_magic’ command to the toolkit ;-).