mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-22 09:22:23 +00:00
add new device param for on with dim and changed behavior for onFirstDim
This commit is contained in:
@@ -83,6 +83,9 @@ public class DeviceDescriptor{
|
||||
@SerializedName("onFirstDim")
|
||||
@Expose
|
||||
private boolean onFirstDim;
|
||||
@SerializedName("onWhenDimPresent")
|
||||
@Expose
|
||||
private boolean onWhenDimPresent;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@@ -286,6 +289,14 @@ public class DeviceDescriptor{
|
||||
this.onFirstDim = onFirstDim;
|
||||
}
|
||||
|
||||
public boolean isOnWhenDimPresent() {
|
||||
return onWhenDimPresent;
|
||||
}
|
||||
|
||||
public void setOnWhenDimPresent(boolean onWhenDimPresent) {
|
||||
this.onWhenDimPresent = onWhenDimPresent;
|
||||
}
|
||||
|
||||
public boolean containsType(String aType) {
|
||||
if(aType == null)
|
||||
return false;
|
||||
|
||||
@@ -1186,13 +1186,22 @@ public class HueMulator {
|
||||
isOnRequest = true;
|
||||
}
|
||||
|
||||
if(!device.isOnFirstDim() && device.isOnWhenDimPresent() && isDimRequest) {
|
||||
isOnRequest = true;
|
||||
theStateChanges.setOn(true);
|
||||
} else if(!device.isOnFirstDim() && !device.isOnWhenDimPresent() && isDimRequest) {
|
||||
isOnRequest = false;
|
||||
}
|
||||
|
||||
if(device.isOnFirstDim() && isDimRequest && !device.getDeviceState().isOn()) {
|
||||
isOnRequest = true;
|
||||
theStateChanges.setOn(true);
|
||||
isDimRequest = false;
|
||||
isColorRequest = false;
|
||||
} else if(device.isOnFirstDim() && isDimRequest && device.getDeviceState().isOn()) {
|
||||
if(device.getDeviceState().getBri() == theStateChanges.getBri()) {
|
||||
isOnRequest = true;
|
||||
theStateChanges.setOn(true);
|
||||
isDimRequest = false;
|
||||
isColorRequest = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user