Subversion Repositories HomeAutomation

Rev

Rev 1610 | Rev 1626 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1610 Rev 1614
Line 18... Line 18...
18
            break;
18
            break;
19
        }
19
        }
20
    }
20
    }
21
   
21
   
22
    this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
22
    this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
23
}
-
 
24
 
-
 
25
function Dimmer230_complete(args)
-
 
26
{
-
 
27
    var result = new Array();
-
 
28
   
-
 
29
    var arg_index = args.length - 1;
-
 
30
   
-
 
31
    if (arg_index == 1) // id
-
 
32
    {
-
 
33
        result = Dimmer230.instance_.GetAvailableIds();
-
 
34
    }
-
 
35
    else if (arg_index == 2) // channel
-
 
36
    {
-
 
37
        result = [ 0 ];
-
 
38
    }
-
 
39
    else if (arg_index > 2)
-
 
40
    {
-
 
41
        if (args[0] == "Dimmer230_StartFade")
-
 
42
        {
-
 
43
            if (arg_index == 3) // speed
-
 
44
            {
-
 
45
                result = [ 50, 135, 200, 255 ];
-
 
46
            }
-
 
47
            else if (arg_index == 4) // direction
-
 
48
            {
-
 
49
                result = [ "Increase", "Decrease" ];
-
 
50
            }
-
 
51
        }
-
 
52
        else if (args[0] == "Dimmer230_AbsoluteFade")
-
 
53
        {
-
 
54
            if (arg_index == 3) // speed
-
 
55
            {
-
 
56
                result = [ 50, 135, 200, 255 ];
-
 
57
            }
-
 
58
            else if (arg_index == 4) // end_value
-
 
59
            {
-
 
60
                result = [ 0, 50, 100, 150, 200, 255 ];
-
 
61
            }
-
 
62
        }
-
 
63
        else if (args[0] == "Dimmer230_RelativeFade")
-
 
64
        {
-
 
65
            if (arg_index == 3) // speed
-
 
66
            {
-
 
67
                result = [ 50, 135, 200, 255 ];
-
 
68
            }
-
 
69
            else if (arg_index == 4) // direction
-
 
70
            {
-
 
71
                result = [ "Increase", "Decrease" ];
-
 
72
            }
-
 
73
            else if (arg_index == 5) // steps
-
 
74
            {
-
 
75
                result = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ];
-
 
76
            }
-
 
77
        }
-
 
78
        else if (args[0] == "Dimmer230_Demo")
-
 
79
        {
-
 
80
            if (arg_index == 3) // speed
-
 
81
            {
-
 
82
                result = [ 50, 135, 200, 255 ];
-
 
83
            }
-
 
84
            else if (arg_index == 4) // steps
-
 
85
            {
-
 
86
                result = [ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ];
-
 
87
            }
-
 
88
        }
-
 
89
    }
-
 
90
   
-
 
91
    return result;
-
 
92
}
23
}
93
 
24
 
94
function Dimmer230_StartFade(id, channel, speed, direction)
25
function Dimmer230_StartFade(id, channel, speed, direction)
95
{
26
{
96
    var variables = [
27
    var variables = [
Line 99... Line 30...
99
    { "Direction" : direction } ];
30
    { "Direction" : direction } ];
100
   
31
   
101
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Start_Fade", variables);
32
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Start_Fade", variables);
102
    return "OK";
33
    return "OK";
103
}
34
}
104
RegisterConsoleCommand(Dimmer230_StartFade, Dimmer230_complete);
35
RegisterConsoleCommand(Dimmer230_StartFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], [ 50, 135, 200, 255 ], [ "Increase", "Decrease" ]); });
105
 
36
 
106
 
37
 
107
function Dimmer230_StopFade(id, channel)
38
function Dimmer230_StopFade(id, channel)
108
{
39
{
109
    var variables = [
40
    var variables = [
110
    { "Channel"  : channel } ];
41
    { "Channel"  : channel } ];
111
   
42
   
112
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Stop_Fade", variables);
43
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Stop_Fade", variables);
113
    return "OK";
44
    return "OK";
114
}
45
}
115
RegisterConsoleCommand(Dimmer230_StopFade, Dimmer230_complete);
46
RegisterConsoleCommand(Dimmer230_StopFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ]); });
116
 
47
 
117
 
48
 
118
function Dimmer230_AbsoluteFade(id, channel, speed, end_value)
49
function Dimmer230_AbsoluteFade(id, channel, speed, end_value)
119
{
50
{
120
    var variables = [
51
    var variables = [
Line 123... Line 54...
123
    { "EndValue" : end_value } ];
54
    { "EndValue" : end_value } ];
124
   
55
   
125
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Abs_Fade", variables);
56
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Abs_Fade", variables);
126
    return "OK";
57
    return "OK";
127
}
58
}
128
RegisterConsoleCommand(Dimmer230_AbsoluteFade, Dimmer230_complete);
59
RegisterConsoleCommand(Dimmer230_AbsoluteFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], [ 50, 135, 200, 255 ], [ 0, 50, 100, 150, 200, 255 ]); });
129
 
60
 
130
 
61
 
131
function Dimmer230_RelativeFade(id, channel, speed, direction, steps)
62
function Dimmer230_RelativeFade(id, channel, speed, direction, steps)
132
{
63
{
133
    var variables = [
64
    var variables = [
Line 137... Line 68...
137
    { "Steps"     : steps } ];
68
    { "Steps"     : steps } ];
138
   
69
   
139
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Rel_Fade", variables);
70
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Rel_Fade", variables);
140
    return "OK";
71
    return "OK";
141
}
72
}
142
RegisterConsoleCommand(Dimmer230_RelativeFade, Dimmer230_complete);
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 ]); });
143
 
74
 
144
 
75
 
145
function Dimmer230_Demo(id, channel, speed, steps)
76
function Dimmer230_Demo(id, channel, speed, steps)
146
{
77
{
147
    var variables = [
78
    var variables = [
Line 150... Line 81...
150
    { "Steps"     : steps } ];
81
    { "Steps"     : steps } ];
151
   
82
   
152
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Demo", variables);
83
    Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Demo", variables);
153
    return "OK";
84
    return "OK";
154
}
85
}
155
RegisterConsoleCommand(Dimmer230_Demo, Dimmer230_complete);
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 ]); });