Z-Wave JS - how to reset accumulated values

Hi,

The new Z-Wave JS has exposed some new interesting configuration options and actions I was unaware of, namely the possibility to reset the kWh counters on some of my devices, such as the Aeotec ZW116 for example.

On the new control panel we even got this very nice and simple button in the UI to achieve the reset:

My question to you all is very simple: How can we achieve the same reset via HASS Core?
Is there a service, or any other method to invoke this reset from an automation for example?

TIA,
-jprates

5 Likes

I too would like to do this - ideally via an automation so it can be reset at the end of a set period (day / week etc.)

The set_value service added in 2021.4 can achieve this.

1 Like

Thanks @freshcoast - that looks like it should do the job. All I need to do now is to formulate my automation Action to set the accumulated kWh values for Total and for each phase. Are you able to help me with this?
When I run the reset for the Total using the ZWaveJS2MQTT control panel, looking in my log for Z-Wave JS I can see the following:

  { nodeId: 2, commandClass: 50, endpoint: 0, property: 'reset' },
  true,
  [length]: 2
]

This seems to have the Service Data Attributes required but (forgive me for being a bit of a noob) I am not sure how to create an automation with this data in the action.
I have tried creating an automation in the following style:

alias: Reset Energy Meter Total
description: ''
trigger:
  - platform: event
    event_type: ''
condition: []
action:
  - service: zwave_js.set_config_parameter
    data:
      device_id: '2-50-0-value-65537' # or maybe this should be entity ID 'sensor.home_energy_meter_gen_5_electric_consumed_kwh' or maybe just the node_id 2 ??
      value: '0'
      command_class: '50'
      property: 'reset'
mode: single

But so far cannot get this automation to work!
Any help would be greatly appreciated (and I will feed back to the guys at Aeotec so they can help others with this issue)

  1. You’re using the wrong service, it’s set_value not set_config_parameter
  2. The device_id is incorrect, either select it from the GUI in a service call, then switch to YAML mode to see the id, or just use entity_id and give it any entity from the meter. node id is not supported.
  3. value should be true, not 0, as you’ve shown from z2m.
  4. command_class should be a number 50, not a string '50'.
1 Like

Fantastic
That works perfectly
So to reset my Total kWh entity at 1 second before midnight each night, here is my automation (for anyone else using a three phase Aeotec HEM with Z-Wave JS 2 MQTT):

alias: Reset Energy Meter Total
description: ''
trigger:
  - platform: time
    at: '23:59:59'
condition: []
action:
  - service: zwave_js.set_value
    data:
      value: true
      command_class: 50
      property: 'reset'
    target:
      entity_id: sensor.home_energy_meter_gen_5_electric_consumed_w
mode: single

Thank you for your help in sorting this out!

Hello,
I like to do the same with a POPP Smart Outdoor Plug.
From the developer tools menu:

Service: Z-Wave JS: Set a value on a Z-Wave device (Advanced)
Entity: sensor.popp_smart_outdoor_plug_ip44_rated_electric_consumed_kwh
Command class: ?
End point: ?
Property: ?
property key:?
value:?

How do I find these values?

Also can I use the ZWaveJS2MQTT in parallell with the z-Wave JS or do I need ti swith? - the control panel is what I am after…
Thanks in advance…

I think you need to use Z-Wave JS 2 MQTT on its own.
This has a web Gui with lists of reported values coming from the connected nodes.
In Supervisor, click on the Z-Wave 2 MQTT add-on and the click on web gui. In the web gui for the Aeotec HEM (home energy monitor) I can see under the meter section all of the values being reported. In the configuration section I can enter configuration parameter values - these can be obtained from the manufacturer of your device.
It took me a while to understand what the parameter values should be as Aeotec do not use exactly the same naming terminology as is used in Home Assistant, but after scratching my head for a while, I could work out what was required.
Hope this helps

Hello and thank you!
Yes it helps (I think). I will need to install the Z-Wave 2 MQTT. I will try that path!
I am now using z-wave JS so I have to find a migration procedure somewhere… perhaps someone knows?
Again thanks!

I’m a home assistant noob, fumbling my way through things. So in case anyone else lands here from Google searching, I wanted to confirm it’s possible to use zwave_js.set_value to reset kWh reading on an Aeotec Smart Switch 7, model ZWA023-A or ZWA023, a Z-wave smart plug.

It was surprisingly difficult for me to find this stuff. Some of the terms I tried searching for:

  • energy meter reset
  • power consumption reset
  • electric consumption reset
  • energy consumption reset
  • power meter reset

Anyway, this is the meat of the script that can be used to reset the power consumption.

script:
  reset_aeotec_plug_1_kwh:
    alias: "Reset the kWh consumption for Aeotec 1"
    description: "This should work."
    sequence:
      - service: zwave_js.set_value
        data:
          command_class: '50'
          property: reset
          value: true
        target:
          #device_id: xxxx 
          entity_id: sensor.aeotec_plug_1_electric_consumption_kwh

Any Z-Wave device that supports METER Z-Wave command class (with kWh, Watt, Voltage, Current) also supports the same specific commands for Meter RESET.

The above script references the target by entity_id. Alternatively, you could reference the target by device_id. To get the device_id of your zwave device, you can grab it from the zwave_js_dump.json file (how-to).

Also, to save anyone else the time - my initial approach was to try zwave_js.set_config_parameter. This approach won’t work for my specific Aeotec device because the parameter/property is read-only. No way to write/change it manually.

Creating the zwave_js dump file can shine some light on what command_class, device_id, endpoint, node_id, etc, to use if you need that information. The following excerpt shows what the zwave_js dump looks like for the specific power consumption property. If you go up 1 level above this in the dump, you’ll also get the node_id and device_id.

              {
                "endpoint": 0,
                "commandClass": 50,
                "commandClassName": "Meter",
                "property": "value",
                "propertyKey": 65537,
                "propertyName": "value",
                "propertyKeyName": "Electric_kWh_Consumed",
                "ccVersion": 5,
                "metadata": {
                  "type": "number",
                  "readable": true,
                  "writeable": false,
                  "label": "Electric Consumption [kWh]",
                  "ccSpecific": {
                    "meterType": 1,
                    "rateType": 1,
                    "scale": 0
                  },
                  "unit": "kWh"
                },
                "value": 0.039
              },

Have you tried the reset_meter service?

1 Like

I’m testing this service in Node Red tonight:

It’s for an AEON HEM gen 2 connected by z-wave js ui.

Success!

The accumulated values were reset at midnight.