guym4c/kasa-plug-client
Composer 安装命令:
composer require guym4c/kasa-plug-client
包简介
TP-Link Kasa API client
README 文档
README
A simple client for the TP-Link Kasa smart plugs.
Install
Via Composer:
composer install guym4c/kasa-plug-client
Usage
Get yourself an instance of the client, using your TP-Link Cloud login details (which you use to log in to the app).
$kasa = new \Guym4c\Kasa\Client(/* username */, /* password */);
As tokens for the unofficial Kasa API expire quite fast, the package takes your credentials and obtains a new token for you on every instantiation.
What you're here for
Turning plugs on and off is simple - you can retrieve a Plug using the $kasa->getPlug() method. Pass this method a string of the plug alias or plug ID (you can see the alias in the Kasa app, or get a list of your plugs using getPlugs()).
Then just call $plug->setState(bool) with true for on, and false for off. (You can get the current state of the plug's relay using the status property of each Plug).
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-21