Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdavis90 committed Aug 19, 2023
1 parent a277b81 commit 558cbe6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 21 deletions.
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ export class Tado {
}

for (let overlay of overlays) {
const zone_capabilities = await this.getZoneCapabilities(home_id, overlay.zone_id)
const zone_capabilities = await this.getZoneCapabilities(
home_id,
overlay.zone_id
)

const overlay_config: any = {
overlay: {
Expand Down Expand Up @@ -569,11 +572,13 @@ export class Tado {
})

if (overlay['fanLevel']) {
if (zone_capabilities.type == "AIR_CONDITIONING") {
if (zone_capabilities.type == 'AIR_CONDITIONING') {
if (zone_capabilities.AUTO.fanLevel !== undefined) {
overlay_config.overlay.setting.fanLevel = overlay.fanLevel.toUpperCase()
overlay_config.overlay.setting.fanLevel =
overlay.fanLevel.toUpperCase()
} else {
overlay_config.overlay.setting.fanSpeed = overlay.fanLevel.toUpperCase()
overlay_config.overlay.setting.fanSpeed =
overlay.fanLevel.toUpperCase()
}
}
}
Expand Down
27 changes: 23 additions & 4 deletions src/types/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,34 @@ export type Feature =
| 'ROOMS_AND_DEVICES_SETTING_AS_WEBVIEW'
| 'SMART_SCHEDULE_AS_WEBVIEW'

export type FanLevel = 'LEVEL1' | 'LEVEL2' | 'LEVEL3' | 'LEVEL4' | 'AUTO' | 'SILENT'
export type FanLevel =
| 'LEVEL1'
| 'LEVEL2'
| 'LEVEL3'
| 'LEVEL4'
| 'AUTO'
| 'SILENT'

export type FanSpeed = 'HIGH' | 'MIDDLE' | 'LOW' | 'AUTO'

export type ACMode = 'COOL' | 'HEAT' | 'DRY' | 'FAN' | 'AUTO'

export type ACVerticalSwing = 'ON' | 'MID' | 'AUTO' | 'UP' | 'DOWN' | 'MID_UP' | 'MID_DOWN'

export type ACHorizontalSwing = 'RIGHT' | 'MID' | 'LEFT' | 'ON' | 'MID_RIGHT' | 'MID_LEFT'
export type ACVerticalSwing =
| 'ON'
| 'MID'
| 'AUTO'
| 'UP'
| 'DOWN'
| 'MID_UP'
| 'MID_DOWN'

export type ACHorizontalSwing =
| 'RIGHT'
| 'MID'
| 'LEFT'
| 'ON'
| 'MID_RIGHT'
| 'MID_LEFT'

export type Termination = 'AUTO' | 'NEXT_TIME_BLOCK' | 'MANUAL'

Expand Down
29 changes: 16 additions & 13 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,27 +437,30 @@ export type StepTemperature = {
}

export type ZoneCapabilitiesAC = {
fanLevel: FanLevel,
fanLevel: FanLevel
temperatures?: ZoneCapabilitiesTemperatures
verticalSwing: ACVerticalSwing,
horizontalSwing: ACHorizontalSwing,
verticalSwing: ACVerticalSwing
horizontalSwing: ACHorizontalSwing
}

export type ZoneCapabilitiesTemperatures = {
celsius: StepTemperature
fahrenheit: StepTemperature
}

export type ZoneCapabilities = {
type: 'HEATING'
temperatures: ZoneCapabilitiesTemperatures
} | {
type: 'AIR_CONDITIONING'
} & {
[key in ACMode]: ZoneCapabilitiesAC
} | {
type: 'HOT_WATER'
}
export type ZoneCapabilities =
| {
type: 'HEATING'
temperatures: ZoneCapabilitiesTemperatures
}
| ({
type: 'AIR_CONDITIONING'
} & {
[key in ACMode]: ZoneCapabilitiesAC
})
| {
type: 'HOT_WATER'
}

export type AwayConfiguration = {
type: ZoneType
Expand Down

0 comments on commit 558cbe6

Please sign in to comment.