Update web UI with states on load

Hello,

Currently looking to convert from Vera to OpenHAB using the MIOS binding as the Vera UI has become so flaky it’s borderline unusable. Things are going well and while there is a learning curve, I feel like I ‘get’ the way OpenHAB does stuff.

My question is this: is it possible to update the web UI when I load/refresh it? Currently it appears that web UI values are only updated on state changes. Can OpenHAB pull the latest values (where stored) from the database and present them straight away? I’ve had a look but haven’t been able to find an answer so far.

Thanks for the help

Stuart

When you load or refresh the sitemap it does give you the current state of all the displayed Items. I guess I don’t understand the question.

What behavior are you seeing?

When you load the sitemap it displays the current value of all displayed Items. When an Item changes state the UI changes to reflect this current state**. You should never be in a situation where the states of your Items do not match what is displayed in the UI.

** There is a bug (maybe fixed, certainly fixed in OH 2) where the sitemap doesn’t always update when an Item changes, but in this situation a refresh of the sitemap will give you each displayed Item’s current state.

Persistence (i.e. the database) is actually not involved with the sitemap at all.

It appears to be intermittent. Sometimes I refresh and values are blank e.g. the battery group for Z Wave sensors. Having just tested it again, it now appears to work as you describe…

It definitely doesn’t always give the current state though.

By blank do you mean “-” ? That means the current state is “Undefined”. Do you see that after a restart of OH or after an Item’s file change? Items are reloaded and reset to Undefined in that case unless you have Persistence with restoreOnStartup set up.

Ahh yes. If the state is set to undefined when I update the items file then that may be it as I have only noticed it when I am working with openHAB. I’ve added the restoreOnStartup entry to my persistence configuration and that appears to have sorted it.

Thanks for the help!

exactly my case here - how to solve this ? OH 2.1.0 here

I need to refresh the page/sitemap every time i change a switch ON/OFF :frowning:

And what version of OH are you running? Which UI are you using? Have you verified that the Items are changing state in events.log?