robertogallea / restado
Client for Tado REST API
Requires
- league/oauth2-client: ^2.2
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
providers
inconfig/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
aliases
inconfig/app.php
:'Restado' => Robertogallea\Restado\Facades\Restado::class,
-
Add the following variables to your .env file
TADO_CLIENT_ID=<TADO_APP_ID> // defaults to public-api-preview TADO_SECRET=<TADO_APP_SECRET_KEY> // defaults to 4HJGRffVR8xb3XdEUQpjgZ1VplJi6Xgw TADO_USER=<TADO_USER> TADO_PASS=<TADO_PASSWORD> TADO_HOME_ID=<TADO_HOME_ID>
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.
-
Obtain a valid token for your session:
$access_token = Restado::authorize();
-
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.