I have a rule like this:
rule "FGMS Motion" when Member of fgmsMotion changed then if (triggeringItem.state == ON) { switch triggeringItem.name.toString { case "fgmsCarportMotion": postUpdate(fgmsCarportMotionDt, new DateTimeType()) case "fgmsEntreeMotion": postUpdate(fgmsEntreeMotionDt, new DateTimeType()) case "fgmsHallMotion": postUpdate(fgmsHallMotionDt, new DateTimeType()) } } end
But i want like this
val motionItemName = ""; rule "FGMS Motion" when Member of fgmsMotion changed then if (triggeringItem.state == ON) { motionItemName = triggeringItem.name.toString + "Dt" postUpdate(motionItemName, new DateTimeType()) } end
Is that possible, now de rule is doing nothing with the last variant?
Yes i have all the items, variant 1 is working…