How to use a things name in rules

Hi, currently i am working on a mobile notification that pops up whenever a Thing turnes offline.

I am currently using the

when
    Thing <ThingUID> changed to OFFLINE

trigger. This successfully fires up my rule. Now i want to send the things name in a broadcast notification. The implicit variable “triggeringThing” is not working because “shelly:shellyplus1pm:b48s8g2cfc3c” is not very human readable. Is there any way to get the things name? I already tried “triggeringThingName” as in “triggeringItemName” but without any success.

Would love to get some help from you guys.

Regards
Jimmi

I found a solution:

import org.openhab.core.model.script.ScriptServiceUtil
import org.openhab.core.thing.ThingUID

rule
    //something
when
    //something
then
    //Use the following to get the triggeringThings label
    ScriptServiceUtil.getInstance.thingRegistry.get(new ThingUID(triggeringThing)).getLabel
end
1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.