Subversion Repositories HomeAutomation

Rev

Rev 2058 | Blame | Last modification | View Log | SVN | RSS feed

  1. <?php
  2. require 'config.php';
  3.  
  4. function GetLastData($alias2)
  5. {
  6.   global $AtomURL;
  7.   global $AtomPort;
  8.  
  9.   $level2 = 0;
  10.   $buffer = "";
  11.   $result = array();
  12.   try
  13.   {
  14.     $socket = atomd_initialize($AtomURL, $AtomPort);
  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. {
  31.   global $AtomURL;
  32.   global $AtomPort;
  33.  
  34.   $level2 = 0;
  35.   $buffer = "";
  36.  
  37.   try
  38.   {
  39.     $socket = atomd_initialize($AtomURL, $AtomPort);
  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.  
  53.