This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Force reload?
#1
Hi
Is it possible somehow to force a client to reload the visualisation page(s) after I make a change?

Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#2
Hi,

Yes that is possible by custom javascript.

You need a event listener on a KNX object and a function to reload the client ( location.reload(); )

There is just 1 but... The client has to load the custom javascript first, so you have to reload them once after adding this, from then you can always force a client reload with your KNX object.

Can you do this or do i need to create a sample? (done this already on project so i must have it already somewhere)

BR,

Erwin
Reply
#3
May you please provide me a sample?

Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#4
Hi Thomas,

Try this as custom JavaScript:

Code:
$(function(){
 if (typeof grp != 'undefined') {
   grp.listen('1/1/1', function(object, state) {
     var value = object.value;
     if (state == 'value') {
       if (value == 1) {
         location.reload();
         grp.update('1/1/1', false);
       }
     }
   }, true);
 }
});

When writing value true to '1/1/1' (bit object) the client will reply with value false to confirm that the location.reload()  has been triggered.

BR,

Erwin
Reply
#5
Perfect. It works like a charm on both visualisations.
Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#6
Hi
I've found a problem. This script crashes LM. In my case everytime. I don't know if it depends on number of clients or size of the visu. Would it be possible to add some random delay for better load balancing?
Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#7
Hi,

This function runs client side and does nothing special other then refreshing the browser, same as pressing F5. When you press F5 on the client, do you see same issue? Are there errors in the browser console?

BR,

Erwin
Reply
#8
How many active clients do you have?
Reply
#9
Hi,

If you have a lot of clients you could add a random delay to divide all request to the controller at once by using this:

Code:
$(function(){
if (typeof grp != 'undefined') {
  grp.listen('1/1/1', function(object, state) {
    var value = object.value;
    if (state == 'value') {
      if (value == 1) {
        var x = Math.floor((Math.random() * 10000) + 1);
        setTimeout(function(){
           location.reload();
        }, x);
        grp.update('1/1/1', false);
      }
    }
  }, true);
}
});
BR,

Erwin
Reply


Forum Jump: