Subversion Repositories HomeAutomation

Rev

Rev 1614 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

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