Logic Machine Forum
Custom Javascript function not working anymore with FW2020 - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Custom Javascript function not working anymore with FW2020 (/showthread.php?tid=3099)



Custom Javascript function not working anymore with FW2020 - hummelsystemhaus - 11.01.2021

Hi,

we recently updated some of our Controller from FW20180828 to the new "stable" 2020 version.
Now a bunch of our Custom JavaScript Functions for the Visu don't work anymore.
Is this due to Errors in the Code?

Code:
/*** RTR ***/
  $('.reve-rtr').each(function(index){
    /* data:
        object: Setpoint Adr
      statusObject: Is-Value Adr
        1) create new element for Setpoint
      2) add listener for Setpoint
    */
    var curEle = $(this);
    var knxAdr = curEle.data();
    var setPoint = grp.find(knxAdr.object);
    /* create new element */
    curEle.find('.control-button').append('<button class="btn control-value disabled">( S: ' + setPoint.value.toFixed(2) + setPoint.units + ' )</button>');
    /* listener for changed-Value */
    grp.listen(knxAdr.object, function(object, state){
      curEle.find('.control-button > button:last-child').html('( S: ' + object.value.toFixed(2) + object.units + ' )');
    }, true);
  });
 
  /*****************/
  /*** Jalousien ***/
  /* scale */
  $('.reve-jal').each(function(index){
    /* data:
        object: Lamelle Position Status Adr
      statusObject: Postion Status Adr
        1) create new element for Lamelle
      2) add listener for Lamelle
    */
    var curEle = $(this);
    var knxAdr = curEle.data();
    var lamPos = grp.find(knxAdr.object);
    /* create new element */
    curEle.find('.control-button').append('<button class="btn control-value disabled" style="padding:0px;">/</button>');
    curEle.find('.control-button').append('<button class="btn control-value disabled">' + lamPos.value + '%</button>');
    /* listener for changed-Value */
    grp.listen(knxAdr.object, function(object, state){
      curEle.find('.control-button > button:last-child').html(object.value + '%');
    }, true);
  });
  /* step */
  $('div').filter(function(){
    /* filter the onoff buttons */
    return this.className.match(/reve-jal-step/);
  }).each(function(index){
    /* data
        object: Move Adress
      statusObject: Stop Adress
    */
    var curEle = $(this);
    var knxAdr = curEle.data();
    var stepAdr = knxAdr.object;
    var stopAdr = knxAdr.statusObject;
    var controlEle = curEle.find('.control');
    var invert = $(this).hasClass('reve-jal-step-invert');
    /* add Buttons */
    controlEle.empty()
    var upEle = $('<button class="btn icon">&#x2191;</button>');
    var stopEle = $('<button class="btn icon btn-error">×</button>');
    var downEle = $('<button class="btn icon">&#x2193;</button>');
   
    controlEle.append(upEle);
    controlEle.append(stopEle);
    controlEle.append(downEle);
    /* add click events */
    upEle.click(function(){
      grp.write(stepAdr, invert);
    });
    stopEle.click(function(){
      grp.write(stopAdr, true);
    });
    downEle.click(function(){
      grp.write(stepAdr, !invert);
    });
  });
/*** On/Off Buttons ***/
  $('div').filter(function(){
    /* filter the onoff buttons */
    return this.className.match(/reve-onoff/);
  }).each(function(index){
    var curEle = $(this);
    var knxAdr = curEle.data();
    var useSecure = $(this).hasClass('reve-onoff-secure');
    /* clear normal button */
    curEle.find('.control').empty();
    /* create Buttons */
    var offBtn = $('<button class="btn icon">×</button>');
    var onBtn = $('<button class="btn icon btn-success">✓</button>');
    curEle.find('.control').append(offBtn);
    curEle.find('.control').append(onBtn);
    /* add listener */
    function cbOn(){
      grp.write(knxAdr.object, true);
    }
    function cbOff(){
      grp.write(knxAdr.object, false);
    }
    offBtn.click(function(){
      if(useSecure){
        showPincode(grp.getvalue(secureCodeAdr), {callback: cbOff});
      }
      else{
        cbOff();
      }
    });
    onBtn.click(function(){
      if(useSecure){
        showPincode(grp.getvalue(secureCodeAdr), {callback: cbOn});
      }
      else{
        cbOn();
      }
    });
  });



RE: Custom Javascript function not working anymore with FW2020 - admin - 11.01.2021

showPincode function has been changed. For security reasons PIN check has been moved to the server side so this function cannot be used to make custom PIN checks anymore.