Subversion Repositories HomeAutomation

Rev

Rev 2058 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
2051 linlun 1
<?php
2060 linlun 2
require 'config.php';
2051 linlun 3
 
4
function GetLastData($alias2)
5
{
2060 linlun 6
  global $AtomURL;
7
  global $AtomPort;
8
 
2051 linlun 9
  $level2 = 0;
10
  $buffer = "";
11
  $result = array();
12
  try
13
  {
2060 linlun 14
    $socket = atomd_initialize($AtomURL, $AtomPort);
2051 linlun 15
    atomd_send_command($socket, "Module_GetLastDataRaw $alias2");
16
 
17
    $buffer = atomd_read_command_response($socket);
18
    $array = json_decode(trim($buffer), true);
19
  }
20
  catch (Exception $e)
21
  {
22
    die($e);
23
  }
24
  return $array["results"];
25
}
26
 
27
 
28
 
29
function SetDimmerValue($alias2, $level)
30
{
2060 linlun 31
  global $AtomURL;
32
  global $AtomPort;
33
 
2051 linlun 34
  $level2 = 0;
35
  $buffer = "";
36
 
37
  try
38
  {
2060 linlun 39
    $socket = atomd_initialize($AtomURL, $AtomPort);
2051 linlun 40
 
41
    atomd_send_command($socket, "Dimmer_AbsoluteFade $alias2 255 $level");
42
 
43
    $buffer = atomd_read_command_response($socket);
44
  }
45
  catch (Exception $e)
46
  {
47
    die($e);
48
  }
49
}
50
 
51
?>
52