["Switchable"] preventing rules from running

I upgraded to OH2 a couple of weeks ago at the same time connected Alexa. Since then, it turns out, a couple of rules won’t run. I’ve discovered that the following rule will only run if I remove [“Switchable”] from the item. This is is true if use “received update ON” also and turns out to be true of all of my items using [“Switchable”]. Am I doing something wrong or is this a bug?

Switch	Fireplace_Switch	"Fireplace(20)"			<fire>		(Fireplace) ["Switchable"]	{channel="zwave:device:065dee7e:node20:switch_binary"} 
rule "Set Fireplace Timer"
	when
		Item Fireplace_Switch changed from OFF to ON
	then
		fireplaceOff = now.plusMinutes(1)
		postUpdate(fireplace_Off_DT,fireplaceOff.toString)
		logInfo("Rules", "Set Fireplace timer:" + fireplaceOff)
end

Does the ZWave binding support tagged items?
Quote from the docs:“Tags are only of interest if an add-on or integration README explicitly discusses their usage.”

The Z-Wave items are working fine, both commanded from the classic UI and Alexa. The rules just won’t respond to items with [“Switchable”] tag.

I just tested it with a virtual switch. Same result.

I don’t see anything obviously wrong with what you’re doing. FWIW, I have NG (Experimental) Rule Engine rules that do fire from items with the “Switchable” tag (specifically for Alexa).

Is it just the “Switchable” tag or any tag?

…and I tested it also with a virtual switch (first with tag “TestTag” later with “Switchable”), …WORKING …???

I thought I found in previous testing that the location of the [“Switchable”] tag in the item was important. Did you try placing it last?

http://docs.openhab.org/addons/io/hueemulation/readme.html

Darn,
I was hoping that would fix it. Placing it after the channel string breaks the whole items file.

Interesting!

Switch Fountain_Switch "Fountain(11)" 				<water>		(Lights,Fireplace)	[ "TestTag" ] {channel="zwave:device:065dee7e:node11:switch_binary"}

will allow the rule to run, but obviously breaks Alexa’s control over it.

I am running OH2 Snapshot, lots of z-wave devices, tagged for Alexa.

  1. You are correct that having the [“Switchable”] tag after channel string breaks the items.

  2. In your first example (with the fireplace), you have no space between the end of the item name and the quote before the text name. Maybe transcription error on your part BUT I’d suggest inject a space before the opening quote.

Theory: item parsing boundary difference/inconsistency between OH components. Item line parser has to parse item type, item name, optional “human-readable name”, optional type, optional (groups) list, optional [“Tag”], and optional {channel info}. Line parser has to do something like: take everything up to but not including the first blank and validate that against valid item types, then take everything after the first blank until either (a) the next blank – which would be AFTER the quotation mark in your first example or (b) the next delimiter of list of delimiters (which would hopefully include quotation mark). Correct answer should be (b), BUT…

Solved. It has nothing to do with the tag.

It seems I made two changes at once and blamed the wrong one. It does not like the way that I’ve tried to use the constant iFIREPLACE_DURATION. I suspect the rule is actually running, but crashing or not executing on the first line after “then”.

import org.eclipse.smarthome.model.script.actions.Timer
import org.joda.time.DateTime

val int iFIREPLACE_DURATION = 90

var DateTime fireplaceOff = now.plusMinutes(iFIREPLACE_DURATION)

rule "Set Fireplace Timer"
	when
		Item Fireplace_Switch changed from OFF to ON
	then
		fireplaceOff = now.plusMinutes(iFIREPLACE_DURATION)
		postUpdate(fireplace_Off_DT,fireplaceOff.toString)
		logInfo("Rules", "Set Fireplace timer:" + fireplaceOff)
end