-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.php
42 lines (33 loc) · 1.25 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
<?
class SingleIO extends IPSModule {
public function Create(){
//Never delete this line!
parent::Create();
//These lines are parsed on Symcon Startup or Instance creation
//You cannot use variables here. Just static values.
$this->RegisterPropertyInteger("OWDID", 1);
$this->RegisterVariableFloat("Eingang", "Eingang", "", 1);
$this->ConnectParent("{FCABCDA7-3A57-657D-95FD-9324738A77B9}"); //1Wire Controller
}
public function Destroy(){
//Never delete this line!
parent::Destroy();
}
public function ApplyChanges(){
//Never delete this line!
parent::ApplyChanges();
//Apply filter
$this->SetReceiveDataFilter(".*\"DeviceNumber\":". $this->ReadPropertyInteger("OWDID") .",.*");
}
public function ReceiveData($JSONString) {
$data = json_decode($JSONString);
$this->SendDebug("ESERA-SingleIO", "DataPoint:" . $data->DataPoint . " | Value: " . $data->Value, 0);
if ($this->ReadPropertyInteger("OWDID") == $data->DeviceNumber) {
if ($data->DataPoint == 1) {
$value = $data->Value / 100;
SetValue($this->GetIDForIdent("Eingang"), $value);
}
}
}
}
?>