[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(); response = request.send();
return response.getContentAsString(); return response.getContentAsString();
} catch (InterruptedException | TimeoutException | ExecutionException e) { } catch (InterruptedException | TimeoutException | ExecutionException e) {
logger.warn("Error opening connecton to {} : {} ", touchWandIpAddr, e.getMessage()); logger.warn("Error opening connection to {} : {} ", touchWandIpAddr, e.getMessage());
} }
return ""; return "";
} }

View File

@ -58,28 +58,34 @@ public class TouchWandThermostatHandler extends TouchWandBaseUnitHandler {
if (touchWandBridgeHandler != null) { if (touchWandBridgeHandler != null) {
if (command instanceof OnOffType) { if (command instanceof OnOffType) {
touchWandBridgeHandler.touchWandClient.cmdThermostatOnOff(unitId, (OnOffType) command); touchWandBridgeHandler.touchWandClient.cmdThermostatOnOff(unitId, (OnOffType) command);
} else { return;
String sCommand = command.toString(); }
switch (sCommand) { if (command instanceof QuantityType) {
case "cool": final QuantityType<?> value = ((QuantityType<?>) command).toUnit(SIUnits.CELSIUS);
case "heat": String targetTemperature = String.valueOf(value.intValue());
case "fan": touchWandBridgeHandler.touchWandClient.cmdThermostatTargetTemperature(unitId, targetTemperature);
case "auto": return;
case "dry": }
touchWandBridgeHandler.touchWandClient.cmdThermostatMode(unitId, sCommand);
break; String sCommand = command.toString();
case "low": switch (sCommand) {
case "medium": case "cool":
case "high": case "heat":
touchWandBridgeHandler.touchWandClient.cmdThermostatFanLevel(unitId, sCommand); case "fan":
break; case "auto":
case "fanAuto": case "dry":
touchWandBridgeHandler.touchWandClient.cmdThermostatFanLevel(unitId, "auto"); touchWandBridgeHandler.touchWandClient.cmdThermostatMode(unitId, sCommand);
break; break;
default: case "low":
touchWandBridgeHandler.touchWandClient.cmdThermostatTargetTemperature(unitId, sCommand); case "medium":
break; case "high":
} touchWandBridgeHandler.touchWandClient.cmdThermostatFanLevel(unitId, sCommand);
break;
case "fanAuto":
touchWandBridgeHandler.touchWandClient.cmdThermostatFanLevel(unitId, "auto");
break;
default:
break;
} }
} }
} }

View File

@ -156,7 +156,7 @@ public class TouchWandWebSockets {
} }
touchWandUnit = TouchWandUnitFromJson.parseResponse(unitObj.get("unit").getAsJsonObject()); touchWandUnit = TouchWandUnitFromJson.parseResponse(unitObj.get("unit").getAsJsonObject());
if (!touchWandUnit.getStatus().equals("ALIVE")) { 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()); boolean supportedUnitType = Arrays.asList(SUPPORTED_TOUCHWAND_TYPES).contains(touchWandUnit.getType());
if (!supportedUnitType) { if (!supportedUnitType) {