How to use the Fibaro Keyfob and to manage challenges around it

One of the problems is that the keyfob only sends events when the item state changes.

This would mean to switch on/off a lamp you would have to use two buttons because each of the button is linked to a different number. Hence, only when you click two different buttons a change event is sent as the state changes from 1.0 to 2.0 or from 2.0 to 1.0. If you press the same button twice you won’t receive any event in the rule (1.0 to 1.0 is not a change).

The following rule would therefore only work if you pressed a different button in between

rule "remote" 
when
    // Selection_Keyfob is the item that receives the id of the button
    Item Selection_Keyfob changed
then
  logInfo("remote","State {}",Selection_Keyfob.state)
  if (Selection_Keyfob.state == 1.0) {
    if(Power_Plug_Socket_1.state == OFF)
      sendCommand(Power_Plug_Socket_1, ON)
    else
     sendCommand(Power_Plug_Socket_1, OFF)
  }

  Selection_Keyfob.postUpdate(0)
end

The simple trick is to add the following line to the end of the rule (before the end) as it forces the state in openhab back to 0.

Selection_Keyfob.postUpdate(0)

This sets back the state and the next button click on the keyfob is detected as a change (1.0 to 0, 0 to 1.0…).

Hope that helps someone like me some buttons…

1 Like

Use item xxx received update and you will receive all events. Even repetitive same button events.

1 Like

Thanks, Ole,

Dummy me (I have read all that stuff but just forgotten - probably my age ;-))

Sure that is of course also possible and the much better solution!

cheers and thanks again
Stefan

It was just yesterday I brought back my first Fibaro Keyfob and I love it.

I have a few other Z-Wave scene controllers and this is my rule template . (This one for the KeyFob)

.items:

Number KeyFob1                    (div, remotes)         { channel = "zwave:device:f180343d:node74:scene_number" }
Number KeyFobBatt1                (div, remotes)         { channel = "zwave:device:f180343d:node74:battery-level" }

.rule:

var String drState


rule "KeyFob1" 
when
        Item KeyFob1 received update
then 
    var swState = KeyFob1.state
    var name = "KeyFob1Rule" 
    logInfo(name, "Update: " + swState)

    
    switch swState {
        case 1.0: {logInfo(name, "Square1xClick") 
        }
        case 1.3: {logInfo(name, "Square2xClick") 
        }
        case 1.4: {logInfo(name, "Square3xClick") 
        }
        case 1.2: {logInfo(name, "SquareHoldDown")
        }
        case 1.1: {logInfo(name, "SquareRelease")
        }
        case 2.0: {logInfo(name, "O1xClick") 
            if (BulbStairsState.state == ON) {
                trumpetLights.sendCommand(OFF)
                BulbStairsState.sendCommand(OFF)
                drState = AllDR.state.toString   // save current state
                AllDR.postUpdate(OFF)            // dining room group OFF
            } else {
                trumpetLights.sendCommand(ON)
                BulbStairsState.sendCommand(ON)
                AllDR.postUpdate(drState)
            }
        }
        case 2.3: {logInfo(name, "O2xClick") 
        }
        case 2.4: {logInfo(name, "O3xClick") 
        }
        case 2.2: {logInfo(name, "OHoldDown")
        }
        case 2.1: {logInfo(name, "ORelease")
        }
        case 3.0: {logInfo(name, "X1xClick") 
            KodiHarmonyCmd.sendCommand("Esc")
        }
        case 3.3: {logInfo(name, "X2xClick") 
        }
        case 3.4: {logInfo(name, "X3xClick") 
        }
        case 3.2: {logInfo(name, "XHoldDown")
            KodiHarmonyCmd.sendCommand("Stop")
        }
        case 3.1: {logInfo(name, "XRelease")
        }
        case 4.0: {logInfo(name, "Triangle1xClick") 
        }
        case 4.3: {logInfo(name, "Triangle2xClick") 
        }
        case 4.4: {logInfo(name, "Triangle3xClick") 
        }
        case 4.2: {logInfo(name, "TriangleHoldDown")
        }
        case 4.1: {logInfo(name, "TriangleRelease")
        }
        case 5.0: {logInfo(name, "-1xClick") 
            OnkyoHarmonyCmd.sendCommand("VolumeDown")
        }
        case 5.3: {logInfo(name, "-2xClick") 
        }
        case 5.4: {logInfo(name, "-3xClick") 
        }
        case 5.2: {logInfo(name, "-HoldDown")
            OnkyoHarmonyCmd.sendCommand("Mute")
        }
        case 5.1: {logInfo(name, "-Release")
        }
        case 6.0: {logInfo(name, "+1xClick") 
            OnkyoHarmonyCmd.sendCommand("VolumeUp")
        }
        case 6.3: {logInfo(name, "+2xClick") 
        }
        case 6.4: {logInfo(name, "+3xClick") 
        }
        case 6.2: {logInfo(name, "+HoldDown")
        }
        case 6.1: {logInfo(name, "+Release")
        }
    }                
end
1 Like

Wow, that’s fantastic, Ole!
Thanks for providing that.

You obviously could solve a different challenge I have and that I don’t understand by reading the manual.

  • What exactly did you did to configure double clicks and triple clicks in the thing configuration?

  • Did you have to do some “learning” on the device by clicking sequences?

  • How do you assign to the different numbers

    • for example 1.3 for the Square-Double Click,
    • the 1.4 for the Square 3xClick
    • and the 1.1 for the Square-Release?

(these example will most probably lead me the way for the others).

Thanks in advance,
Stefan

Glad to share, as I did it only this morning :slight_smile:
In HABmin, open up:

Scroll down to this section and replace all '9’s with '15’s (setting all 4 bits)

After hitting Save, you fairly quickly need to simultaneously press the - and O on the KeyFob.
You should get a white light. (if not cycle through with X until you do)
While the white light is on, press + to confirm wake-up. New settings should be transferred.
I had to try twice to get it to work.
Full manual here

Note: 1xclick, holdDown & release are defaults, assuring very quick 1x response.
Enabling 2xclick and/or 3xclick introduces a delayed 1xclick response (obviously :slight_smile: )

Edit: I have not played around with the sequences yet …

Good luck!

Hi Ole,

this thing drives me crazy. The reason it took me so long to get back to you since you wrote is that I am “working” "on it.

The point is

  • When I saved the parameters 15 the keyfob did not send any events anymore at all.
  • Because I thought I had maybe pressed something wrong (even un unintential exclusion of the device), I looked at the network viewer and from then my node24 was red.
  • Finally I decided to exclude it from the network
  • I then tried (for almost) an hour to reinclude it again but when press + for inclusion, even though the device’s battery is out, the node24 reappears in openhab.
  • I deleted the node, it comes back.
  • Finally I decided to do an exclusion with the mechanism described in the manual and that at least excluded the hardware. (however, whatever I do the node24 always reappears, even if I delete the cache from openhab and restart openhab)
  • I resetted the device to factory defaults
  • I then did an inclusion again and it detects the device as a new node but it shows up as “not in the database”
  • and I tried and tried again… it took me ages to find out that after the device gets found unrecognized in the database, I then have to wait quite some minutes, then delete it through habmin and then start the inclusion process again in habmin. Then it finds the node25 (btw, still node24 as well). I then add Node25 and this it knows what the device is.
  • Then, I am not really sure what it - so after basically doing that several time, suddenly the keyfob was sending keystrokes again.
  • Happy as I was, I went to habmin and set the parameters to 15 and … from then on, nothing.
  • Since then, I am stuck with a keyfob that is not sending anything anymore, even though I did a factory reset, a new inclusion, a wake, almost everything I can think off…

… I keep you posted as soon as soon as I have device running again…
meanwhile if you have an idea how to get rid with the old nodes forever let me know…

Wow, bad luck.

Things to try:

  • don’t be farther away from your Z-Stick than 1-2m (ideally even closer)
  • enable zwave debug logging in the karaf console. Might give you a clue.
  • after hours of pressing keys, check that you battery is not (temporarily) flat.
    Ikea Trådfri remotes have this problem. Check with a voltmeter.
    After the key-pressing is mostly done, the battery recovers, but you might have a dud.
  • Just for info: I use OH2 snapshot from just a few days ago and the Z-Wave development binding
  • When deleting items in PaperUi or HABmin that does not remove it from the stick. It pops right back after a new inbox scan. This is as expected.
  • for a tru exclusion, the device must be properly included and working and the exclusion procedure must be done both in OH2 and on the device.
  • if you no longer have the device OnLine, devices must be removed using a Z-Stick vendor utility.

My 2 cent are that you might try to update new parameters when too far from the stick.

Thanks, Ole for keep posting (!) and all in the above checklist - I make sure all of it is followed.

Ok, then I should probably go to the latest zwave addon. I wanted to do this anyway because with the current version there is actually an issue when inverting rollershutter values (gives 1 instead of 0). Only downside, I need to recreate all things…

See you,
Stefan

@OMR
Can you tell me how you updated to 2.3.0? (openhabian) The installation steps in the readme doesn’t work for me (see my post here)

I then tried to download a 2.2.x version of the z-wave binding but I couldn’t find any (only the 2.3.x version).

thanks
Stefan

Certainly: (I only know ‘how to’ with ubuntu-server 16.04 LTS, but is probably the same)

OH2:

omr@shs2:~$ cat /etc/apt/sources.list.d/openhab2.list 
deb http://openhab.jfrog.io/openhab/openhab-linuxpkg unstable main
omr@shs2:~$ 

After changing file, do:
sudo apt-get update
sudo apt-get upgrade

Z-wave binding:

First uninstall from PaperUI.
Download from here
Goes into: /usr/share/openhab2/addons/
Do not re-install from PaperUI

You might need to install this from karaf: (if no nodes are found at startup while tailing the log)
openhab> feature:install openhab-transport-serial

Unfortunately the deb command doesn’t work (probably because I am on openhabian…), so the apt-get has no effect… :cry:

I am not a linux geek (though I get around). Is openhabian based on ubuntu or debian? Can I install the deb command on openhabian?

Have you looked over here?
Sorry I can’t be of more help.

I am so stupid. I didn’t understand that I had to update the file in what you described above (and now that I am aware of it, I even see that in your writing):man_facepalming:

The called the “deb” (which is actually not a command).

Uprgrading to openhab 2.3.0 worked!

Sorry about that.
I didn’t understand what you ment by the deb command. :slight_smile:
Glad that part worked out.
KeyFob next!

No worries, I am so glad you are helping me :bowing_man:

It’s been a long day and I can finally go to bed and have at least some good news:

  • I was able to update to 2.3.0 which actually was pretty smooth. The “serial” was part of it, even after I uninstalled the z-wave binding.
  • I was then able to update z-wave 2.3.0-snapshot. Interestingly enough it seemed to come along with OH 2.3 already. Anyways, I dropped/uninstalled that one and added the downloaded file, so I have control over it.
  • I deleted all things and readded them. Unfortunately 1 of around 20 are not communicating anymore with the controller at the moment. I will take a look at them tomorrow (worst case I may have to re-include them to the network again…)
    • EDIT/UPDATE: By using the node once it became visible in the network again and has now been adopted. Everything works well now.

Good news though: All of a sudden the keyfob has been detected again. and I get key-changes :dancing_men:
Time-wise :wink: I don’t dare to apply your above config changes tonight. That needs to wait until tomorrow…

I’ll keep you posted what my experience are (and for all others who might run into similar issues).

Stumbled upon this in the manual.
A simpler way to wake the device up for receiving new parameters.

  • Click + and O simultaneously to wake up the device.
  • Wait for the device to configure.

Will test a sequence next :slight_smile:

Yep, I noticed that too, lately.

Still this device keeps me puzzled. All of a sudden it wasn’t sending keystrokes anymore (without your proposed changes applied), so it took me hours to get it working again. Still I see a lot of logs of the device (e.g. I can updated the config or see the device being woken up) but not sending anything.

I now have filed a bug with Fibaro and have provided the configuration of the device.

To all of those who have that problem and want to at least fix it

  • Remove the device from the controller (in habmin and then confirm with the right keystrokes on the device)
  • Reset to factory defaults
  • Re-include the device into the network

After that it works and send keystrokes (1.0, 2.0…)

I will wait now until Fibaro comes back to me and after that, I try setting the 15s liked described at the very beginning of our thread.

Did you check the battery?

Yep, it is on 27% (at least it is now sending battery information, too :wink: )