Thermostats fixed
This commit is contained in:
parent
3d74e02434
commit
e0ab831be9
3 changed files with 17 additions and 12 deletions
|
@ -28,11 +28,14 @@ public class ThermostatController {
|
|||
newT.setId(t.getId());
|
||||
newT.setName(t.getName());
|
||||
newT.setRoomId(t.getRoomId());
|
||||
newT.setMeasuredTemperature(t.getMeasuredTemperature());
|
||||
newT.setUseExternalSensors(t.isUseExternalSensors());
|
||||
newT.setOn(t.isTurnOn());
|
||||
newT.setOn(false);
|
||||
System.out.println(newT);
|
||||
|
||||
thermostatService.populateMeasuredTemperature(newT);
|
||||
newT = thermostatRepository.save(newT);
|
||||
|
||||
newT.setOn(t.isTurnOn());
|
||||
newT = deviceService.saveAsOwner(newT, principal.getName());
|
||||
return newT;
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ public class ThermostatSaveRequest {
|
|||
|
||||
@NotNull private boolean useExternalSensors;
|
||||
|
||||
@NotNull private BigDecimal measuredTemperature;
|
||||
|
||||
/** State of this thermostat */
|
||||
@NotNull private boolean turnOn;
|
||||
|
||||
|
@ -74,12 +72,4 @@ public class ThermostatSaveRequest {
|
|||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public BigDecimal getMeasuredTemperature() {
|
||||
return measuredTemperature;
|
||||
}
|
||||
|
||||
public void setMeasuredTemperature(BigDecimal measuredTemperature) {
|
||||
this.measuredTemperature = measuredTemperature;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,18 @@ public class Thermostat extends Switchable implements BooleanTriggerable {
|
|||
this.mode = Mode.OFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("Thermostat{");
|
||||
sb.append("targetTemperature=").append(targetTemperature);
|
||||
sb.append(", internalSensorTemperature=").append(internalSensorTemperature);
|
||||
sb.append(", mode=").append(mode);
|
||||
sb.append(", measuredTemperature=").append(measuredTemperature);
|
||||
sb.append(", useExternalSensors=").append(useExternalSensors);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public void setMode(Mode state) {
|
||||
this.mode = state;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue