[SOLVED] Zwave - howto integrate RemoteControls KeyFOB

Hi, i used a MiniMote for years now and recently bought a Fibaro KeyFOB.

The Minimote is configured this way:

Switch MiniMote_B1 “MiniMote - Button 1” {zwave=“33:0:command=SCENE_ACTIVATION,scene=1,state=1”}
Switch MiniMote_B1h “MiniMote - Button 1hold” {zwave=“33:0:command=SCENE_ACTIVATION,scene=2,state=1”}
Switch MiniMote_B2 “MiniMote - Button 2” {zwave=“33:0:command=SCENE_ACTIVATION,scene=3,state=1”}

So each ButtonPress belongs to a Switch, so i have 8 switches…with Fibaro’s Keyfob it will be even more. Is this the smartest way to do so. I have my doubts. I hope there is a way to simply have one item that is handled via rules…so if swithc is pressed and scene is 1…and so on.

If not, no problem, only wanted to know if really the way i do it is the correct one.

Many thanks for clarification! Norbert

Yes, I think this is the only option available in OH1.

Thanks Chris for the fast reply. And is it any different in OH2 - as i’m right now in transition…

@chris

related to your “…the only optin available in OH1”…how can this be better integrated in OH2.
I’ve already a “thing” for my KeyFOBs and already an item that posts the correct scene number depending what button you press.

So is here again a rule required that “checks for an update of scene umber” + does an if-else depending on the value…?
is there any switch/case kind of way to program this, to not requre if-else’s…

Regards
Norbert

Yes - you need a rule to process a scene. I guess the rule itself will differ depending on what rule processor you’re using. IF you’re using the XText rules (ie the ‘old’ format) then there’s a switch statement -:

https://eclipse.org/xtend/documentation/203_xtend_expressions.html#switch-expression

So it would be something like:

when
Item KeyFOB_SceneNumber received an update
then
switch KeyFOB_SceneNumber {
case 1: Switch1.sendcommand(ON);
case 2: Switch2.sendcommand(OFF);
case 3: Switch3.sendcommand(ON);
end
}

what would be a different way, is there a 2.0 way to write rules? interoperable?

Here’s how a working oh2 rule looks like in my config;

rule "Act on wall controller"
when
Item GF_Cinema_Wall_Contr_Scene received update
then
  switch GF_Cinema_Wall_Contr_Scene.state {
    case 1: { // Set Cinema lights to cleaning
        	logInfo("Cinema Scene", "Cinema - Wall Controller Single Click UP")
			GF_Cinema_Lights_Scene.postUpdate(3)
		}
	case 2: { // Set scene_cinema.state to state Lights Off
	        logInfo("Cinema Scene", "Cinema - Wall Controller Single Click DOWN")
        	GF_Cinema_Lights_Scene.postUpdate(0)
   		}	
	case 11: { // Start cinema
        	logInfo("Cinema Scene", "Cinema - Wall Controller Double Click UP")
        	sendCommand(GF_Cinema_Active_Scene,ON)
    	}	
	case 12: { // Stop cinema
	        logInfo("Cinema Scene", "Cinema - Wall Controller Double Click DOWN")
    	    sendCommand(GF_Cinema_Active_Scene,OFF)
    	}	
  }
end