Skip to content

Commit

Permalink
added AC turbo support
Browse files Browse the repository at this point in the history
  • Loading branch information
Binozo committed Aug 18, 2024
1 parent d581faa commit f0a09df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/ac/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,31 @@ func (a *AC) GetFanSwinging() (bool, error) {
return false, errors.New(fmt.Sprintf("dps index %s not contained in: %s", onDpsIndex, currentStatus))
}
}

func (a *AC) SetTurboMode(turbo bool) error {
if !a.IsConnected() {
if err := a.Connect(); err != nil {
return err
}
defer a.Disconnect()
}
return a.Set(map[string]interface{}{
onDpsIndex: true,
turboModeDpsIndex: turbo,
})
}

func (a *AC) GetIsTurboEnabled() (bool, error) {
if !a.IsConnected() {
if err := a.Connect(); err != nil {
return false, err
}
defer a.Disconnect()
}
currentStatus := a.GetCurrentStatus()
if turboValue, ok := currentStatus[turboModeDpsIndex]; ok {
return turboValue.(bool), nil
} else {
return false, errors.New(fmt.Sprintf("dps index %s not contained in: %s", onDpsIndex, currentStatus))
}
}
1 change: 1 addition & 0 deletions pkg/ac/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ package ac
const onDpsIndex = "1"
const temperatureDpsIndex = "2"
const fanIntensityDpsIndex = "5" // Ranges from 1 to 4
const turboModeDpsIndex = "102"
const fanSwingDpsIndex = "104"

0 comments on commit f0a09df

Please sign in to comment.