Modify a label in sitemaps

Hi to all
i have in sitemap file a switch

	Default item=No_Timer label="Disabilita Timer" icon="switch"

Is it possible to change the label of the switch “No_Timer” when the state change from ON to OFF?

If yes How?

You should be able to do this with a rule and within this rule you have to set the label. I typically combine this with a mapfile. So i set that labels for my movable wall plugs

NL_SS_Switch_01_State.setLabel(transform("MAP", "", NL_SS_Switch_01_Label.state.toString))

can you show me an example please?

Changing the label of an Item in a rule will not work here, where you have specified a label in the sitemap as well.

There is no way to change the sitemap label, so perhaps you should leave that out and have it use the Item label instead.

A different way to do this is to use sitemap visibility to show and hide two alternate lines with different labels.

If have dons this with my gas station rules Please see here:

//  Thing: Internet item - Tankerkönig Petrol stations
Group NL_IN_PetrolStation "Tankstellen" <scene_gas_station> (gNL_Internet)
    DateTime    NL_IN_PetrolStation_LastUpdate "Letztes Update [%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS]" <time_clock> (NL_IN_PetrolStation)
    // Prices
    Number      NL_IN_PetrolStation_Diesel01    "Nordoel (Uetersen) [%.3f €]"               <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Prices, gStandardTimeline) 
    Number      NL_IN_PetrolStation_Diesel02    "Nordoel (Elmshorn) [%.3f €]"               <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Prices, gStandardTimeline) 
    Number      NL_IN_PetrolStation_Diesel03    "HEM (Elmshorn) [%.3f €]"                   <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Prices, gStandardTimeline) 
    Number      NL_IN_PetrolStation_Diesel04    "Star (Elmshorn) [%.3f €]"                  <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Prices, gStandardTimeline) 
    Number      NL_IN_PetrolStation_Diesel05    "HEM (Wedel) [%.3f €]"                      <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Prices, gStandardTimeline) 
    Number      NL_IN_PetrolStation_Diesel06    "SB (Wedel) [%.3f €]"                       <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Prices, gStandardTimeline) 
    // open/closed status
    Contact     NL_IN_PetrolStation_Open01      "Nordoel (Uetersen) [MAP(]"  <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Open) 
    Contact     NL_IN_PetrolStation_Open02      "Nordoel (Elmshorn) [MAP(]"  <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Open)
    Contact     NL_IN_PetrolStation_Open03      "HEM (Elmshorn) [MAP(]"      <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Open) 
    Contact     NL_IN_PetrolStation_Open04      "Star (Elmshorn) [MAP(]"     <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Open) 
    Contact     NL_IN_PetrolStation_Open05      "HEM (Wedel) [MAP(]"         <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Open) 
    Contact     NL_IN_PetrolStation_Open06      "SB (Wedel) [MAP(]"          <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Open) 
    // Display items
    String      NL_IN_PetrolStation_Display01   "Anzeige Tankstelle 01 [%s]"                <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Display)
    String      NL_IN_PetrolStation_Display02   "Anzeige Tankstelle 02 [%s]"                <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Display)
    String      NL_IN_PetrolStation_Display03   "Anzeige Tankstelle 03 [%s]"                <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Display)
    String      NL_IN_PetrolStation_Display04   "Anzeige Tankstelle 04 [%s]"                <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Display)
    String      NL_IN_PetrolStation_Display05   "Anzeige Tankstelle 05 [%s]"                <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Display)
    String      NL_IN_PetrolStation_Display06   "Anzeige Tankstelle 06 [%s]"                <scene_gas_station> (NL_IN_PetrolStation, gPetrolStation_Display)

and the rules

//  Items File: petrolstation.rules
//  All rules to process die pertrolstation data gathered from the Tankerkönig binding

//  Imports
import java.util.concurrent.locks.ReentrantLock
import java.util.Date

//  Global variables and constants
var ReentrantLock petrolLock = new ReentrantLock()

//  Rule: Process Update of Gasoline Prices
//  On update of gasoline prices sort them and set the labels of display items to sorted order
rule "Process Update of Gasoline Prices"
    Member of gPetrolStation_Prices received update

    try {

        val String ruleIdentifier = "userrule.ProcessUpdateOfGasolinePrices"

        var i = 1

        for (stationPrice : gPetrolStation_Prices.members.sortBy[ state as DecimalType ]) { // Another loop to overcome the "Final Variable" vs "Lambda" problem

            val String stationIdentifier =,'_'))
            val String stationNumber =,

            val ContactItem stationOpen = gPetrolStation_Open.members.filter[ k | == stationIdentifier+"_Open"+stationNumber ].head as ContactItem
            val String counter = String::format("%02d", i)
            val StringItem stationDisplay = gPetrolStation_Display.members.filter[ k | == stationIdentifier+"_Display"+counter ].head as StringItem

            stationDisplay.label = stationPrice.label
            if (stationOpen.state == OPEN) {

                if (i==1) {
                    stationDisplay.postUpdate(String::format("(%1$tR)  %2$.3f €", new Date(), (stationPrice.state as DecimalType).doubleValue()))
                } else {
                    stationDisplay.postUpdate(String::format("%.3f €", (stationPrice.state as DecimalType).doubleValue()))

            } else {
                stationDisplay.postUpdate(transform("MAP", "", stationOpen.state.toString))



        NL_IN_PetrolStation_LastUpdate.postUpdate(new DateTimeType())
        logInfo(ruleIdentifier, "Gasoline prices are updated and sorted! Initiator {},", triggeringItem.label)

    } finally {


and the sitemap part

       Frame label="Tankstellen" {

            Text item=NL_IN_PetrolStation_Display01
            Text item=NL_IN_PetrolStation_Display02
            Text item=NL_IN_PetrolStation_Display03
            Text item=NL_IN_PetrolStation_Display04
            Text item=NL_IN_PetrolStation_Display05
            Text item=NL_IN_PetrolStation_Display06


The idea ist to sort the item in a dynamic manner so that the cheapest station is shown first. and it works.