PHP code example of shadowroot2 / gree_ac

1. Go to this page and download the library: Download shadowroot2/gree_ac library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shadowroot2 / gree_ac example snippets



  e = new \Gree\GreeAC();
  $gree->setDebug(true); // If you want to see all
  
  print_r($gree->scan());

Array
(
    [t] => dev
    [cid] => f4211ede6d31
    [bc] => gree
    [brand] => gree
    [catalog] => gree
    [mac] => f4211ede6d31
    [mid] => 10002
    [model] => gree
    [name] => 1ede6d31
    [series] => gree
    [vender] => 1
    [ver] => V1.1.13
    [lock] => 0
)


  e = new \Gree\GreeAC(); 
  $gree->setDebug(true); // If you want to see all
  $gree->setCID('f4211ede6d31'); // Replace to your own cid
  
  $key = $gree->getBindKey();
  
  echo 'Secure key is: '.$key;

    $gree = new \Gree\GreeAC('192.168.10.3', 'f4211ede6d31', 'Lz5Op8Rs2Uv4Xy5A'); // Replace values to yours
  $gree->setDebug(true); // If you want to see all
  
  print_r($gree->status()); // Will show current settings
  print_r($gree->on()); // Switch on AC
  sleep(3);
  print_r($gree->off()); // Switch off AC
  // ...etc