# Z-Wave app: can't get power metering to work

**URL:** <https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485>\
**Category:** Developers\
**Tags:** app, z-wave, homey-pro\
**Created:** [September 29, 2023, 5:07am UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485 "2023-09-29T05:07:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![probablyjd](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/probablyjd/32/78856_2.png) [@probablyjd](https://community.homey.app/u/probablyjd)\
**Post date:** [September 29, 2023, 5:07am UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/1 "2023-09-29T05:07:10Z")

</div>

_ **Update** _  
Adding this update a few months later in case it is helpful to those finding this in the future. Athom has improved the functionality of their built-in generic Z-Wave driver so that it now allows the use of both power and energy metering, and this is working great with my Zooz Zen15 switches. Even advanced flow triggers like detecting power changes instantly are working. I hope this means they have fixed the underlying issues I was having while trying to create my own app, but it also eliminates the need for me to create an app at all, so I won’t be trying to fix it. Thanks Athom!

_ **Original post below** _

Hi Homeys,

(I have no idea if that’s how Homey fans refer to each other but I really hope so)

I am attempting to write an app to connect some of my Zooz Z-Wave devices to my Homey Pro (2023). There is not yet an official Zooz app yet, so I am happy to publish this app for others to use once it’s working (or add my drivers to another Zooz community app like the one by @Johan_Rossouw ), but have run into some difficulties.

The device I am trying to integrate first is the Zooz Zen15 Power Switch. This is a basic Z-Wave smart plug and the on-off function does actually work with the built-in generic driver, but I would like to enable energy metering and power-based flow triggering, of which the device should be capable. I have been able to get the device connected and on-off and energy metering functionality working, but can’t get the power metering to work.

It looks like it should be pretty simple - Athom provides easy-to-use abstractions for all the ZWave command classes. I used the Homey CLI to create a new Homey app and a new Z-Wave driver. I made a couple basic changes like updating the manufacturer and product IDs, and added a few lines of code to register the capabilities of the device following the model of several examples ([here’s one for a Fibaro switch](https://github.com/athombv/com.fibaro-example/blob/771862b4c5c235613a8166c5be71a44759178a3d/drivers/FGWPx-102-PLUS/device.js#L9)).

I also verified the advanced settings with the Zooz manual and they all seem identical to the default settings in Athom’s template.

The Homey app recognizes the capabilities claimed by the device driver and the energy metering seems to work, but no number is reported for power. The only hint I can find for why this might be is an error on the console output:

```auto
2023-09-29T03:42:34.278Z [err] [ManagerDrivers] [Driver:zen15-power-switch] [Device:4daffcc8-83db-4758-8c57-c1d70ccf20f5] CommandClass: SENSOR_MULTILEVEL in main node undefined

```

But I have no idea why SENSOR\_MULTILEVEL would be undefined, if it works in all the examples and the other command classes seem to work fine. Anyone have any ideas on what I might be doing wrong here? Has anyone else gotten power metering to work in a custom app?

[Here is my device.js file](https://github.com/probablyjd/zooz.unofficial/blob/main/drivers/zen15-power-switch/device.js) in case that is helpful to see.

Thanks,  
JD

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [September 29, 2023, 1:49pm UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/2 "2023-09-29T13:49:24Z")

</div>

Hi,

Not possible yet. You’d make a request @ Athom support I guess.

> Known issues:  
> Energy measuring for Shelly Wave 1PM/2PM not implemented. The library that Athom maintains for including Zwave devices has not been updated for a while and currently does not support Zwave command class METER V6. Therefor energy capabilities of the Shelly Wave 1PM/2PM have nog been implemented yet

.  
Source (ignore the first sentence 😜 ):

> [@\[APP\]\[Pro&Cloud\] Shelly](https://community.homey.app/t/app-pro-cloud-shelly/765/4204):
>
> And did you bother to find the answer yourself? The answer is already in the first post. And if it switches only sometimes it’s an issue with Homey’s Zwave. Not for me to fix as well. Known issues Energy measuring for Shelly Wave 1PM/2PM not implemented. The library that Athom maintains for including Zwave devices has not been updated for a while and currently does not support Zwave command class METER V6. Therefor energy capabilities of the Shelly Wave 1PM/2PM have nog been implemented yet.

---

<div class="post-metadata">

**Author:** ![probablyjd](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/probablyjd/32/78856_2.png) [@probablyjd](https://community.homey.app/u/probablyjd)\
**Post date:** [September 29, 2023, 2:22pm UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/3 "2023-09-29T14:22:52Z")

</div>

Thanks for the response! That is disappointing if that is really the cause - I assumed the problem is my code and not Athom lacking fundamental Z-Wave functionality.

Would that mean that there are NO Z-Wave smart plugs that can do power measuring, since they all (presumably) rely on the same ZWave libraries?

---

<div class="post-metadata">

**Author:** ![wayupnorthguy](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wayupnorthguy/32/82880_2.png) [@wayupnorthguy](https://community.homey.app/u/wayupnorthguy)\
**Post date:** [September 29, 2023, 4:06pm UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/4 "2023-09-29T16:06:25Z")

</div>

The Coolcam smart plugs do report.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/c/fc361a2e6295ceccb89ad5d4d17a7c3faa352256.png)

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/6/06cb7b45532724c720db2852f27351a9d3a47318.png)

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [September 29, 2023, 5:45pm UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/5 "2023-09-29T17:45:51Z")

</div>

Energy meter does not work with Athoms zwave driver for command class METER V6. Since the topic starter is a able to get power metering which probably uses the METER command class as well it’s not using V6. So this is not the reason he can not get it to work and is not the same as with the Shelly Qubino Wave devices.

---

<div class="post-metadata">

**Author:** ![probablyjd](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/probablyjd/32/78856_2.png) [@probablyjd](https://community.homey.app/u/probablyjd)\
**Post date:** [September 29, 2023, 7:06pm UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/6 "2023-09-29T19:06:51Z")

</div>

Thanks @wayupnorthguy for the example, and @Phuturist for the correction!

You are correct that I am using the METER command class, which actually seems to work for energy metering (can’t guarantee there aren’t errors but it is at least reporting a number and that number changes if I attach a load). For the Power metering (i.e. instantaneous power draw rather than cumulative) I am using the SENSOR\_MULTILEVEL command class, which is the one that seems to cause problems. I am new to both Homey and Z-Wave programming, so I chose that based purely on example code - I will take some time this weekend to dig into the documentation and better understand the different command classes and how homey-zwavedriver implements them. Below is the relevant section of code - only the second registerCapability seems to have the error:

```auto
const { ZwaveDevice } = require('homey-zwavedriver');

class Zen15 extends ZwaveDevice {

  /**
   * onNodeInit is called when the device is initialized.
   */
  async onNodeInit() {
    this.log('Zooz Zen15 Power Switch has been initialized');

    this.registerCapability('onoff', 'SWITCH_BINARY');
    this.registerCapability('measure_power', 'SENSOR_MULTILEVEL');
    this.registerCapability('meter_power', 'METER');
  }

```

@Phuturist, since it seems like you have some experience with integrating zwave devices into Homey - have you successfully used the SENSOR\_MULTILEVEL command class on any of your projects?

---

<div class="post-metadata">

**Author:** ![Phuturist](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/phuturist/32/49_2.png) [@Phuturist](https://community.homey.app/u/Phuturist)\
**Post date:** [September 29, 2023, 9:35pm UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/7 "2023-09-29T21:35:40Z")

</div>

> [@probablyjd](#):
>
> since it seems like you have some experience with integrating zwave devices into Homey

Sorry to disappoint you but I have next to zero experience myself. Recently added my first zwave devices only to find out that the Athom library for doing so is outdated and they don’t think it’s important enough to stay up to date. Go figure the issues they are having in trying to create a stable platform.

---

<div class="post-metadata">

**Author:** ![probablyjd](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/probablyjd/32/78856_2.png) [@probablyjd](https://community.homey.app/u/probablyjd)\
**Post date:** [September 30, 2023, 3:10am UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/8 "2023-09-30T03:10:51Z")

</div>

Ha, fair enough. Well thanks for the help anyway!

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [November 11, 2023, 10:35am UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/9 "2023-11-11T10:35:22Z")

</div>

You may already know, but I would like to point out that in the latest experimental firmware the “Command Class Meter V6” for Z-Wave devices has been added.

> **[Homey Pro (Early 2023) Changelog](https://homey.app/en-us/wiki/homey-pro-early-2023-firmware-changelog/)**

---

<div class="post-metadata">

**Author:** ![probablyjd](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/probablyjd/32/78856_2.png) [@probablyjd](https://community.homey.app/u/probablyjd)\
**Post date:** [November 12, 2023, 6:18am UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/10 "2023-11-12T06:18:45Z")

</div>

Thanks for the heads up! I did not know that it had been integrated - after sinking several more hours into this and not getting it to work I eventually gave up. Maybe now I should give it another go.

I just noticed another note in the changelog for v10.1.0-rc.2:

> Adds power measurement capabilities to unknown Z-Wave devices (if supported by the device).

So it’s possible this functionality might now work without a custom driver at all! I’m out of town for the next few weeks but I’ll play around with this in December and report back.

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [November 12, 2023, 10:06am UTC](https://community.homey.app/t/z-wave-app-cant-get-power-metering-to-work/90485/11 "2023-11-12T10:06:54Z")

</div>

> [@probablyjd](#):
>
> So it’s possible this functionality might now work without a custom driver at all!

👍🏻
