Skip to content

Commit

Permalink
Switch setZoneOverlay to use ZoneCapabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdavis90 committed Oct 26, 2023
1 parent fd27283 commit 8821765
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-tado-client",
"version": "0.13.5",
"version": "0.13.6",
"description": "A Tado client for nodejs",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
12 changes: 6 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export class Tado {
console.warn(
'This method of setting zone overlays will soon be deprecated, please use setZoneOverlays'
)
const zone_state = await this.getZoneState(home_id, zone_id)
const zone_capabilities = await this.getZoneCapabilities(home_id, zone_id)

const config: {
setting: DeepPartial<TimeTableSettings> & {
Expand All @@ -405,7 +405,9 @@ export class Tado {
termination: any
type?: any
} = {
setting: zone_state.setting,
setting: {
type: zone_capabilities.type,
},
termination: {},
}

Expand All @@ -420,7 +422,7 @@ export class Tado {
config.setting.temperature = { celsius: temperature }
}

if (config.setting.type == 'AIR_CONDITIONING') {
if (zone_capabilities.type == 'AIR_CONDITIONING') {
if (ac_mode) {
config.setting.mode = ac_mode.toUpperCase()
}
Expand All @@ -434,7 +436,7 @@ export class Tado {
}

if (fan_speed) {
if (zone_state.setting['fanLevel']) {
if (zone_capabilities.FAN.fanLevel !== undefined) {
config.setting.fanLevel = fan_speed.toUpperCase()
} else {
config.setting.fanSpeed = fan_speed.toUpperCase()
Expand Down Expand Up @@ -462,8 +464,6 @@ export class Tado {
config.type = 'MANUAL'
config.termination.typeSkillBasedApp = 'MANUAL'
} else if (termination.toLowerCase() == 'auto') {
// Not sure how to test this is the web app
// But seems to by a combo of 'next_time_block' and geo
config.termination.type = 'TADO_MODE'
} else if (termination.toLowerCase() == 'next_time_block') {
config.type = 'MANUAL'
Expand Down

0 comments on commit 8821765

Please sign in to comment.