Skip to content

Commit b949a23

Browse files
committed
1st Version with updated OAuth2 device_code grant (RFC8628) - needed since March 2025
updated OAuth2-Client needed - see Pullrequest: thephpleague/oauth2-client#1065
1 parent a0cdfde commit b949a23

File tree

3 files changed

+154
-95
lines changed

3 files changed

+154
-95
lines changed

README.md

+36-32
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PHP and Laravel library for managing Tado system
77
[![Total Downloads](https://img.shields.io/packagist/dt/robertogallea/restado.svg?style=flat-square)](https://packagist.org/packages/robertogallea/restado)
88

99

10-
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.
10+
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.
1111

1212
The package is also integrated within Laravel.
1313

@@ -20,74 +20,78 @@ Since the API is currently officially undocumented, if you are aware of methods
2020
4. [Usage](#4-usage)
2121
5. [Supported Methods](#5-supported-methods)
2222
6. [Issues, Questions and Pull Requests](#6-issues-questions-and-pull-requests)
23-
23+
2424
## 1. Installation
25-
25+
2626
1. Require the package using composer:
27-
27+
2828
```
2929
composer require robertogallea/restado
3030
```
31-
31+
3232
2. Add the service provider to the `providers` in `config/app.php`:
3333
3434
> Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider
3535
3636
```php
3737
Robertogallea\Restado\RestadoServiceProvider::class,
38-
```
39-
38+
```
39+
4040
3. Add the alias to the `aliases` in `config/app.php`:
41-
41+
4242
```php
43-
'Restado' => Robertogallea\Restado\Facades\Restado::class,
43+
'Restado' => Robertogallea\Restado\Facades\Restado::class,
4444
```
45-
45+
4646
4. Add the following variables to your .env file
4747
```php
48-
TADO_CLIENT_ID=<TADO_APP_ID> // defaults to public-api-preview
49-
TADO_SECRET=<TADO_APP_SECRET_KEY> // defaults to 4HJGRffVR8xb3XdEUQpjgZ1VplJi6Xgw
50-
TADO_USER=<TADO_USER>
51-
TADO_PASS=<TADO_PASSWORD>
52-
TADO_HOME_ID=<TADO_HOME_ID>
48+
TADO_CLIENT_ID=<TADO_APP_ID> // defaults to 1bb50063-6b0c-4d11-bd99-387f4a91cc46
5349
```
54-
55-
50+
51+
5652
## 2. Updating
5753
5854
1. To update this package, update the composer package:
5955
6056
```php
6157
composer update robertogallea/restado
62-
```
63-
58+
```
59+
6460
## 3. Configuration
65-
61+
6662
1. To use Restado, no further configuration is required. However, if you wish to tweak with config, publish the relative
6763
configuration file using the command
6864
6965
```php
7066
php artisan vendor:publish --provider="Robertogallea\Restado\RestadoServiceProvider" --tag=config
7167
```
72-
73-
## 4. Usage
74-
To use this package you should use the method of the Restado facade.
7568

76-
1. Obtain a valid token for your session:
69+
## 4. Usage
70+
To use this package you should use the method of the Restado facade.
71+
72+
1. Get the verification Data according to RFC8628 (device_code):
73+
74+
```php
75+
$verificationData = Restado::getVerificationUrl();
76+
```
77+
78+
2. Call the verification_uri_complete URL from $verificationData with a browser any complete the verfication process.
79+
80+
3. Obtain a valid token for your session with device_code given in $verificationData in Step 1:
7781

7882
```php
79-
$access_token = Restado::authorize();
80-
```
81-
82-
2. Use a method to get the related information, for example:
83-
83+
$access_token = Restado::authorize(['device_code' => $verificationData['device_code']]);
84+
```
85+
86+
4. Use a method to get the related information, for example:
87+
8488
```php
8589
$me = Restado::me($access_token);
86-
```
87-
90+
```
91+
8892
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/
8993

90-
94+
9195
## 5. Supported Methods
9296
Currently these methods are supported:
9397

0 commit comments

Comments
 (0)