2017 © Pedro Peláez
 

library broadlink

PHP7 Broadlink API library

image

thephpguys/broadlink

PHP7 Broadlink API library

  • Saturday, April 21, 2018
  • by misterx
  • Repository
  • 3 Watchers
  • 7 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

Broadlink API PHP7 library

A PHP 7 library for controlling IR and Wireless 433Mhz controllers from Broadlink. The protocol refer to mjg59/python-broadlink, (*1)

Currently supported only RM Devices, (*2)

Discover all devices in network:, (*3)

use TPG\Broadlink\Device\AbstractDevice;
use TPG\Broadlink\Device\HasTemperatureSensorInterface;
use TPG\Broadlink\Device\RMDevice;

$devices = AbstractDevice::discover();
$response=[];
foreach ($devices as $device){

    $device->authenticate();

    $deviceResponse = [
        'model' => $device->getModel(),
        'name' => $device->getName(),
        'ip' => $device->getIP(),
        'mac' => $device->getMac(),
    ];

    if($device instanceof HasTemperatureSensorInterface){
        $deviceResponse['temperature'] = sprintf("%01.1f",$device->getTemperature());
    }

    $response[] = $deviceResponse;
}

echo json_encode($response);

Will produce:, (*4)

[
    {
        "model": "RM2 Pro Plus",
        "name": "Living Room",
        "ip": "192.168.88.15",
        "mac": "34:ea:cc:cc:cc:bc",
        "temperature": "22.0"
    },
    {
        "model": "RM2 Pro Plus",
        "name": "Sleeping Room",
        "ip": "192.168.88.14",
        "mac": "34:ea:cc:cc:cc:bf",
        "temperature": "21.7"
    }
]

Use already known device:, (*5)

use TPG\Broadlink\Device\RMDevice;

$device = new RMDevice('192.168.88.15','34:ea:cc:cc:cc:bc');
$device->authenticate();
echo $device->getTemperature();
use TPG\Broadlink\Cloud\Catalog;

$catalog = new Catalog('/path/where/you/want/to/save/remotes');
$remotes = $catalog->search('Samsung');

//Download first remote
print_r($remotes[0]->download());

//Or download all found remotes
foreach($remotes as $remote){
    $remote->download();
}

The Versions

21/04 2018

v2.0.0.x-dev

2.0.0.9999999-dev

PHP7 Broadlink API library

  Sources   Download

MIT

by Vadim Zotov

21/04 2018

v2.0

2.0.0.0

PHP7 Broadlink API library

  Sources   Download

MIT

by Vadim Zotov

19/04 2018

dev-master

9999999-dev

PHP7 Broadlink API library

  Sources   Download

MIT

by Vadim Zotov

19/04 2018

v1.0.0

1.0.0.0

PHP7 Broadlink API library

  Sources   Download

MIT

by Vadim Zotov