Things are not meant to be used in rules. The ‘event mechanism’ as you call it is based on items only.
In fact you should not need to refer to things as you can always have items to be mapped to things (well, via channels).
I don’t understand what you mean by “apply a rule” as you only ever apply actions or send commands to items from within a rule.
If that’s what you want to do then put all items you want to refer to into a group and use groupname.sendCommand().
If you do something custom, please do 1. so it works with ALL bindings. Then create a new posting under Tutorials and Solutions to share your solution.
rule "OFFLINE check DashX"
when
Time cron "22 */30 * * * ?"
then
// loop through all members of G_DashThing
G_DashThing.members.forEach[dash |
// get ID of the Dash button
val dshName = dash.name.toString.replaceAll("DashThing","")
// translate ID into real Thing-ID
val thing = transform("MAP", "dashs.map", dshName)
// get status of Thing
val status = getThingStatusInfo(thing).getStatus()
if(status.toString() == 'ONLINE') {
postUpdate(dash, "ON") // the following does not work, because it's not the item itself, but just its name as string: itemNameSw.postUpdate(ON)
}
else {
postUpdate(dash, "OFF") // the following does not work, because it's not the item itself, but just its name as string: itemNameSw.postUpdate(ON)
}
]
end