Subversion Repositories HomeAutomation

Rev

Rev 1610 | Blame | Last modification | View Log | SVN | RSS feed

  1.  
  2. function Dimmer230(name)
  3. {
  4.     this.Module(name);
  5.     Dimmer230.instance_ = this;
  6. }
  7.  
  8. Extend(Dimmer230, Module);
  9.  
  10. Dimmer230.instance_ = null;
  11.  
  12. Dimmer230.prototype.ReceiveMessage = function(id, command, variables)
  13. {
  14.     switch (command)
  15.     {
  16.         case "Netinfo":
  17.         {
  18.             break;
  19.         }
  20.     }
  21.    
  22.     this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
  23. }
  24.  
  25. function Dimmer230_StartFade(id, channel, speed, direction)
  26. {
  27.     var variables = [
  28.     { "Channel"   : channel },
  29.     { "Speed"     : speed },
  30.     { "Direction" : direction } ];
  31.    
  32.     Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Start_Fade", variables);
  33.     return "OK";
  34. }
  35. RegisterConsoleCommand(Dimmer230_StartFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], [ 50, 135, 200, 255 ], [ "Increase", "Decrease" ]); });
  36.  
  37.  
  38. function Dimmer230_StopFade(id, channel)
  39. {
  40.     var variables = [
  41.     { "Channel"  : channel } ];
  42.    
  43.     Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Stop_Fade", variables);
  44.     return "OK";
  45. }
  46. RegisterConsoleCommand(Dimmer230_StopFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ]); });
  47.  
  48.  
  49. function Dimmer230_AbsoluteFade(id, channel, speed, end_value)
  50. {
  51.     var variables = [
  52.     { "Channel"  : channel },
  53.     { "Speed"    : speed },
  54.     { "EndValue" : end_value } ];
  55.    
  56.     Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Abs_Fade", variables);
  57.     return "OK";
  58. }
  59. RegisterConsoleCommand(Dimmer230_AbsoluteFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], [ 50, 135, 200, 255 ], [ 0, 50, 100, 150, 200, 255 ]); });
  60.  
  61.  
  62. function Dimmer230_RelativeFade(id, channel, speed, direction, steps)
  63. {
  64.     var variables = [
  65.     { "Channel"   : channel },
  66.     { "Speed"     : speed },
  67.     { "Direction" : direction },
  68.     { "Steps"     : steps } ];
  69.    
  70.     Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Rel_Fade", variables);
  71.     return "OK";
  72. }
  73. RegisterConsoleCommand(Dimmer230_RelativeFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], [ 50, 135, 200, 255 ], [ "Increase", "Decrease" ], [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ]); });
  74.  
  75.  
  76. function Dimmer230_Demo(id, channel, speed, steps)
  77. {
  78.     var variables = [
  79.     { "Channel"   : channel },
  80.     { "Speed"     : speed },
  81.     { "Steps"     : steps } ];
  82.    
  83.     Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Demo", variables);
  84.     return "OK";
  85. }
  86. RegisterConsoleCommand(Dimmer230_Demo, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], [ 50, 135, 200, 255 ], [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ]); });
  87.