dam2k / tadoapi
TadoApi是一个非官方的TADO (tm) SDK PHP实现(只提供只读方法)
1.0.1
2024-07-06 21:55 UTC
Requires
- firebase/php-jwt: ^6.8
- league/oauth2-client: ^2.7
README
TadoApi是一个非官方的TADO (tm) SDK PHP实现。我将其实现为度量值导出器,但你可以更改恒温器或空调的温度,例如,通过使用setZoneOverlay()方法写入覆盖层和设置数据
$tado->setZoneOverlay("", "8", '{"type":"MANUAL","setting":{"type":"AIR_CONDITIONING","power":"ON","mode":"COOL","temperature":{"celsius":25},"fanLevel":"LEVEL2","verticalSwing":"OFF"}}');
对我有效,也许这也适合你。像任何其他开源软件一样,作者不能保证任何保修。
安装
composer require dam2k/tadoapi
公共方法
以下给出了实现和导出的公共方法。它们是自解释的。
对我来说,getHomeMetrics()是最有用的,因为它聚合了一些有用的信息,如果你需要度量值导出器。它将获取你所有区域的所有细节和状态以及所有设备
温度、湿度、电池、固件版本、序列号、型号等,都在一个json文件中。
public function getMe(): \stdClass
public function getHome(string $homeId = ""): \stdClass
public function getWeather(string $homeId = ""): \stdClass
public function getDevices(string $homeId = ""): array
public function getInstallations(string $homeId = ""): array
public function getUsers(string $homeId = ""): array
public function getMobiles(string $homeId = ""): array
public function getMobileSettings(string $homeId = "", string $deviceId): \stdClass
public function getZones(string $homeId = ""): array
public function getZoneStates(string $homeId = ""): \stdClass
public function getZoneState(string $homeId = "", string $zoneId): \stdClass
public function getZoneCapabilities(string $homeId = "", string $zoneId): \stdClass
public function getZoneEarlyStart(string $homeId = "", string $zoneId): \stdClass
public function getZoneOverlay(string $homeId = "", string $zoneId): \stdClass
public function getZoneScheduleActiveTimetable(string $homeId = "", string $zoneId): \stdClass
public function getZoneScheduleAway(string $homeId = "", string $zoneId): \stdClass
public function identifyDevice(string $homeId = "", string $deviceId): \stdClass
public function getTemperatureOffset(string $homeId = "", string $deviceId): \stdClass
public function getHomeState(string $homeId = ""): \stdClass
public function isAnyoneAtHome(string $homeId = ""): bool
public function getHomeMetrics(string $homeId = ""): \stdClass
public function setZoneOverlay(string $homeId = "", string $zoneId, string $data): \stdClass
使用示例
use dAm2K\TadoApi;
require "vendor/autoload.php";
$tadoconf = [
// Tado client ID and secret from https://my.tado.com/webapp/env.js
'tado.clientId' => 'tado-web-app',
'tado.clientSecret' => 'taG9tXxzGrIFWixUT1nZnzIjlovENGe0KNAB51ADKZQjSlNBvhs0xbT6tC4jIUaC',
'tado.username' => 'yourtadoemail@email.com',
'tado.password' => 'yourtadopassporcoziochenotiziamacomelhamessadentroguarda',
// your home's ID
'tado.homeid' => '36389',
// we put access token here. When the AT expires a new one get collected and saved here
'statefile' => '/tmp/dam2ktado_aeSh8aem.txt'
];
$tado = new TadoApi($tadoconf);
$o = $tado->getHomeMetrics();
print_r(json_encode($o));
无官方支持
TADO (tm) 以任何方式都不支持其公共API。我从TADO知识库的公开帖子中获取API方法。还要感谢这篇帖子:https://shkspr.mobi/blog/2019/02/tado-api-guide-updated-for-2019/ 和 https://blog.scphillips.com/posts/2017/01/the-tado-api-v2/