Setting item Label from rules


is there a possibility to set the item label dynamically in a rule?
I have not found anything.


could you probably more elaborate what you want to achieve?

there are ways to make items visible based on the content - but this is more on the sitemap side - not on the item itself.

Check the wiki @

Using an asistance item you might be able to achieve what you want.


Sure, thank you for your quick reply.
I started using the caldav binding and want to show a couple of appointments in my sitemap.
At the moment I have on item “Name” and one item “Date”.
This is not very pleasing, I’d rather set the name of the appointment as an item label and the date as the value of the item.
I’m trying to combine both items into a helper item now, but this is not a very elegant solution.

Not at this time. You only have control over the Item’s state and how that state is displayed to the right of the static label.

Your best bet is to continue with the helper item.

I have a question regarding setting an items label. I have been setting the label of a Date item before:

rule "Update CalDav_Date4 label based on type of waste (for sitemap display)"
    Item CalDav_Date4 changed
	CalDav_Date4.label = CalDav_Muelltonne4.state.toString

	if (CalDav_Muelltonne4.state.toString.contains("Gelbe")) {
	} else if (CalDav_Muelltonne4.state.toString.contains("Papier")) {
	} else if (CalDav_Muelltonne4.state.toString.contains("Bio")) {
	} else if (CalDav_Muelltonne4.state.toString.contains("Rest")) {
	} else if (CalDav_Muelltonne4.state.toString.contains("Glas")) {

That worked just fine. Unfortunately, for each of my four items I created the same rule, so a lot of duplicate code. So now I trying to do the same in a new rule that does it for a number of items:

rule "test"
    Item NextTrash_1_Type changed or
	Item NextTrash_2_Type changed or
	Item NextTrash_3_Type changed or
	Item NextTrash_4_Type changed
	var nextTrash = gNextTrashType?.members

	nextTrash.forEach[ trash | 
		val tmp = gNextTrashDate.members.findFirst[name.equals('Type', 'Date'))]
		tmp.label = trash.state.toString

		postUpdate(gNextTrashIcon.members.findFirst[name.equals('Type', 'Icon'))], 
			(if (trash.state.toString.contains("Gelbe")) "1" 
			 else if (trash.state.toString.contains("Papier")) "2"
			 else if (trash.state.toString.contains("Bio")) "3"
			 else if (trash.state.toString.contains("Rest")) "4"
			 else if (trash.state.toString.contains("Glas")) "5"))

Setting the label via tmp.label does not work, even though the item is found (I do see the logInfo line in my log with the items name). I am getting the following error:

2018-02-22 10:40:00.028 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'test': Couldn't invoke 'assignValueTo' for feature JvmVoid:  (eProxyURI: muell.rules#|::

Any idea if there is a way to fix that?

I think I got it to work myself, doing the following:

var DateTimeItem tmp = gNextTrashDate.members.findFirst[name.equals('Type', 'Date'))]
tmp.label = trash.state.toString