-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublic_functions.php
48 lines (42 loc) · 1.25 KB
/
public_functions.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
<?
private function CreateCategoryByIdent($id, $ident, $name)
{
$cid = @IPS_GetObjectIDByIdent($this->maskUmlaute($ident), $id);
if($cid === false)
{
$cid = IPS_CreateCategory();
IPS_SetParent($cid, $id);
IPS_SetName($cid, $name);
IPS_SetIdent($cid, $this->maskUmlaute($ident));
}
return $cid;
}
private function CreateVariableByIdent($id, $ident, $name, $value, $type, $profile = "")
{
$vid = @IPS_GetObjectIDByIdent($this->maskUmlaute($ident), $id);
if($vid === false)
{
$vid = IPS_CreateVariable($type);
IPS_SetParent($vid, $id);
IPS_SetName($vid, $name);
IPS_SetIdent($vid, $this->maskUmlaute($ident));
if($profile != "")
IPS_SetVariableCustomProfile($vid, $profile);
}
SetValue($vid,$value);
// IPS_LogMessage('NETATMO',$name .": " . $value);
return $vid;
}
private function CreateInstanceByIdent($id, $ident, $name, $moduleid = "{24B57877-C24C-4690-8421-B41DCC22BE1B}")
{
$iid = @IPS_GetObjectIDByIdent($this->maskUmlaute($ident), $id);
if($iid === false)
{
$iid = IPS_CreateInstance($moduleid);
IPS_SetParent($iid, $id);
IPS_SetName($iid, $name);
IPS_SetIdent($iid, $this->maskUmlaute($ident));
}
return $iid;
}
?>