add new device param for on with dim and changed behavior for onFirstDim

This commit is contained in:
BWS Systems
2018-11-13 14:09:53 -06:00
parent 3f13e957ad
commit 750056df06
4 changed files with 27 additions and 1 deletions

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId>
<version>5.2.1c</version>
<version>5.2.1d</version>
<packaging>jar</packaging>
<name>HA Bridge</name>

View File

@@ -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;

View File

@@ -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 {

View File

@@ -94,6 +94,12 @@
ng-model="device.offState" ng-true-value=true
ng-false-value=false> {{device.offState}}</td>
</tr>
<tr>
<td><label>On when Dim is present (Always uses on with a dim request otherwise it will ignore a given on was well. This is overidden by onFirstDim.)</label></td>
<td><input type="checkbox"
ng-model="device.onWhenDimPresent" ng-true-value=true
ng-false-value=false> {{device.onWhenDimPresent}}</td>
</tr>
<tr>
<td><label>On with First Dim (If the device is not on in the ha-bridge state, it will send on instead of the dim.)</label></td>
<td><input type="checkbox"