PHP code example of se / pilight

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

    

se / pilight example snippets




use \SE\Component\Pilight;



$sender =  new Pilight\Sender();
// or set a custom ip and port
$sender =  new Pilight\Sender($host = '129.168.2.1', $port = 6535);

$protocol = 'elro';
$arguments = array(
    's' => 31,
    'u' => 1,
);

$device = new Pilight\Device($protocol, $arguments);
// or add the arguments later via setArguments
$device->setArguments($arguments);

// turn it on
$device->addArgument('t');

// send it!
$sender->send($device);


$sender->setSudo(true);
$sender->send($device);