Skip to content

Commit

Permalink
Merge pull request #101 from mattdavis90/flow-optimization
Browse files Browse the repository at this point in the history
feat: add flow temperature optimization to TadoX
  • Loading branch information
mattdavis90 authored Dec 5, 2024
2 parents f8e2fb8 + 0cb6453 commit 2dc589a
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/tadox.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
ActionableDevice,
FlowTemperatureOptimization,
Power,
XFeatures,
XHomeSummary,
Expand Down Expand Up @@ -261,4 +262,59 @@ export class TadoX extends BaseTado {
);
return response.isDomesticHotWaterCapable;
}

/**
* Get the Flow Temperature Optimization settings.
*
* @param home_id - The unique identifier of the home.
* @returns Flow Temperature Optimization settings.
*/
async getFlowTemperatureOptimization(home_id: number): Promise<FlowTemperatureOptimization> {
return this.apiCallX(
`https://hops.tado.com/homes/${home_id}/settings/flowTemperatureOptimization`,
);
}

/**
* Enable Flow Temperature Optimization settings.
*
* @param home_id - The unique identifier of the home.
* @returns if changed.
*/
async enableFlowTemperatureOptimization(home_id: number): Promise<string> {
return this.apiCallX(
`https://hops.tado.com/homes/${home_id}/settings/flowTemperatureOptimization`,
"patch",
{ autoAdaptation: { enabled: true } },
);
}

/**
* Disable Flow Temperature Optimization settings.
*
* @param home_id - The unique identifier of the home.
* @returns if changed.
*/
async disableFlowTemperatureOptimization(home_id: number): Promise<string> {
return this.apiCallX(
`https://hops.tado.com/homes/${home_id}/settings/flowTemperatureOptimization`,
"patch",
{ autoAdaptation: { enabled: false } },
);
}

/**
* Set the Flow Temperature Optimization max temperature.
*
* @param home_id - The unique identifier of the home.
* @param temperature - The max. temperature.
* @returns if changed.
*/
async setFlowTemperatureOptimization(home_id: number, temperature: number): Promise<string> {
return this.apiCallX(
`https://hops.tado.com/homes/${home_id}/settings/flowTemperatureOptimization`,
"patch",
{ maxFlowTemperature: temperature },
);
}
}
14 changes: 14 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1096,3 +1096,17 @@ export type XHomeSummary = {
isHeatPumpInstalled: boolean;
supportsFlowTemperatureOptimization: boolean;
};

export type FlowTemperatureOptimization = {
maxFlowTemperature: number;
maxFlowTemperatureConstraints: {
min: number;
max: number;
};
openThermDeviceSerialNumber: string;
hasMultipleBoilerControlDevices: boolean;
autoAdaptation: {
enabled: boolean;
maxFlowTemperature: number;
};
};

0 comments on commit 2dc589a

Please sign in to comment.