PHP code example of giannisftaras / smartthings

1. Go to this page and download the library: Download giannisftaras/smartthings 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/ */

    

giannisftaras / smartthings example snippets



 martThings\SmartThingsAPI; 
      
 # Create a Personal Access Token and add it below
 $userBearerToken = '<<TOKEN>>';
 $smartAPI = new SmartThingsAPI($userBearerToken);
 $devices = $smartAPI->list_devices(); 
      
 $tv = $devices[0];
 $tv->power_on();
 $tv->volume(10);

$location = new SmartThings\Locations('<<LOCATION_ID>>');
$location->get_rooms();

$room = new SmartThings\Room('<<ROOM_ID>>');
$room->name();