[SOLVEDChange sitemap based on Status

Good afternoon,

I recently started OpenHab and went through the standard documentation. During these steps, Mobile presence is mentioned as an example. In the end I also built this and get the status in the sitemap. Now I have the status “Mobile at home” with a switch to YES, and below this item, I have the Item “Last seen”.

Now I would like to see only “Mobile at home”, But if this status changes to NO, then I would like to show “Last seen” instead of “Mobile at home”. I can’t get it done. I played with rules settings, but it didn’t work out. I can play a sound if the status changed, but I can’t manage to change the sitemap because of the status of my phone.

Basically the idea is: (No official coding languages :slight_smile:

If status == ON {

Show on Sitemap: "Mobile at home"

else {

 Show on Sitemap  "Last Seen"

} endif

I guess this is pretty simpleissue, but Im not sure where to start, so I hope someone can point me out in the right direction.

Kr

I just found out that there is a visibility option.
So this one should answer my question and I will do some research first.

Thx

visibility=[item_name operator value, item_name operator value, ... ]
1 Like

Goodafternoon,

Unfortunately I was not able to manage the view based on visibility=[item_name operator value, item_name operator value, … ] , I am able to change status based on this rule, but I would like to have the entire element hidden based on a status.

I hope someone can point me into the right direction of have a working example.

Kr

Sorry, again

I finally managed it, It helps when you write a post and then rephrase you search query

I managed what I want, and I solved it this way.

i


sitemap default label="Sitemap" { Switch item=nummer1_mobile_presence label="nummer1 Mobiel" visibility=[nummer1_mobile_presence==ON]
Switch item=Nummer2_mobile_presence label="Nummer2 Mobiel" visibility=[Nummer2_mobile_presence==ON]
Switch item=Nummer3_mobile_presence label="Nummer3 Mobiel" visibility=[Nummer3_mobile_presence==ON]

Frame label="Afwezigheid"  {
Text item=Nummer2_LastSeen label="Nummer2 Laatst Gezien [%1$ta %1$tR]" visibility=[Nummer2_mobile_presence==OFF] icon="network"
Text item=nummer1_LastSeen label="nummer1 Laatst Gezien [%1$ta %1$tR]" visibility=[nummer1_mobile_presence==OFF] icon="network"
Text item=Nummer3_LastSeen label="Nummer3 Laatst Gezien [%1$ta %1$tR]" visibility=[Nummer3_mobile_presence==OFF] icon="network"
}

}

There are examples in the docs


Did you miss those, or can they be improved?

Indeed you are completely right, but I found the visibility=[item_name operator value, item_name operator value, … ] on a different location / site.

So I tried numerous options, but I always started with visibility= and left the element type out. E.g
//visibility=[Nummer2_mobile_presence==ON]

But if this is my fault, and I would blame it on the documentation. The url you showed me, had covered this question.

Thanks again!