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)
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue