[touchwand] Fix thermostat target temperature command (#13427)

* Fix target temperature command 

1) Fix target temperature command 
2) fixed typo in log

* Allow update status even if the unit is not alive

Seems 'acwand' status is always "DOWN" so ignore this and just log debug

Signed-off-by: Roie Geron <roie.geron@gmail.com>
This commit is contained in:
Roie Geron 2022-09-25 11:25:10 +03:00 committed by GitHub
parent 80804a59b0
commit 96b77ed541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 24 deletions

View File

@ -230,7 +230,7 @@ public class TouchWandRestClient {
response = request.send();
return response.getContentAsString();
} catch (InterruptedException | TimeoutException | ExecutionException e) {
logger.warn("Error opening connecton to {} : {} ", touchWandIpAddr, e.getMessage());
logger.warn("Error opening connection to {} : {} ", touchWandIpAddr, e.getMessage());
}
return "";
}

View File

@ -58,7 +58,15 @@ public class TouchWandThermostatHandler extends TouchWandBaseUnitHandler {
if (touchWandBridgeHandler != null) {
if (command instanceof OnOffType) {
touchWandBridgeHandler.touchWandClient.cmdThermostatOnOff(unitId, (OnOffType) command);
} else {
return;
}
if (command instanceof QuantityType) {
final QuantityType<?> value = ((QuantityType<?>) command).toUnit(SIUnits.CELSIUS);
String targetTemperature = String.valueOf(value.intValue());
touchWandBridgeHandler.touchWandClient.cmdThermostatTargetTemperature(unitId, targetTemperature);
return;
}
String sCommand = command.toString();
switch (sCommand) {
case "cool":
@ -77,12 +85,10 @@ public class TouchWandThermostatHandler extends TouchWandBaseUnitHandler {
touchWandBridgeHandler.touchWandClient.cmdThermostatFanLevel(unitId, "auto");
break;
default:
touchWandBridgeHandler.touchWandClient.cmdThermostatTargetTemperature(unitId, sCommand);
break;
}
}
}
}
void updateThermostatState(TouchWandThermostatUnitData unitData) {
String state = unitData.getCurrStatus().getState();

View File

@ -156,7 +156,7 @@ public class TouchWandWebSockets {
}
touchWandUnit = TouchWandUnitFromJson.parseResponse(unitObj.get("unit").getAsJsonObject());
if (!touchWandUnit.getStatus().equals("ALIVE")) {
return;
logger.debug("UNIT_CHANGED unit status not ALIVE : {}", touchWandUnit.getStatus());
}
boolean supportedUnitType = Arrays.asList(SUPPORTED_TOUCHWAND_TYPES).contains(touchWandUnit.getType());
if (!supportedUnitType) {