[QUESTION] resetEnergyMeter() SmartThings native method, what does it do?

Heya all,

In the IDE simulator while testing outlets, I stumbled upon the method resetEnergyMeter() in the simulator itself.

Does anyone know what exactly it does internally? is it zigbee only?

I’m asking to see if it could be used to do exactly what it suggests it does with outlets that sometimes they do not reset the consumption and it needs to be re-set first.

Thanks!

Hi, @chares!
This command belongs to the EnergyMeter capability.

{
    "id": "energyMeter",
    "version": 1,
    "status": "live",
    "name": "Energy Meter",
    "attributes": {
        "energy": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "number"
                    },
                    "unit": {
                        "type": "string",
                        "enum": [
                            "Wh",
                            "kWh",
                            "mWh",
                            "kVAh"
                        ],
                        "default": "kWh"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "enumCommands": []
        }
    },
    "commands": {
        "resetEnergyMeter": {
            "arguments": []
        }
    }
}

So, any device that uses this capability, would have access to the command resetEnergyMeter. It depends on the device handler (if it has this command included) the actions it performs.
In my DTH, I reset the energy value to zero:

def resetEnergyMeter(){
 log.debug "Energy reset"
 sendEvent(name: "energy", value: "0", unit:"kWh")
}

This is a sample of how I trigger it using Postman:

1 Like

Hi @nayelyz! as always, thanks! :smiley:

Interesting, I never noticed that the capabilities themselves have available commands, thats a useful one :slight_smile:

So even if the command is there (a ‘native’ method), it doesn’t do anything unless you tell it to do something, (much like the on/off of the switch, but for some weird reason on/off do not like log.* commands :woozy_face:).

Meaning by default doing a resetEnergyMeter() call, will not do anything, unless defined as your example, if I understood right?

Thanks!

Yeah, you’re right. :ok_hand:
Anytime, @Chares.

1 Like