Skip to content

Commit

Permalink
Pretty, update deps, build JS
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdavis90 committed Oct 23, 2023
1 parent 14b32b1 commit 13df568
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 154 deletions.
1 change: 1 addition & 0 deletions build/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export declare class Tado {
getAirComfortDetailed(home_id: number): Promise<AirComfortDetailed>;
getEnergyIQ(home_id: number): Promise<EnergyIQ>;
getEnergyIQTariff(home_id: number): Promise<EnergyIQTariff>;
addEnergyIQTariff(home_id: number, unit: IQUnit, startDate: string, endDate: string, tariffInCents: number): Promise<unknown>;
updateEnergyIQTariff(home_id: number, tariff_id: string, unit: IQUnit, tariffInCents: number): Promise<unknown>;
getEnergyIQMeterReadings(home_id: number): Promise<EnergyIQMeterReadings>;
/**
Expand Down
11 changes: 11 additions & 0 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,17 @@ class Tado {
getEnergyIQTariff(home_id) {
return this.apiCall(`https://energy-insights.tado.com/api/homes/${home_id}/tariffs`);
}
addEnergyIQTariff(home_id, unit, startDate, endDate, tariffInCents) {
if (!['m3', 'kWh'].includes(unit)) {
throw new Error(`Invalid unit "${unit}" must be "m3", or "kWh"`);
}
return this.apiCall(`https://energy-insights.tado.com/api/homes/${home_id}/tariffs`, 'post', {
unit: unit,
startDate: startDate,
endDate: endDate,
tariffInCents: tariffInCents,
});
}
updateEnergyIQTariff(home_id, tariff_id, unit, tariffInCents) {
if (!['m3', 'kWh'].includes(unit)) {
throw new Error(`Invalid unit "${unit}" must be "m3", or "kWh"`);
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"name": "node-tado-client",
"version": "0.13.1",
"version": "0.13.2",
"description": "A Tado client for nodejs",
"main": "build/index.js",
"types": "build/index.d.ts",
"dependencies": {
"axios": "^1.4.0",
"axios": "^1.5.1",
"simple-oauth2": "^5.0.0"
},
"devDependencies": {
"@types/node": "^20.5.1",
"@types/simple-oauth2": "^5.0.4",
"chai": "^4.3.7",
"@types/node": "^20.8.7",
"@types/simple-oauth2": "^5.0.6",
"chai": "^4.3.10",
"mocha": "^10.2.0",
"nock": "^13.3.3",
"nock": "^13.3.6",
"nyc": "^15.1.0",
"prettier": "^3.0.2",
"typescript": "^5.1.6"
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"scripts": {
"build": "tsc",
Expand Down
Loading

0 comments on commit 13df568

Please sign in to comment.