Visibility is dynamic?

I have visibility set on a couple items in my sitemap. One is a temperature value setting that is only visible when the cooler is turned on. That works great, as soon as you click to turn on the cooler the temperature setting shows up.

I want another app to set a variable which then affects visibility, and it does, but the sitemap has to be interacted with. That is, click back a page and then to the same spot again and it has updated visibility. I can’t see to get visibility to update dynamically on the same page when the item is changed via script. Any thoughts?

Sounds like a bug, but which UI? Does the same happen using a different UI client? Which version of openHAB?

Yea, tried setting the item based on a chron rule with the same result. The sitemap doesn’t change until you move away from that page and go back.

Both in the browser and android app.
Version 1.8.0

I was hoping to show a simplified page with security camera feed links for only those cameras that report motion. Hiding those that don’t seemed like the best way, but you have to refresh or move around.

It would be nice to have visibility= be truly dynamic without requiring user interaction.

If I update visibility via a door sensor, both clients show the update right away.
Odd that they don’t with timer based rule setting switchitem (that I made just for testing), and they don’t when setting an item via external script.

Do real physical items hit the bus differently than those that only exist in OH?

I can’t think of a reason that a state update for a Contact item vs. a Switch item should be handled differently in the client. Could you make your external script change the state of a test Contact item (using OPEN or CLOSED) instead of the Switch item, to see if you still observe different handling?

When I try to set anything for a contact item I get an error saying: Received unknown command ‘OPEN’ for item ‘CamMotion’

Contact items do not accept commands, because you can’t command a door contact to open the door. :slight_smile: But you can tell a contact item to update its state to OPEN or CLOSED.

I appreciate your help.
Guess I don’t know how to do that. The command I am using so far is just
http://IPADDRESS:8080/CMD?CamMotion=CLOSED

Even so, setting a contact item to be OPEN via a rule has the same result, the sitemap visibility is not fully dynamic.

The CMD servlet only sends commands to items; to instead update the item’s state, you would have to use the REST API.

If your rule calls something like postUpdate(item, CLOSED), you see the state change in the UI for that item, but visibility isn’t changed for other widgets that have visibility= referencing that Contact item, then that would show that there is no special-case logic that distinguishes between Contact and Switch item updates.

Could you open issues in github, per client, that report that visibility= does not work unless there is user interaction? An example sitemap, items file, test rule, etc., would be very helpful there.

I will submit an issue for this, thanks for your time!

1 Like

I’ve noticed the same problem with a contact item which is updated using postUpdate in a rule. In the android client it refreshes fine after a few seconds but if I add a visibility option it does not refresh unless I close the app and restart. Did you find a fix for this?

UPDATE

For some reason it is now working! Weird because I did not change a thing…perhaps something goes on behind the scenes when you first create items???

I didn’t take it any further on OH 1.8. Recently moved on to 2.0 and haven’t tried it on the classic sitemap yet. Sorry I don’t have more to offer.