[SOLVED]If statements in sitemaps

Hi guys,

I’m integrating my Harmony Elite into the OpenHAB software and struggle with the sitemap. What I’d like to do is when a certain activity is started, the corresponding controls will appear. So for example, when the TV-activity is started, I’d like to have the button to switch channels appear in my screen and disappear again when the TV is shut down again.


The issue is within the if statement, but I used the .state already in a rule. Does anyone know if it is possible to use if-statements in the sitemap?
Here’s my code:

Frame {
    Default item=Sunset_Time
    Group item=OtherItem label= "Begane grond" icon="groundfloor"{
        Frame label="Woonkamer"{
            Switch item=HarmonyHubWoonkamerCurrentActivity label="Afsluiten" mappings=[PowerOff='PowerOff']
            Switch item=HarmonyHubWoonkamerCurrentActivity label="Activteit" mappings=[TV='TV', Netflix='Netflix', Muziek='Muziek', PS3='PS3', 'RTL-XL'='RTL-XL']
            if(HarmonyHubWoonkamerCurrentActivity.state == "TV") {
                Switch item=YamahaVersterkerButtonPress label="Volume" mappings=[VolumeDown='-', VolumeUp='+']
                Switch item=CiscoDVRButtonPress label="Bediening" mappings=[DirectionDown='Down', DirectionLeft='<',DirectionRight='>',DirectionUp='Up']
                Switch item=CiscoDVRButtonPress label="Afspelen" mappings=[Rewind='<<', Play='>', Pause='||', FastForward='>>']                  
            }
        }

Does the visibility parameter work for you?

I’m fairly certain IF statements don’t exist in Sitemaps.

No it doesn’t, but I’m not certain if this is the correct way to set it up like this…
Switch item=YamahaVersterkerButtonPress label=“Volume” mappings=[VolumeDown=’-’, VolumeUp=’+’] visibility = [HarmonyHubWoonkamerCurrentActivity.state == “TV”]

Almost - I don’t think you need the .state. Try:

...visibility = [HarmonyHubWoonkamerCurrentActivity == "TV"]

Thanks man! That was the issue!