forked from Homegear/Homegear_PHP_XMLRPC_Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample.php
53 lines (52 loc) · 2.26 KB
/
Example.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
#!/usr/bin/env php
<?php
if(class_exists("Homegear\Homegear"))
{
/**** Use built-in script engine of Homegear 0.6 ****/
try
{
$hg = new \Homegear\Homegear();
print_r($hg->listDevices());
//$hg->setValue(19, 1, "VALVE_STATE", 0);
//print $hg->getValue(19, 1, "VALVE_STATE");
}
catch(\Homegear\HomegearException $e) {
print "Exception catched. Code: ".$e->getCode().". Message: ".$e->getMessage();
}
}
else if(function_exists("hg_invoke"))
{
/**** Use built-in script engine of Homegear 0.5 ****/
print_r(hg_invoke("listDevices"));
//hg_set_value(19, 1, "VALVE_STATE", 0);
//print hg_get_value(19, 1, "VALVE_STATE");
}
else
{
/**** Use TCP sockets to connect to Homegear ****/
include_once("Connect.php");
print_r($Client->send("listDevices", array()));
//print_r($Client->send("system.methodHelp", array("getLinks")));
//print_r($Client->send("getDeviceDescription", array(23, 1)));
//print_r($Client->send("getLinkInfo", array(23, 1, 37, 3)));
//print_r($Client->send("getMetadata", array("54:2")));
//print_r($Client->send("getParamset", array(12, -1, "MASTER")));
//print_r($Client->send("getParamset", array(23, 1, 37, 3)));
//print_r($Client->send("getParamsetDescription", array(23, 1, "LINK")));
//print_r($Client->send("getParamsetId", array(23, 1, 37, 3)));
//print_r($Client->send("getServiceMessages", array()));
//print_r($Client->send("getLinkPeers", array(27, 1)));
//print_r($Client->send("getLinks", array()));
//print_r($Client->send("getLinks", array(27, 1, 31)));
//print_r($Client->send("putParamset", array(54, 1, "MASTER", array("EVENT_DELAYTIME" => 0.0))));
//print_r($Client->send("putParamset", array(63, 18, "MASTER", array("MESSAGE_SHOW_TIME" => 0.0))));
//print_r($Client->send("setTeam", array(12, 1)));
//print_r($Client->send("setTeam", array(12, 1, 0x80000002, 1)));
//print_r($Client->send("setValue", array(15, 1, "ON_TIME", 787487.3)));
//print_r($Client->send("setValue", array(15, 1, "STATE", true)));
//print_r($Client->send("setValue", array(19, 1, "VALVE_STATE", 0)));
//print_r($Client->send("setValue", array(21, 2, "SETPOINT", 16.0)));
//print_r($Client->send("setValue", array(62, 18, "TEXT", "Hi")));
//print_r($Client->send("setValue", array(63, 18, "SUBMIT", true)));
}
?>