Logic Machine Forum
Direct Input +/- Custom min max value - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Direct Input +/- Custom min max value (/showthread.php?tid=2555)



Direct Input +/- Custom min max value - Maxence - 31.03.2020

Hi all,

I have setpoint in inline mode like attachement. 
It's possible to customize with Custom Javascript minimum and maximum value according to an object KNX ?

I explain :
This is setpoint temperature. 
In winter, this setpoint is 21°C with offset +/-3°C (so minimum value 18 <> 24 maximum value).
In summer, this setpoint is different, (25°C) so the minimum and maximum value are not the same).
Moreover, the customer want to modifiy this offset.. So I have one virtual object for minimum value and one other for maximum value.


BR.
Maxence.


RE: Direct Input +/- Custom min max value - admin - 31.03.2020

Use this Custom JS, change addresses and additional class (setpoint in this example) as needed. Note that it will only work when "show control" is enabled.
Code:
$(function() {
  if (typeof grp != 'object') {
    return;
  }

  var minobj = '32/1/5';
  var maxobj = '32/1/6';
  var el = $('.setpoint').find('.control-spinner');

  function setminmax() {
    var min = grp.getvalue(minobj);
    var max = grp.getvalue(maxobj);
    el.spinner('setoptions', min, max);
  }  

  grp.listen(minobj, setminmax);
  grp.listen(maxobj, setminmax);
});



RE: Direct Input +/- Custom min max value - Maxence - 31.03.2020

Thank you for your help !

It's perfect !!


RE: Direct Input +/- Custom min max value - Maxence - 05.07.2021

(31.03.2020, 14:33)admin Wrote: Use this Custom JS, change addresses and additional class (setpoint in this example) as needed. Note that it will only work when "show control" is enabled.
Code:
$(function() {
  if (typeof grp != 'object') {
    return;
  }

  var minobj = '32/1/5';
  var maxobj = '32/1/6';
  var el = $('.setpoint').find('.control-spinner');

  function setminmax() {
    var min = grp.getvalue(minobj);
    var max = grp.getvalue(maxobj);
    el.spinner('setoptions', min, max);
  } 

  grp.listen(minobj, setminmax);
  grp.listen(maxobj, setminmax);
});


Hi, 
This custom JS work fine but i have one problem. 
When i set a object with this additionnal class, i can't change setpoint by 0,5 step. Only one by one.
I modifiy this JS for add one decimal, but i can't find parametre for change this step..

Any ideas ?

Thanks.
BR
Maxence


RE: Direct Input +/- Custom min max value - admin - 06.07.2021

Try this:
Code:
el.spinner('setoptions', min, max, 1, null, 0.5);
3rd parameter is a number of decimals, 4th parameter is zero-padding which is not needed, 5th parameter is step size