a15lam/php-iot

用于控制家庭物联网设备的PHP库。

0.1.3 2017-07-02 04:46 UTC

This package is auto-updated.

Last update: 2024-08-29 04:31:13 UTC


README

PHP库,用于控制Wemo设备和Sonoff(带自定义固件),源代码可在此处找到。

当前支持...

  1. Wemo灯泡 - 开/关/调光/状态
  2. Wemo开关 - 开/关/状态
  3. Wemo插座 - 开/关/状态
  4. Wemo Insight开关 - 开/关/参数/状态
  5. Sonoff开关(自定义固件) - 开/关/状态
  6. 在Wemo桥下分组设备
  7. 设备发现

入门指南

git clone https://github.com/a15lam/php-iot.git
cd php-iot
composer install
php example/console.php   // An example command line app to control your wemo devices.

用法

$lightSwitch = \a15lam\PhpIot\Discovery::getDeviceByName('Bed Room Light'); // Use your wemo device name as they show on your wemo app. Supports grouped devices
$lightSwitch->On();
sleep(2); // Allow a moment to see the light turning on.
$lightSwitch->Off();
// Get switch status
echo $lightSwitch->status();

查看示例目录以获取更多用法。从命令行运行example/console.php以控制您的设备。