Subversion Repositories HomeAutomation

Rev

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