Is it possible to append a return; at the end of a line vs. putting it on the next line? I have a bunch of IF statements on a member of rule that I want it to return after it finds it’s match.
Is this possible below?
if (triggeringItem.name == 'LivingRoom_Motion_SensorBatteryLevel') { LivingRoom_Motion_SensorLastChange.postUpdate(new DateTimeType()) return; }
Lots of lines of code like this:
if (triggeringItem.name == 'LivingRoom_Motion_SensorBatteryLevel') { LivingRoom_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'DiningRoom_Motion_SensorBatteryLevel') { DiningRoom_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'Foyer_Motion_SensorBatteryLevel') { Foyer_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'BasementHallway_Motion_SensorBatteryLevel') { BasementHallway_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'BasementHallway2_Motion_SensorBatteryLevel') { BasementHallway2_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'PowderRoom_Motion_SensorBatteryLevel') { PowderRoom_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'Closet_Motion_SensorBatteryLevel') { Closet_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
if (triggeringItem.name == 'KidsBathroom_Motion_SensorBatteryLevel') { KidsBathroom_Motion_SensorLastChange.postUpdate(new DateTimeType()) }
I see you are using openHAB 3, if all you want is a timestamp, why not use a DateTime item with a timestamp on update profile? No rule needed or am I missing some use case?
I don’t know sorry, I use the Main UI for everything since moving to v3
Maybe someone else can jump in
Got openHAB running with DSL rules (but in Main UI editor) but my DSL is really rusty, using jRuby now