in order to manage my text based rules in an easy way I make extensive use of the implicit variable: triggeringItem
Unfortunately OH3 does only provide access to this variable if the rule has a “Member of” trigger. Good thing, this is documented Bad thing, I’m stuck here:
rule "turn on TV and AVR" when Item Harmony_XBOX received command ON or Item Harmony_Nintendo received command ON or Item Harmony_Playstation received command ON or Item Harmony_SatTV received command ON or then HarmonyActivity_HK.sendCommand(triggeringItem.label.toString()) end
I see two options:
- split all the triggers into individual rules
- use the import org.openhab.core.model.script.ScriptServiceUtil together with implicit variable triggeringItemName to access the item label
Would you agree these are good ways to implement? Or is there any better way?