Skip to content

Commit

Permalink
[max] Fix inadvertently change automatic/manual mode openhab#4347 (op…
Browse files Browse the repository at this point in the history
…enhab#4755)

* Fix inadvertently change automatic/manual mode

Addresses issue Setting temperature can inadvertently change
automatic/manual mode

Fixes openhab#4347

Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv authored and cweitkamp committed Jan 30, 2019
1 parent e77b1ea commit 8f80805
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ThermostatModeType getMode() {
return this.mode;
}

void setMode(ThermostatModeType mode) {
public void setMode(ThermostatModeType mode) {
if (this.mode != mode) {
setUpdated(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,13 @@ private CubeCommand getCommand(SendCommand sendCommand) {
String commandContent = command.toString().trim().toUpperCase();
double setTemp = device.getTemperatureSetpoint();
if (commandContent.contentEquals(ThermostatModeType.AUTOMATIC.toString())) {
device.setMode(ThermostatModeType.AUTOMATIC);
return new SCommand(device.getRFAddress(), device.getRoomId(), ThermostatModeType.AUTOMATIC, 0D);
} else if (commandContent.contentEquals(ThermostatModeType.BOOST.toString())) {
device.setMode(ThermostatModeType.BOOST);
return new SCommand(device.getRFAddress(), device.getRoomId(), ThermostatModeType.BOOST, setTemp);
} else if (commandContent.contentEquals(ThermostatModeType.MANUAL.toString())) {
device.setMode(ThermostatModeType.MANUAL);
logger.debug("updates to MANUAL mode with temperature '{}'", setTemp);
return new SCommand(device.getRFAddress(), device.getRoomId(), ThermostatModeType.MANUAL, setTemp);
} else {
Expand Down

0 comments on commit 8f80805

Please sign in to comment.