Blueprint to reset energy counter TS011F in ZHA

There are good reasons to reset the energy statistics of the Tuya TS011F smart plug.

To be able to do this easily, I have created this blueprint:

blueprint:
  #source_url: https://...

  name: ZHA -  Tuya TS011F reset 
  description: >-
    Reset Tuya TS011F Smartplug+Energy meter. 

  domain: script

  input:
    device:
      name: Device
      description: Tuya plug and energy meter
      selector:
        device:
          integration: zha
          model: TS011F
                  
mode: restart

variables:
  var_device: !input device
  ieee: "{{ (device_attr(var_device, 'identifiers')|list).0.1 }}"  

sequence:
  - service: zha.issue_zigbee_cluster_command
    data:
      ieee: "{{ ieee }}"
      endpoint_id: 1
      cluster_id: 0x0000
      cluster_type: in
      command: 0x000
      args: []
      command_type: server
3 Likes

i bought the same powerplug.
so which counter does it actually reset? is it summation delivered?
I imported the blueprint and it created a script. I configured it to use the power plug i want to reset, but it doesnt seem to do anything?
Cheers

Thanks! Worked fine…

i ran it and it didnt give me any error or any change.

Which counter or sensor does it reset? is it summation delivered?

Hm…

  1. I created a script using the blueprint (you have to chose the device before saving the script)
  2. Start the script (you find it in the scripts section. I created several scripts…deleted all of them to ensure to have the only right script left behind)
  3. The summation delivered value changed to 0. That’s all…

It worked like a charm. Thanks a lot!

I am a newbee on HA and wonder how I can import this Blueprint.
Normally there is a URL link available that can be used or copied and paste to import.
Do I have to select the complete code shown in the beginning, but then…?
Appreciate any help!

I used the URL of this (HA community) page.
Blueprint Import was able to pick up the blueprint YAML from that.

Thanks for your tip! Managed to import the Blueprint.
Selected the device to be reset and saved the blueprint under new name.
Going to Automations and selecting the Script tab, I click the three dots and click Run.
No reset of sum power usage counter was done though, am I doing something wrong?

Sounds exactly like what I did, and it worked for me.

What Coordinator are you using?
I have the SONOFF Zigbee 3.0 USB Dongle Plus V2

I am using the Conbee II usb dongle as my coordinator.

im experiencing the same as Fred54, i am using sonoff zigbee 3.0 USB dongle Plus v2 as well.
It does not reset the counter

image

Here is the script config.

mode: restart
variables:
  var_device: e6810e68b4978eade3264a9afce35b86
  ieee: '{{ (device_attr(var_device, ''identifiers'')|list).0.1 }}'
sequence:
  - service: zha.issue_zigbee_cluster_command
    data:
      ieee: '{{ ieee }}'
      endpoint_id: 1
      cluster_id: 0
      cluster_type: in
      command: 0
      args: []
      command_type: server
alias: ZHA -  Tuya TS011F reset
icon: mdi:fridge

let me know if you need any more info. thanks

Unfortunately the same for me, imported the Blueprint and ran the script but no change.

The log shows a error, but related to deprecated commands:

Logger: homeassistant.components.zha.core.device
Source: components/zha/core/device.py:1010
integration: Zigbee Home Automation (documentation, issues)
First occurred: 5:45:55 PM (5 occurrences)
Last logged: 5:49:14 PM

[0xF30A](TS011F): args [[]] are deprecated and should be passed with the params key. The parameter names are: []

Looking in the Zigbee attributes I can see the value but writing a new value of “0” doesn’t seem to work either, but that was just a stab in the dark

1 Like

i tried what you have done, yep same result no change.