@xsherlock I don’t know what markus did, but in case you still need it I can tell you what I did in openhab2
Before I start:
I use only Habmin to find and include the z-wave devices as things and (and it’s important!) for setting the z-wave parameters. Then I use configuration files for everything else, but I do sometimes peek into PaperUI to see the exact channel name: battery level for instance is called “battery-level” and not “battery_level”, as one would expect.
1 – ensure your thing is discovered and so on.
2 – configure the Keyfob according to the documentation of its manufacturer. Get the manual from their website -> support -> manuals etc.
You have to check every parameter starting from the 3rd one – the first and the second I will mention at the end. Reading through the manual you can decide whether you want to use multiple button-press, press-and-hold and sequences of 2 – 5 buttons. You don’t have to use combinations and so on. You also don’t need to use associations, but you can - I will mention it at the end of this post.
3 - you need an item like this one:
Number key_fob "Keyfob" <contact> { channel="zwave:device:ZWAVE_DEVICE:NODE_ID:scene_number" }
And if you want, also one like this:
Number key_fob_batt "Keyfob battery" <battery> { channel="zwave:device:ZWAVE_DEVICE:NODE_ID:battery-level" }
4 - After you saved those items and assuming your parameters are all set well, you need to press the circle and the plus keys on your keyfob simultaneously. It will be confirmed by white light flashing a few times. It is supposed to wake the keyfob up and allow it to get the settings from openhab. You can check in events.log if the scenes are updated and they really should be. Sometimes it’s good to reload the Habmin to see all changes there.
5 - create a keyfob.rules file according to this example:
rule "keyfob in use"
when
Item key_fob received update
then
if (key_fob.state == 1.0) { // KeyFob square pressed once
}
if (key_fob.state == 1.1) { // KeyFob square released
}
if (key_fob.state == 1.2) { // KeyFob square hold
}
if (key_fob.state == 1.3) { // KeyFob square pressed twice
}
if (key_fob.state == 1.4) { // KeyFob square pressed 3 times
}
( repeat for each button i.e. 2.0, 2.1, 2.2, 2.3, 2.4, 3.0 etc. up to 6.4 )
if (key_fob.state == 7.0) { // First sequence defined in parameters
}
if (key_fob.state == 8.0) { // Second sequence defined in parameters
}
( repeat for all six sequences up to 12.0 )
end
And that should do it. You don’t need to use associations - it will work fine without it.
However you can also set associations in habmin according to you needs. I for instance use three buttons for three different dimmers, so I had to set the multilevel association. Markus used the on/off association if I’m not mistaken. You can set only for the buttons you need and let others not associated - it’s fine and it’s all up to you.
However, if you set any you should rather not use the respective scene number in the .rules file.
It is all working well including associations, multi-press and combinations.
There is a dark side as well. Without the working lock function the keyfob has a very, very limited utility. You literally cannot put it in the pocket: there is no way you don’t push the buttons accidentally.
According to Fibaro documentation for the lock to be set you need to:
- set the unlocking sequence in parameter 1
- set the lock timeout and lock button in parameter 2
- send a PROTECTION class from the controller to the keyfob.
Sadly the last one seems not to be available in openhab…