Switch States in Browser Sometimes Wrong

Hi,

I have gradually adding various items to my openhab setup.

Tellstick and wall socket switches
Hue lights
mqtt broker
owntracks
openpaths
squeezebox
mpd

So far all of these are working generally pretty well, however i noticed while I’ve been testing and refreshing my sitemap in the browser the various switch states are not always being accurately shown in the browser??

I often find that the Tellstick switch is still actually on. but Openhab shows it as off.

I also notice that my location is not always being correctly shown in Openhab either? and sometimes takes quite sometime to update, especially after a browser refresh even though just before the refresh everything was correct.

Apologies for my ignorance, as I’m very new to Openhab and enjoying getting to grips with how it all works. But these issues make it hard to completely reply on Openhab especially when your not actually in the house, which is for me a big part of why I’m trying to use Openhab in the first place.

Any reccommendations to help me with these issues would be much appreciated. Thanks

Which version of OH are you using?

There is a known issue that mainly shows up with the phone apps but sometimes shows up in the web app where updates do not always get reflected in the UI without doing a refresh. Going into a frame and back or refreshing the page should load the current state. It is fixed in OH 2 but a fix for OH 1 is not going to happen.

Have you verified that the problem is indeed the UI or is OH showing the state as it knows it and it is OH itself that is behind?

Hi, Rich,

I’m using version 1.8, the problem I’m having doesn’t always seem to be solved by doing a refresh of the webapp. I currently have a switch on downstairs, but the webapp shows in off, even when I refresh, but eventually it does show up and on again, but this can be sometime later.

Can you explain where I can check the actual state in Openhab? rather than just the state showing in the webapp?

Will it be in the log file somewhere? Thanks

If you haven’t modified your logging settings there will be a log file called “events.log” (on Linux with apt-get install it is located in /var/log/openhab/event.log). Every update to every Item gets logged to this file.

If you have rules, add logging statements to your rules using logInfo(“Name”, “Statement”) where name is some name you can use to find it in the logs and “Statement” is something meaningful like "Entered rule foo and Item bar's state is " + bar.state.toString

Then when you switch something watch the log and see when the state of the switch gets updated in OH. I’m willing to bet the problem is that the message telling OH that the switch has been toggled is delayed.

I was able to turn on the DEBUG and found this in the log when I turn on the switch from within the webapp.

2016-02-01 21:09:45.105 [DEBUG] [.b.t.internal.TellstickBinding] - Got deviceEvent for TellstickDevice [deviceId=2, name=coffeeswitch, status=1, deviceType=1, data=null] name:TellstickDevice [deviceId=2, name=coffeeswitch, status=1, deviceType=1, data=null] method TURNON

But I have a feeling it’s something to do with this issue? https://github.com/openhab/openhab/issues/1596

In my case the switch is left in a long time, so whether that makes any difference I’m not quite sure