How to set a Z-Wave energy meter to a specific value

Modified on Mon, 24 Aug at 1:25 PM

Overview

The Shelly Wave devices that have energy meters support setting the accumulated energy value to a specific number.

This can be useful after:

  • Replacing a device

  • Moving a device to another controller

  • Restoring a previous energy reading

  • Correcting an incorrect meter value

In Home Assistant, this can be done with the zwave_js.invoke_cc_api action. The action must target the energy entity of the required channel. This is especially important for multi-channel devices.


Requirements

Before using the action, confirm that:

  • The device supports Meter Command Class reset with a target value.

  • The device firmware is up to date.

  • The energy entity is available in Home Assistant.

  • The entity reports energy in kWh.

Not all Z-Wave devices support setting the meter to a specific value. Some devices only support resetting the meter to zero.


Single-channel device

For a single-channel device, target its energy entity:

action: zwave_js.invoke_cc_api target:  entity_id: sensor.your_device_energy data:  command_class: 50  method_name: reset  parameters:    - type: 1      scale: 0      rateType: 1      targetValue: 150

Replace:

sensor.your_device_energy

with the actual energy entity ID from Home Assistant.


Multi-channel device

A multi-channel device normally has a separate energy entity for each output. Devices Shelly Wave 2PM, Shelly Wave Pro 2PM, Shelly Wave Pro 2PM Dimmer, Shelly Wave Shutter, Shelly Wave Pro Shutter

To change the energy value of channel 1, target the energy entity assigned to channel 1:

action: zwave_js.invoke_cc_api target:  entity_id: sensor.your_device_channel_1_energy data:  command_class: 50  method_name: reset  parameters:    - type: 1      scale: 0      rateType: 1      targetValue: 150

To change the energy value of channel 2, target the energy entity assigned to channel 2:

action: zwave_js.invoke_cc_api target:  entity_id: sensor.your_device_channel_2_energy data:  command_class: 50  method_name: reset  parameters:    - type: 1      scale: 0      rateType: 1      targetValue: 450

Using the endpoint-specific entity is recommended because Home Assistant automatically sends the command to the Z-Wave endpoint linked to that entity.


Parameter explanation

The action uses the following parameters:

ParameterValueDescription
command_class50Z-Wave Meter Command Class
method_nameresetRuns the Meter Reset command
type1Electric meter
scale0Energy in kWh
rateType1Consumed energy
targetValueExample: 150The value sent to the device

In some cases, the following rate type may also work:

rateType: 0

This represents an unspecified rate type.

Use rateType: 1 first for consumed energy.


Changing both channels in one script

The two channels can be updated in the same Home Assistant script:

sequence:  - action: zwave_js.invoke_cc_api    target:      entity_id: sensor.your_device_channel_1_energy    data:      command_class: 50      method_name: reset      parameters:        - type: 1          scale: 0          rateType: 1          targetValue: 150   - delay:      seconds: 2   - action: zwave_js.invoke_cc_api    target:      entity_id: sensor.your_device_channel_2_energy    data:      command_class: 50      method_name: reset      parameters:        - type: 1          scale: 0          rateType: 1          targetValue: 450

The delay is optional, but it allows the first command to complete before the second command is sent.


How to find the correct entity

In Home Assistant:

  1. Open Settings.

  2. Select Devices & services.

  3. Open the Z-Wave integration.

  4. Select the required device.

  5. Find the energy entity with the unit kWh.

  6. For a multi-channel device, confirm which entity belongs to channel 1 and which belongs to channel 2.

The entity names may differ depending on the device and the names assigned in Home Assistant.


Troubleshooting

The action returns “Unknown error”

Confirm that the action targets an energy entity instead of the complete device.

Use:

target:  entity_id: sensor.your_device_channel_1_energy

Do not use the device ID when trying to address a specific channel.

The meter resets to zero

Confirm that all parameters are included:

parameters:  - type: 1    scale: 0    rateType: 1    targetValue: 150

If type, scale, or targetValue is missing, the device may receive a normal reset command instead of a reset with a specific value.

The device rejects the command

Update the device to the latest available firmware.

Older firmware versions may reject a valid Meter Reset command with a target value.

The wrong channel changes

Check that the selected entity belongs to the correct endpoint.

For example:

sensor.your_device_channel_1_energy

must be linked to endpoint 1, while:

sensor.your_device_channel_2_energy

must be linked to endpoint 2.


Important notes

  • Support depends on the device firmware.

  • Some devices only support resetting the meter to zero.

  • The command changes the meter value stored by the device.

  • Home Assistant statistics may take some time to reflect the new reading.

  • Existing long-term statistics are not automatically rewritten when the device meter value changes.