Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions bundles/org.openhab.binding.tado/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ The binding will automatically discover this thing and place it in the Inbox.
It must be authenticated before it will actually go online.
Authenticatation is done online via the OAuth Device Code Grant Flow (RFC-8628) authentication process via the link provided at `http://[openhab-ip-address]:8080/tado`.

| Parameter | Optional | Description |
|---------------|----------|-------------------------------------------------------------------------------|
| `rfcWithUser` | yes | Determines if the user name is included in the oAuth RFC-8628 authentication. |
| `username` | yes | Selects the tado° account to be used if there is more than one account. |
| `homeId` | yes | Selects the Home Id to use in case of more than one home per account. |
| Parameter | Optional | Description | Default |
|---------------|----------|-------------------------------------------------------------------------------|---------|
| `rfcWithUser` | yes | Determines if the user name is included in the oAuth RFC-8628 authentication. | |
| `tadoApiUrl` | no | Selects the URL to be used for API calls (it's possible to use a proxy) |`https://my.tado.com/api/v2`|
| `username` | yes | Selects the tado° account to be used if there is more than one account. | |
| `homeId` | yes | Selects the Home Id to use in case of more than one home per account. | |

The `rfcWithUser` and `username` settings are only needed if you have more than one tado° account.
The `rfcWithUser` setting makes the binding use a different authentication token for each respective account `username`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
@NonNullByDefault
public class HomeApiFactory {

public HomeApi create(OAuthClientService oAuthClientService) {
public HomeApi create(OAuthClientService oAuthClientService, String baseUrl) {
Gson gson = GsonBuilderFactory.defaultGsonBuilder().create();
OAuthorizerV2 authorizer = new OAuthorizerV2(oAuthClientService);
return new HomeApi(gson, authorizer);
return new HomeApi(gson, authorizer, authorizer, baseUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ public class TadoHomeConfig {
public @Nullable String username;
public @Nullable Boolean rfcWithUser;
public @Nullable Integer homeId;
public String tadoApiUrl = "https://my.tado.com/api/v2";
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void initialize() {

OAuthClientService oAuthClientService = tadoHandlerFactory.subscribeOAuthClientService(this, user);
oAuthClientService.addAccessTokenRefreshListener(this);
this.api = new HomeApiFactory().create(oAuthClientService);
this.api = new HomeApiFactory().create(oAuthClientService, configuration.tadoApiUrl);
this.oAuthClientService = oAuthClientService;
logger.trace("initialize() api v2 created");
confPendingText = CONF_PENDING_OAUTH_CREDS.formatted(TadoAuthenticationServlet.PATH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@
public class HomeApi {
private static final HttpClient CLIENT = new HttpClient(new SslContextFactory.Client());

private String baseUrl = "https://my.tado.com/api/v2";
private String baseUrl;
private int timeout = 5000;

private Gson gson;
private OAuthorizerV2 authorizer;

public HomeApi(Gson gson, OAuthorizerV2 authorizer) {
public HomeApi(Gson gson, OAuthorizerV2 authorizer, String baseUrl) {
this.gson = gson;
this.authorizer = authorizer;
this.baseUrl = baseUrl;
}

public void deleteZoneOverlay(Long homeId, Long zoneId) throws IOException, ApiException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ thing-type.config.tado.home.homeId.label = Home Id
thing-type.config.tado.home.homeId.description = Selects the Home Id to be used if there is more than one home per account.
thing-type.config.tado.home.rfcWithUser.label = RFC-8628 with User
thing-type.config.tado.home.rfcWithUser.description = Determines if the user name is included in the oAuth RFC-8628 authentication
thing-type.config.tado.home.tadoApiUrl.label = Selects the URL to be used for API calls (it's possible to use a proxy)
thing-type.config.tado.home.tadoApiUrl.description = The base URL used for all API requests. Can be changed to use a proxy.
thing-type.config.tado.home.username.label = User Name
thing-type.config.tado.home.username.description = Selects the tado° account to be used if there is more than one account.
thing-type.config.tado.mobiledevice.id.label = Mobile Device Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
<advanced>true</advanced>
</parameter>

<parameter name="username" type="text" required="false">
<parameter name="tadoApiUrl" type="text" required="true">
<label>API Base URL</label>
<description>he base URL used for all API requests. Can be changed to use a proxy.</description>
<default>https://my.tado.com/api/v2</default>
<advanced>true</advanced>
</parameter>

<parameter name="username" type="text" required="false">
<label>User Name</label>
<description>Selects the tado° account to be used if there is more than one account.</description>
<advanced>true</advanced>
Expand Down
Loading