-
Notifications
You must be signed in to change notification settings - Fork 7
/
module.php
61 lines (42 loc) · 1.16 KB
/
module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?
class VariableAction extends IPSModule
{
public function ApplyChanges()
{
//Never delete this line!
parent::ApplyChanges();
//Lets register a variable with action
$this->RegisterVariableInteger("TestVariable", "Test", "~Intensity.100");
$this->EnableAction("TestVariable");
}
public function RequestAction($Ident, $Value)
{
switch($Ident) {
case "TestVariable":
$this->SetValue($Ident, $Value);
break;
default:
throw new Exception("Invalid ident");
}
}
public function PrintValue() {
echo $this->GetValue("TestVariable");
}
//Add this Polyfill for IP-Symcon 4.4 and older
protected function GetValue($Ident) {
if(IPS_GetKernelVersion() >= 5) {
return parent::GetValue($Ident);
} else {
return GetValue($this->GetIDForIdent($Ident));
}
}
//Add this Polyfill for IP-Symcon 4.4 and older
protected function SetValue($Ident, $Value) {
if(IPS_GetKernelVersion() >= 5) {
parent::SetValue($Ident, $Value);
} else {
SetValue($this->GetIDForIdent($Ident), $Value);
}
}
}
?>