Use things label

Is it possible to use the label of a (file created) thing for an item? Either via a rule or an .items-file.

Sorry, @opus, could you elaborate, please?

I have created my things in a file including a label for the thing. That label is used on the Control tab of PaperUI for that thing.
I would like to use this things-label to be assigned to the state of an item.

@5iver

Is that possible?

As a Thing may have dozens of channels and Items … might be of limited use.

1 Like

It is a “limited use”, no feature request, just a question!

Yes…

from core.log import logging, LOG_PREFIX
log = logging.getLogger(LOG_PREFIX + ".TEST")
from org.eclipse.smarthome.core.thing import ThingUID

log.debug("{}".format(things.get(ThingUID("kodi:kodi:familyroom")).getLabel()))
log.debug("{}".format(things.get(ThingUID("kodi:kodi:familyroom")).getLocation()))
log.debug("{}".format(things.get(ThingUID("kodi:kodi:familyroom")).isEnabled()))
log.debug("{}".format(things.get(ThingUID("kodi:kodi:familyroom")).getStatus()))
log.debug("{}".format(things.get(ThingUID("kodi:kodi:familyroom")).getStatusInfo()))

But you might be asking about the OLD rule engine (:stuck_out_tongue_winking_eye:)…

import org.eclipse.smarthome.model.script.ScriptServiceUtil
import org.eclipse.smarthome.core.thing.ThingUID

rule "Test"
when
Item Virtual_Switch_1 received command
then
    logDebug("Rules","Test: Start")
    logDebug("Rules","Test: [{}]", ScriptServiceUtil.getInstance.thingRegistry.get(new ThingUID("kodi:kodi:familyroom")).getLabel)
end
1 Like