Subversion Repositories HomeAutomation

Rev

Go to most recent revision | Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
1603 runge 1
 
2
function Dimmer230(name)
3
{
4
	this.Module(name);
1609 runge 5
	Dimmer230.instance_ = this;
1603 runge 6
}
7
 
8
Extend(Dimmer230, Module);
9
 
1609 runge 10
Dimmer230.instance_ = null;
1626 runge 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" ];
1609 runge 15
 
1603 runge 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
 
1610 runge 29
function Dimmer230_StartFade(id, channel, speed, direction)
1609 runge 30
{
1603 runge 31
	var variables = [
32
	{ "Channel"   : channel },
33
	{ "Speed"     : speed },
34
	{ "Direction" : direction } ];
35
 
1609 runge 36
	Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Start_Fade", variables);
37
	return "OK";
1603 runge 38
}
1626 runge 39
RegisterConsoleCommand(Dimmer230_StartFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], Dimmer230.standard_speeds_, Dimmer230.standard_direction_); });
1603 runge 40
 
1609 runge 41
 
1610 runge 42
function Dimmer230_StopFade(id, channel)
1603 runge 43
{
44
	var variables = [
45
	{ "Channel"  : channel } ];
46
 
1609 runge 47
	Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Stop_Fade", variables);
48
	return "OK";
1603 runge 49
}
1614 runge 50
RegisterConsoleCommand(Dimmer230_StopFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ]); });
1603 runge 51
 
1609 runge 52
 
1626 runge 53
function Dimmer230_AbsoluteFade(id, channel, speed, level)
1603 runge 54
{
55
	var variables = [
56
	{ "Channel"  : channel },
57
	{ "Speed"    : speed },
1626 runge 58
	{ "EndValue" : level } ];
1603 runge 59
 
1609 runge 60
	Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Abs_Fade", variables);
61
	return "OK";
1603 runge 62
}
1626 runge 63
RegisterConsoleCommand(Dimmer230_AbsoluteFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], Dimmer230.standard_speeds_, Dimmer230.standard_levels_); });
1603 runge 64
 
1609 runge 65
 
1610 runge 66
function Dimmer230_RelativeFade(id, channel, speed, direction, steps)
1603 runge 67
{
68
	var variables = [
69
	{ "Channel"   : channel },
70
	{ "Speed"     : speed },
71
	{ "Direction" : direction },
72
	{ "Steps"     : steps } ];
73
 
1609 runge 74
	Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Rel_Fade", variables);
75
	return "OK";
1603 runge 76
}
1626 runge 77
RegisterConsoleCommand(Dimmer230_RelativeFade, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], Dimmer230.standard_speeds_, Dimmer230.standard_direction_, Dimmer230.standard_steps_); });
1603 runge 78
 
1609 runge 79
 
1610 runge 80
function Dimmer230_Demo(id, channel, speed, steps)
1603 runge 81
{
82
	var variables = [
83
	{ "Channel"   : channel },
84
	{ "Speed"     : speed },
85
	{ "Steps"     : steps } ];
86
 
1609 runge 87
	Dimmer230.instance_.Module.prototype.SendMessage.call(Dimmer230.instance_, id, "Demo", variables);
88
	return "OK";
1603 runge 89
}
1626 runge 90
RegisterConsoleCommand(Dimmer230_Demo, function(args) { return StandardAutocomplete(args, Dimmer230.instance_.GetAvailableIds(), [ 0 ], Dimmer230.standard_speeds_, Dimmer230.standard_steps_); });