I feel seriously embarrassed for I was unable to figure this out:
In my HabPanel template based widget (reading the Template Widget Tutorial, I got to frequently access a thing’s item name as in "itemValue('homematic_HmIP_STHO_3014f711a0001f58a9930328_000ED709AED3C6_1_ACTUAL_TEMPERATURE')". This is long and unhandy to use. I wish I could declare a constant with this content and use the constant instead.
Advanced level: I use not only _ACTUAL_TEMPERATURE but also _HUMIDITY and other channels of the same device. Would be lovely to declare the constant to contain the shared part of the item’s name, concat this with the channel name and feed this to itemValue().
Feelin’ like a rookie, not even having an idea of the proper keywords to search for. Help!
If “homematic_HmIP_STHO_3014f711a0001f58a9930328_000ED709AED3C6_1_ACTUAL_TEMPERATURE” is too long for you, why don’t you simply use a shorter name for your item?
I don’t know how to do this in PaperUI because I use the config files to create my things and items. It looks like in PaperUI you are not able to change the name of an Item. You have to delete an recreate it. There you have the option to set the name for it.
For the second suggestion:
When you create a widget (and by that I don’t mean a template based widget, just to be clear), in the settings-tab you can add config-settings. There you simply add one with the type “Item”. Then you can use “config.” (replace with the ID you used) to access the item.
Maybe this would have been a better link:
Have a look at the “Settings tab” section and the examples.