Sitemap visibility / comparing two items does not work

I am running OH 2.2 Snapshot Build #1073. I am using Basic UI

I try to show some items only if they differ from other items. But that does not work. The items are always visible.

String ITEM1_MODE "Modus Item1 [MAP(HM-CC-RT-DN.map):%s]" { channel = "homematic:HG-HM-CC-RT-DN:homegear:XXXXXXX:4#CONTROL_MODE" }
String ITEM2_MODE "Modus Item2 [MAP(HM-CC-RT-DN.map):%s]" { channel = "homematic:HG-HM-CC-RT-DN:homegear:YYYYYYY:4#CONTROL_MODE" }

My sitemap looks like this

sitemap Test label="Test" {
	Text item=ITEM1_MODE label="Item1 [MAP(HM-CC-RT-DN.map):%s]"
	Text item=ITEM2_MODE label="Item2 [MAP(HM-CC-RT-DN.map):%s]" visibility=[ITEM1_MODE!=ITEM2_MODE]		
}

What am i doing wrong?

Thanks for any help.

Maybe visibility can only be tested against a fixed value. I’m not sure about this and the documentation does not mention this case.
As a workaround, I would suggest a proxy item plus a simple rule:

Switch ITEM2_MODE_vis
rule "compare"
when
    Item ITEM1_MODE changed or
    Item ITEM2_MODE changed 
then
    ITEM2_MODE_vis.postUpdate(if(ITEM1_MODE.state != ITEM2_MODE.state) ON else OFF) 
end
sitemap Test label="Test" {
    Text item=ITEM1_MODE label="Item1 [MAP(HM-CC-RT-DN.map):%s]"
    Text item=ITEM2_MODE label="Item2 [MAP(HM-CC-RT-DN.map):%s]" visibility=[ITEM2_MODE==ON]
}

Thanks, but i thought about proxy items and rules and i would go that way for one or two items. But in my case i would need this for 10 items to be useful.

I don’t want to copy/paste that much stuff (currently).

I’m no expert either but does sitemap file accept “item.state” like in rules?

You could try:

visibility=[ item1.state != item2.state ]

or

visibility=[ item1.toString != item2.toString ]

Thanks, i already tested this. Doesn’t work. Sitemap has errors. :wink:

1 Like