robertogallea/restado
Composer 安装命令:
composer require robertogallea/restado
包简介
Client for Tado REST API
README 文档
README
PHP and Laravel library for managing Tado system
This package provides a simple interface towards the public Tado Thermostat System API. It wraps the web methods available for authenticating users and retrieve information from the local devices.
The package is also integrated within Laravel.
Since the API is currently officially undocumented, if you are aware of methods missing in this library, please inform me!
1. Installation
-
Require the package using composer:
composer require robertogallea/restado -
Add the service provider to the
providersinconfig/app.php:Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider
Robertogallea\Restado\RestadoServiceProvider::class,
-
Add the alias to the
aliasesinconfig/app.php:'Restado' => Robertogallea\Restado\Facades\Restado::class,
-
Add the following variables to your .env file
TADO_CLIENT_ID=<TADO_APP_ID> // defaults to 1bb50063-6b0c-4d11-bd99-387f4a91cc46
2. Updating
-
To update this package, update the composer package:
composer update robertogallea/restado
3. Configuration
- To use Restado, no further configuration is required. However, if you wish to tweak with config, publish the relative configuration file using the command
php artisan vendor:publish --provider="Robertogallea\Restado\RestadoServiceProvider" --tag=config
4. Usage
To use this package you should use the method of the Restado facade.
-
Get the verification Data according to RFC8628 (device_code):
$verificationData = Restado::getVerificationUrl();
-
Call the verification_uri_complete URL from $verificationData with a browser any complete the verfication process.
-
Obtain a valid token for your session with device_code given in $verificationData in Step 1:
$access_token = Restado::authorize(['device_code' => $verificationData['device_code']]);
-
Use a method to get the related information, for example:
$me = Restado::me($access_token);
each method returns an object containing the data from the server. Currently the API is not officially documented, the only reference I found is at this page: http://blog.scphillips.com/posts/2017/01/the-tado-api-v2/
5. Supported Methods
Currently these methods are supported:
Authorisation
- authorize();
- me($access_token);
Home and device data
- getHome($access_token);
- setHome($access_token, $settings);
- getHomeWeather($access_token);
- getHomeDevices($access_token);
- getHomeInstallations($access_token);
- getHomeUsers($access_token);
- setDazzle($access_token, $zone_id, $setting);
Mobile devices
- getHomeMobileDevices($access_token);
- deleteHomeMobileDevice(token, $mobile_device_id);
- getHomeMobileDeviceSettings($access_token, $mobile_device_id);
- setHomeMobileDeviceSettings($access_token, $mobile_device_id, $settings);
- identifyDevice($access_token, $device_id);
- getAppUsersRelativePositions($access_token);
Home zones
- getHomeZones($access_token);
- getHomeZoneState($access_token, $zone_id);
- getHomeZoneStates($access_token, $home_id);
- getHomeZoneDayReport($access_token, $zone_id, $date);
- getHomeZoneCapabilities($access_token, $zone_id);
- getHomeZoneEarlyStart($access_token, $zone_id);
- setHomeZoneEarlyStart($access_token, $zone_id, $settings);
- getHomeZoneOverlay($access_token, $zone_id);
- setHomeZoneOverlay($access_token, $zone_id, $settings);
- deleteHomeZoneOverlay($access_token, $zone_id);
- getHomeZoneScheduleActiveTimetable($access_token, $zone_id);
- setHomeZoneScheduleActiveTimetable($access_token, $zone_id, $settings);
- getHomeZoneScheduleAway($access_token, $zone_id);
- setHomeZoneScheduleAway($access_token, $zone_id, $settings);
- getHomeZoneScheduleTimetableBlocks($access_token, $zone_id, $timetable_id, $pattern=null);
- setHomeZoneScheduleTimetableBlocks($access_token, $zone_id, $timetable_id, $pattern, $settings);
Temperature offset
- getTemperatureOffset($access_token, $device_id);
- setTemperatureOffset($access_token, $device_id, $settings);
Open window detection
- setOpenWindowDetection($access_token, $zone_id, $settings);
Presence detection
- isAnyoneAtHome($access_token);
- getPresenceLock($access_token);
- setPresenceLock($access_token, $settings);
Energy IQ & savings reports
- deleteEnergyIQMeterReading($access_token, $reading_id);
- addEnergyIQMeterReading($access_token, $settings);
- updateEnergyIQTariff($access_token, $settings);
- getEnergyIQMeterReadings($access_token);
- getEnergyIQTariff($access_token);
- getEnergyIQ($access_token);
- getEnergySavingsReport($access_token, $year, $month, $country_code);
To request an energy savings report via getEnergySavingsReport, you're required to pass a three-letter country code in accordance with ISO 3166-1 alpha-3
6. Issues, Questions and Pull Requests
You can report issues and ask questions in the issues section. Please start your issue with ISSUE: and your question with QUESTION:
If you have a question, check the closed issues first.
To submit a Pull Request, please fork this repository, create a new branch and commit your new/updated code in there. Then open a Pull Request from your new branch. Refer to this guide for more info.
robertogallea/restado 适用场景与选型建议
robertogallea/restado 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 142 次下载、GitHub Stars 达 15, 最近一次更新时间为 2017 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 robertogallea/restado 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 robertogallea/restado 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 142
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2017-08-30