[daikin] Fix changing specialmode from ECO to NORMAL (#13230)

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
jimtng 2022-08-08 16:47:05 +10:00 committed by GitHub
parent 0e3a9f3c7e
commit e916974e38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -137,14 +137,18 @@ public class DaikinWebTargets {
return EnergyInfoDayAndWeek.parse(response);
}
public void setSpecialMode(SpecialMode specialMode) throws DaikinCommunicationException {
public void setSpecialMode(SpecialMode newMode) throws DaikinCommunicationException {
Map<String, String> queryParams = new HashMap<>();
if (specialMode == SpecialMode.NORMAL) {
if (newMode == SpecialMode.NORMAL) {
queryParams.put("set_spmode", "0");
queryParams.put("spmode_kind", "1");
ControlInfo controlInfo = getControlInfo();
if (!controlInfo.advancedMode.isUndefined()) {
queryParams.put("spmode_kind", controlInfo.getSpecialMode().getValue());
}
} else {
queryParams.put("set_spmode", "1");
queryParams.put("spmode_kind", Integer.toString(specialMode.getValue()));
queryParams.put("spmode_kind", newMode.getValue());
}
String response = invoke(setSpecialModeUri, queryParams);
if (!response.contains("ret=OK")) {

View File

@ -181,17 +181,17 @@ public class Enums {
}
public enum SpecialMode {
NORMAL(0),
POWERFUL(1),
ECO(2);
NORMAL("0"),
POWERFUL("1"),
ECO("2");
private final int value;
private final String value;
SpecialMode(int value) {
SpecialMode(String value) {
this.value = value;
}
public int getValue() {
public String getValue() {
return value;
}