fixed dimmable light
This commit is contained in:
parent
3518647eeb
commit
c5996608a4
1 changed files with 8 additions and 2 deletions
|
@ -39,6 +39,10 @@ public class DimmableLight extends Switchable {
|
||||||
@Max(100)
|
@Max(100)
|
||||||
private Integer intensity = 0;
|
private Integer intensity = 0;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(nullable = false)
|
||||||
|
private Integer oldIntensity = 100;
|
||||||
|
|
||||||
public Integer getIntensity() {
|
public Integer getIntensity() {
|
||||||
return intensity;
|
return intensity;
|
||||||
}
|
}
|
||||||
|
@ -55,8 +59,10 @@ public class DimmableLight extends Switchable {
|
||||||
this.intensity = 0;
|
this.intensity = 0;
|
||||||
} else if (intensity > 100) {
|
} else if (intensity > 100) {
|
||||||
this.intensity = 100;
|
this.intensity = 100;
|
||||||
|
this.oldIntensity = 100;
|
||||||
} else {
|
} else {
|
||||||
this.intensity = intensity;
|
this.intensity = intensity;
|
||||||
|
this.oldIntensity = intensity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,13 +73,13 @@ public class DimmableLight extends Switchable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOn(boolean on) {
|
public void setOn(boolean on) {
|
||||||
intensity = on ? 100 : 0;
|
intensity = on ? oldIntensity : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDimmerId(Long dimmerId) {
|
public void setDimmerId(Long dimmerId) {
|
||||||
this.dimmerId = dimmerId;
|
this.dimmerId = dimmerId;
|
||||||
super.setSwitchId(null);
|
super.setSwitchId(null);
|
||||||
};
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSwitchId(Long switchId) {
|
public void setSwitchId(Long switchId) {
|
||||||
|
|
Loading…
Reference in a new issue