Merge branch 'thermostat-fix' into 'dev'
Thermostats fixed See merge request sa4-2020/the-sanmarinoes/backend!105
This commit is contained in:
commit
36dbb0dac9
3 changed files with 17 additions and 12 deletions
|
@ -28,11 +28,14 @@ public class ThermostatController {
|
||||||
newT.setId(t.getId());
|
newT.setId(t.getId());
|
||||||
newT.setName(t.getName());
|
newT.setName(t.getName());
|
||||||
newT.setRoomId(t.getRoomId());
|
newT.setRoomId(t.getRoomId());
|
||||||
newT.setMeasuredTemperature(t.getMeasuredTemperature());
|
|
||||||
newT.setUseExternalSensors(t.isUseExternalSensors());
|
newT.setUseExternalSensors(t.isUseExternalSensors());
|
||||||
newT.setOn(t.isTurnOn());
|
newT.setOn(false);
|
||||||
|
System.out.println(newT);
|
||||||
|
|
||||||
thermostatService.populateMeasuredTemperature(newT);
|
thermostatService.populateMeasuredTemperature(newT);
|
||||||
|
newT = thermostatRepository.save(newT);
|
||||||
|
|
||||||
|
newT.setOn(t.isTurnOn());
|
||||||
newT = deviceService.saveAsOwner(newT, principal.getName());
|
newT = deviceService.saveAsOwner(newT, principal.getName());
|
||||||
return newT;
|
return newT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,6 @@ public class ThermostatSaveRequest {
|
||||||
|
|
||||||
@NotNull private boolean useExternalSensors;
|
@NotNull private boolean useExternalSensors;
|
||||||
|
|
||||||
@NotNull private BigDecimal measuredTemperature;
|
|
||||||
|
|
||||||
/** State of this thermostat */
|
/** State of this thermostat */
|
||||||
@NotNull private boolean turnOn;
|
@NotNull private boolean turnOn;
|
||||||
|
|
||||||
|
@ -74,12 +72,4 @@ public class ThermostatSaveRequest {
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this.id = 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;
|
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) {
|
public void setMode(Mode state) {
|
||||||
this.mode = state;
|
this.mode = state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue