# Get device battery level (zwave)

**URL:** <https://discourse.nodered.org/t/get-device-battery-level-zwave/14273>\
**Category:** General\
**Created:** [13 August 2019 11:00 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273 "2019-08-13T11:00:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [13 August 2019 11:00 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/1 "2019-08-13T11:00:14Z")

</div>

I would like to get the battery level of my zwave device weekly. But I couldn't find the exact command for this.

Here the JSON:

```auto
{
	"topic":"???",
	"payload": {
		"nodeid":4,
		"cmdclass":128
	}
}

```

which topic I have to use? I didn't found in OpenZWave::Manager...  
cmdclass "128" = COMMAND\_CLASS\_BATTERY

Maybe anyone got the solution for this.  
thx.

---

<div class="post-metadata">

**Author:** ![Francky](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@Francky](https://discourse.nodered.org/u/Francky)\
**Post date:** [11 September 2019 10:49 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/2 "2019-09-11T10:49:21Z")

</div>

Hello,

just send a command like this one

{  
"topic":"refreshValue",  
"payload": {"arg":[4,128,1,0]}  
}  
with :  
4 : nodeId  
128 : cmdclass (COMMAND\_CLASS\_BATTERY)  
1 : instance number (usualy good but please check the value in zwcfg\_xxx.xml)  
0 : index value (usualy good but please check the value in zwcfg\_xxx.xmll)

don't forget that the zw controler will send the command on next device wakeup !

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [15 September 2019 18:32 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/3 "2019-09-15T18:32:51Z")

</div>

Thanks for your input, @Francky.  
But I don't receive any feedback.

---

<div class="post-metadata">

**Author:** ![Francky](https://avatars.discourse-cdn.com/v4/letter/f/a8b319/32.png) [@Francky](https://discourse.nodered.org/u/Francky)\
**Post date:** [17 September 2019 10:37 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/4 "2019-09-17T10:37:05Z")

</div>

the device will send the value at it's next wakeup.  
This may take fews minutes, or hours, depend on it's wakeup interval... Just wait 🙂

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [19 September 2019 19:30 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/5 "2019-09-19T19:30:40Z")

</div>

🙃  
Sure, I'm still waiting. 😉

In node-red-log, there are no failure oder any other infos. Is there another log I can check?

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [20 September 2019 08:34 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/6 "2019-09-20T08:34:15Z")

</div>

Add a `switch` and a `debug` node to the zwave-in node.  
 ![zwave](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/038ee17ed928e8ab28468b00059553bce3b0be88.png)

You should get a msg like this:

```auto
{
	"nodeid": 4,
	"notification": 3,
	"help": "Notification - Node Awake",
	"uuid": "xxxx"
}

```

In my case I get the message every 6 hours (Wake-up Interval = 21600).

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [20 September 2019 10:53 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/7 "2019-09-20T10:53:11Z")

</div>

Z-Wave messages already come in (temperature, motion detection, illumination, tamper, node Awake ...).

Only the battery level is not reported. I want to trigger the battery level weekly with a Z-Wave out message. But it didn't work.

JSON (with inject node)

```auto
{
"topic":"refreshValue",
"payload": {"arg":[4,128,1,0]}
}

```

I also tried with a function-node - same result.

I use: RazBerry with Fibaro Motion Sensor

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [20 September 2019 15:02 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/8 "2019-09-20T15:02:20Z")

</div>

`node-red-contrib-openzwave` version?

`Fibaro Motion Sensor` type? (e.g. FGMS001)

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [20 September 2019 15:59 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/9 "2019-09-20T15:59:16Z")

</div>

node-red-contrib-openzwave 1.2.4  
Fibaro Motion Sensor FIBEFGMS-001-ZW5

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [20 September 2019 16:04 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/10 "2019-09-20T16:04:21Z")

</div>

Search in your `zwcfg_xxx.xml` file after `<Node id="4" ...` for:

```auto
<CommandClass id="128" name="COMMAND_CLASS_BATTERY" version="1" request_flags="4" innif="true">

```

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [20 September 2019 16:56 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/11 "2019-09-20T16:56:37Z")

</div>

I didn't find this file.  
What's the path?

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [20 September 2019 16:59 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/12 "2019-09-20T16:59:24Z")

</div>

> [@Qaldak](#):
>
> What's the path?

It should be in your node-red path, on a rpi `.node-red`  
xxx = homeid

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [22 September 2019 11:58 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/13 "2019-09-22T11:58:29Z")

</div>

There is no `zwcfg_xxx.xml` file, but `ozwcache_xxx.xml`

In ozwcache\_xxx.xml is command class 128:

```auto
<CommandClass id="128" name="COMMAND_CLASS_BATTERY">
	<Compatibility />
	<State>
		<InNif>true</InNif>
		<StaticRequests>4</StaticRequests>
	</State>
	<Instance index="1" />
	<Value type="byte" genre="user" instance="1" index="0" label="Battery Level" units="%" read_only="true" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="88">
		<Help>Current Battery Level</Help>
	</Value>
</CommandClass>

```

---

<div class="post-metadata">

**Author:** ![cflurin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cflurin/32/29_2.png) [@cflurin](https://discourse.nodered.org/u/cflurin)\
**Post date:** [22 September 2019 12:56 UTC](https://discourse.nodered.org/t/get-device-battery-level-zwave/14273/14 "2019-09-22T12:56:33Z")

</div>

> [@Qaldak](#):
>
> There is no `zwcfg_xxx.xml` file, but `ozwcache_xxx.xml`

Strange! see source `10-zwave.js`:

```auto
this.on("close", function() {
      log('full', 'zwave-controller: close');
      // write out zwcfg_homeid.xml to disk
      ozwDriver.writeConfig();

```

I would ask the author.
