binarybucks / homA

An extensible framework for the smart home
Eclipse Public License 1.0
137 stars 25 forks source link

Web interface has trouble keeping track with PUB #113

Closed jpmens closed 11 years ago

jpmens commented 11 years ago

This may be related to #112, but maybe it's a different problem. Oh, and if you prefer I go do something else, I will, of course ...

I have a Python program which uses Mosquitto to publish the value of an electricity meter to homA every 10 seconds.

I notice that the Web interface stops updating for a bit:

jmbp-628

This is a mosquitto_sub showing the chronology of the updates:

jmbp-629

Both screen shots were taken within a second or two of eachother, and clearly demonstrate that the Web control lags pretty much behind.

Refreshing the Web browser makes it catch up, and waiting for some period of time, maybe a minute or so, does the same.

FWIW, this occurs on Chrome and Safari.

binarybucks commented 11 years ago

Mhh, this is odd. I've an ambilight that continously publishes color values while fading and never experienced this kind of behaviour. The only thing that I currently could think of is: Do you still have the debug logging enabled (local storage > logging = 1?). If so, this might slow down things quite a bit as it will be printing lots of messages.

jpmens commented 11 years ago

Logging was disabled.

I've enabled it now, to see if I detect anything...

jpmens commented 11 years ago

No change:

jmbp-630

I've watched it for three cycles now, and the pattern is similar: when the widget stops updating, 8 and 16 PUBs are skipped, then the Web interface disconnects/reconnects, whereupon the cycle begins anew.

binarybucks commented 11 years ago

To me this sounds like a bug in the Paho library. The "received" output is directly printed in a callback from the Paho library, so it seems that Paho messes up while receiving the message. The disconnects further point at Paho.

I'll write some code to reproduce this. You're publishing the new values every 10 seconds?

jpmens commented 11 years ago

10 seconds, yes.

binarybucks commented 11 years ago

Ok, happens to me too. It just completely stops receiving messages after 80 seconds

binarybucks commented 11 years ago

It was indeed related to the Paho timeout issue. I've added a 10 seconds timer that publishes a ping to $SYS/keepalive where the Android app also sends pings to (what is it with the Paho libraries and all those timeout issues?).

That should fix it for now, until the Paho guys get their ping handling right.

jpmens commented 11 years ago

Uncaught SyntaxError: Unexpected identifier app.js:397

jpmens commented 11 years ago

Better ;)