Fixing after comments
This commit is contained in:
parent
27eb11e5df
commit
af739a3b66
1 changed files with 4 additions and 9 deletions
|
@ -43,8 +43,9 @@ public class TriggerAutosensValue extends Trigger {
|
||||||
|
|
||||||
private TriggerAutosensValue(TriggerAutosensValue triggerAutosensValue) {
|
private TriggerAutosensValue(TriggerAutosensValue triggerAutosensValue) {
|
||||||
super();
|
super();
|
||||||
value = triggerAutosensValue.value;
|
value = new InputDouble(triggerAutosensValue.value);
|
||||||
lastRun = triggerAutosensValue.lastRun;
|
lastRun = triggerAutosensValue.lastRun;
|
||||||
|
comparator = new Comparator(triggerAutosensValue.comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getValue() {
|
public double getValue() {
|
||||||
|
@ -67,12 +68,6 @@ public class TriggerAutosensValue extends Trigger {
|
||||||
if (lastRun > DateUtil.now() - T.mins(5).msecs())
|
if (lastRun > DateUtil.now() - T.mins(5).msecs())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (autosensData.autosensResult.ratio != 0 && comparator.getValue() == Comparator.Compare.IS_NOT_AVAILABLE) {
|
|
||||||
if (L.isEnabled(L.AUTOMATION))
|
|
||||||
log.debug("Ready for execution: " + friendlyDescription());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean doRun = comparator.getValue().check((autosensData.autosensResult.ratio), (double) (getValue() / 100d));
|
boolean doRun = comparator.getValue().check((autosensData.autosensResult.ratio), (double) (getValue() / 100d));
|
||||||
if (doRun) {
|
if (doRun) {
|
||||||
if (L.isEnabled(L.AUTOMATION))
|
if (L.isEnabled(L.AUTOMATION))
|
||||||
|
@ -102,7 +97,7 @@ public class TriggerAutosensValue extends Trigger {
|
||||||
Trigger fromJSON(String data) {
|
Trigger fromJSON(String data) {
|
||||||
try {
|
try {
|
||||||
JSONObject d = new JSONObject(data);
|
JSONObject d = new JSONObject(data);
|
||||||
value.setValue(JsonHelper.safeGetInt(d, "value"));
|
value.setValue(JsonHelper.safeGetDouble(d, "value"));
|
||||||
lastRun = JsonHelper.safeGetLong(d, "lastRun");
|
lastRun = JsonHelper.safeGetLong(d, "lastRun");
|
||||||
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
|
comparator.setValue(Comparator.Compare.valueOf(JsonHelper.safeGetString(d, "comparator")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in a new issue