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.

Lost object changes - workaround?
#6
Hi Thomas,

Use this as framework, the rest is up to you (;

You have 4 object listeners now in this framework that respond on KNX values.

Code:
<!DOCTYPE html">
<head>
 <title>homeLYnk by Schneider Electric</title>
 <style type="text/css">
   body {
     background-color: transparent;
   }
 </style>
</head>
<body>
<script type="text/javascript">
 // ***** Make link to parent from iframe *****
 var p = window.parent, root, addr;
 if (p && p.objectStore){
 
   // Add event listeners on KNX addresses

   addr1 = p.Scada.encodeGroupAddress('1/1/1');    
   p.objectStore.addListener(addr1, function(obj, type) {
     // to avoid (re)trigger on opening page */
     if (type == 'init') {
        return;
       // Or do your JavaScript actions on received value on page load
     } else {
       // Do your JavaScript actions on new received value
     }
   });

   addr2 = p.Scada.encodeGroupAddress('1/1/2');    
   p.objectStore.addListener(addr2, function(obj, type) {
     // to avoid (re)trigger on opening page */
     if (type == 'init') {
        return;
       // Or do your JavaScript actions on received value on page load
     } else {
       // Do your JavaScript actions on new received value
     }
   });

   addr3 = p.Scada.encodeGroupAddress('1/1/3');    
   p.objectStore.addListener(addr3, function(obj, type) {
     // to avoid (re)trigger on opening page */
     if (type == 'init') {
        return;
       // Or do your JavaScript actions on received value on page load
     } else {
       // Do your JavaScript actions on new received value
     }
   });

   addr4 = p.Scada.encodeGroupAddress('1/1/4');    
   p.objectStore.addListener(addr4, function(obj, type) {
     // to avoid (re)trigger on opening page */
     if (type == 'init') {
        return;
       // Or do your JavaScript actions on received value on page load
     } else {
       // Do your JavaScript actions on new received value
     }
   });
    }
</script>
</body>
</html>

If you look in custom javascript section you can find a newer version of the object listener (something like grp.listen), but this one i had copy-paste ready (;

BR,

Erwin
Reply


Messages In This Thread
Lost object changes - workaround? - by Thomas - 24.10.2016, 19:09
RE: Lost object changes - workaround? - by Erwin van der Zwart - 25.10.2016, 13:27

Forum Jump: