fixed dimmable light

This commit is contained in:
Claudio Maggioni 2020-03-25 22:34:15 +01:00
parent 3518647eeb
commit c5996608a4

View file

@ -39,6 +39,10 @@ public class DimmableLight extends Switchable {
@Max(100)
private Integer intensity = 0;
@NotNull
@Column(nullable = false)
private Integer oldIntensity = 100;
public Integer getIntensity() {
return intensity;
}
@ -55,8 +59,10 @@ public class DimmableLight extends Switchable {
this.intensity = 0;
} else if (intensity > 100) {
this.intensity = 100;
this.oldIntensity = 100;
} else {
this.intensity = intensity;
this.oldIntensity = intensity;
}
}
@ -67,13 +73,13 @@ public class DimmableLight extends Switchable {
@Override
public void setOn(boolean on) {
intensity = on ? 100 : 0;
intensity = on ? oldIntensity : 0;
}
public void setDimmerId(Long dimmerId) {
this.dimmerId = dimmerId;
super.setSwitchId(null);
};
}
@Override
public void setSwitchId(Long switchId) {