[SOLVED] String Item (password) - compare rule - do someting if equal stored string

Hi,
I need put some string (text) item from sitemap as password.
In a rule the typed string should be compared to “secret string” value.
If both strings are equal, then set visibility can mask some sitemap/item items.

Like keypad PIN Code input, but only with string comparison.
If the string format is like 4 digit PIN Code, that would be fine.
Thanks.

The first problem is there is no way to enter free text on the sitemap directly. If you search the forum you can find some work arounds involving mappings on Switch elements on the sitemap and complicated Rules to capture the numbers tapped and time them out after a given amount of time and such. It’s all rather complex and not terribly usable.

Once you have the String it’s pretty easy though. Compare the strings (if(MyPassword.state.toString == "mypassword") and set a Switch Item to ON.

In your sitemap use the visibility element and check if your visibility Switch is ON to determine whether to show it or not.

But be aware that this will show those elements on ALL clients currently connected to OH. There is no way to only control it for the UI you happen to be using so if someone else has BasicUI up they will see all the Items too.

In HABPanel you can create a custom widget to enter the password or add a keypad (there are examples you can use in the widget gallery I’m sure). But I don’t know if there is a way to control visibility in HABPanel.

A better approach may be to create two sitemaps, one with everything and one with only those elements you want to show. Theoretically you can add a reverse proxy and require a username and password for the sitemap that shows everything.

Thank you very much Rich.
I will do the job with two sitemaps, or later in Habpanel. All aspect from your post are clear for me.
I don’t need to have concurent views for many users. It was meaning that I have some complete sitemap for experts only and some for view only non expert users.
I impemented some serial, ModbusTCP, https API communication to fotovoltaic DC/AC inverter Fronius and battery charger Studer. Of course some parameters are to view/switch only for experts and little amount for users.