Get triggering thing name in JavaScript (ECMAScript 2022+)

  • Platform information:
    • openHAB version: 4.0.4


in a JavaScript (ECMAScript 2022+) UI Script with the trigger

When the state of an item group changes

I can get the triggering item name and state, e.g.

console.debug(event.itemName + " has changed to " + event.itemState);

If the Script is triggered by a thing status change, how do I get the triggering thing name?

event.thingName gives me undefined

Thanks, Markus


if you need the name of a thing:

1 Like

See JavaScript Scripting - Automation | openHAB for all the properties that can be a part of event and under what circumstances that property will exist.

1 Like

Works fine, thank you very much for your help!