How do I send a custom Z-Wave command to device through the API?

  • Platform information:
    • Hardware: armv7l
    • OS: openHABian 4.19.118-v7l+
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 2.5.6

Hello,
I’m new to openHAB. I added a Z-wave dongle and a Yale YRD110 lock.

I’m trying to figure out how to send a custom Z-Wave command which is not exposed as a channel to read the battery level (COMMAND_CLASS_BATTERY) through the API.

https://www.openhab.org/v2.4/addons/bindings/zwave/thing.html?manufacturer=yale&file=yrd110_0_0.html

The lock supports Battery CC per ZWave specifications V9. It is recommended that the network controller use this CC to retrieve the lock’s battery level at least once daily. The lock will send low battery alarms if low battery condition exists immediately after user access.

Help is much appreciated.

Adrian, welcome to the community :slight_smile:

I don’t think it is advisable to use low level communication to directly interact with the device. @chris as the maintainer surely can shed more light onto that idea.
From what I know I would advise to follow the instructions
here to add the necessary functionality by amending the thing definition in order to use standard mechanisms for interacting with the device.

2 Likes

It’s not possible to send custom commands.

If all you want to do is to read the battery, then the device should provide a battery channel, and this should be updated automatically. You should not need to do anything “custom” to do this sort of thing.

1 Like

Looking at the database, apparently that lock does not expose the BATTERY Command Class.

Figured out. Filed https://github.com/openhab/org.openhab.binding.zwave/issues/1350
Thank you!

The specifications are not just for that particular model of lock. If the device does not expose the command class, there is nothing the binding can do.

The device needs to expose COMMAND_CLASS_BATTERY in its Node Information Frame when requested. It may be a bug with that model of lock. but not with the binding.

How can I see Node Information Frame? Can I get that from the API?

That information should be in the xml file in the userdata zwave dorectory. That is a Z-Wave entity, not openHAB

The binding asks the device for it’s NIF as part of Z-Wave discovery.

The lock definitely supports COMMAND_CLASS_BATTERY because I’m able to read the battery level with other platforms.

I guess this is just an error in the database. Again though, you don’t need to worry about custom commands.

2 Likes

Is it possible to replace the device type with yrd120_0_0.xml? And how? I may be able to test with that.

:confused: Why. Don’t you have a yrd110?

Anyway, the answer is no, you can’t easily change the device type. You could mess around with the internals of OH, but that’s just asking for trouble. We just solved the database issue so it will not be an issue for the yrd110.

1 Like

Thanks, that was fast! I could use a pointer on how to update the device database now.

The database guide is here -:

https://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-database-guide

I see it was already posted above by @stefan.oh

2 Likes

I believe @chris already updated the database.

What version of OH are you running? You referred to the 2.4 docs for your device.

If running 2.5 or later you can update to the latest snapshot sometime after the weekly database export.

1 Like

I’m running 2.5.6

1 Like

@chris I hate to be annoying, but I can’t find where COMMAND_CLASS_BATTERY was added to yrd110_0_0.xml in the device database.

The device database entry is here -:

https://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devicesummary/302

1 Like