Logic Machine Forum
Screensaver based on group object state - 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: Screensaver based on group object state (/showthread.php?tid=2012)



Screensaver based on group object state - Thomas - 08.04.2019

Hi
I'd like to start screensaver (dim after xx minutes) when night is active only. It would be nice to have it room specific but one general GO applied for whole visu is good enough.
Is it possible?
Thank you


RE: Screensaver based on group object state - admin - 08.04.2019

Add this to Custom JavaScript, change 32/1/7 to night mode object address.

Code:
if (typeof setVisDim === 'function') {
  var oldfn = setVisDim, night;
  
  setVisDim = function() {
    // console.log('setVisDim', night);
    if (night) {
      oldfn();
    }
  }
  
  $(function() {
    grp.listen('32/1/7', function(obj) {
      night = obj.value;
      // console.log('night', night);
    });
  });
}



RE: Screensaver based on group object state - Thomas - 09.04.2019

Thank you. It does almost what I want. But it doesn't stop the actually running screensaver (dimming). Can I stop it somehow when '32/1/7' gets FALSE?


RE: Screensaver based on group object state - admin - 09.04.2019

Code:
$(function() {
  grp.listen('32/1/7', function(obj) {
    night = obj.value;
    if (!night) {
      $E.modalBg.addClass('hide');
    }
  });
});