Zwave item triggering on startup

Hi,

I’ve a zwave.me wall controller with a series of item files looking like this:

Switch	TV_Wallswitch_Scene1	"TV Wallswitch - Scene 1"	{ zwave="19:command=SCENE_ACTIVATION,scene=11,state=1" }

The problem is that if I make a rule triggered by “changed from OFF to ON” or “received command ON” then it never triggers. If the rule is “received update ON” then it triggers fine when the button is pushed; but it also triggers when openhab starts up. Attempts to mask this with a startup rule have been unsuccessful, as the rule triggers before my startup rule can do anything.

Any suggestions gratefully received!

Dan

I have a similar controller (the Wall Controller WCD2). I haven’t used it for anything sensible yet, and it’s been a while since I played around with it, so I am a bit hazy on the details…

My item setup was as follows:

Contact		S01D011_cButton1	{ zwave="13:command=scene_activation, scene=11, state=1" }
Contact		S01D011_cButton2	{ zwave="13:command=scene_activation, scene=12, state=0" }
Contact		S01D011_cButton3	{ zwave="13:command=scene_activation, scene=21, state=1" }
Contact		S01D011_cButton4	{ zwave="13:command=scene_activation, scene=22, state=0" }

I don’t remember exactly what my logs showed when I did play around with it, but I suspect that the device is only sending state updates. This would then be the reason your “received command ON” rule does not trigger.

About the “changed from OFF to ON” rule not triggering this could very well be because at startup the TV_Wallswitch_Scene1 item is in the Uninitialized state, and consequently it will never change from OFF to anything.

If you change the rule to read “changed to ON” I am pretty sure it should fire. Based on my experience with the device, however, it will probably only fire once after startup. This is because it seems that instead of switching between two states, the device is posting updates of the same state every time you hit a button.

So, in my setup using Contact items, the following rule is working fine for all buttons:

rule "Button 1"
when
	Item S01D011_cButton1 received update OPEN
then
	logInfo("test", "Button 1=" + S01D011_cButton1.state.toString())

	if(S01D011_cButton1.state  == OPEN) {
		logInfo("test", "State=OPEN")
	}
	else {
		logInfo("test", "State=CLOSED")
	}
end

The above rule will write “State=OPEN” to the openhab.log file every time you hit Button 1 on the wall controller.

I realize that I didn’t comment on the above part of your description. I don’t remember seeing this behavor in my setup (ref. previous post). Do you have persistence with restoreOnStartup configured for the items in question? If so, I guess every time you start the system your switches are restored to ON state causing your rule to fire.

I am not sure how how to get out of this situation - other than avoiding perstistence with restoreOnStartup for the items in question.

Thanks - could indeed be persistence, as I’m persisting everything. Perhaps I should try persisting only the items I actually need tracked…

Incidentally, do you know where the persistence databases are kept? I fear mine are getting enormous…

Dan

The persistence databases are stored in the following location (at least in my setup):

/var/lib/openhab/persistence/

Below this you will find another directory per persistence service that you are using, e.g. rrd4j, db40, mapdb, etc.