mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 00:20:26 +00:00
Fixing items 4beta2.2
This commit is contained in:
@@ -8,8 +8,6 @@ import org.slf4j.LoggerFactory;
|
||||
import com.bwssystems.HABridge.BridgeSettingsDescriptor;
|
||||
import com.bwssystems.HABridge.Home;
|
||||
import com.bwssystems.HABridge.api.CallItem;
|
||||
import com.bwssystems.HABridge.api.hue.DeviceState;
|
||||
import com.bwssystems.HABridge.api.hue.StateChangeBody;
|
||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||
@@ -23,33 +21,18 @@ public class CommandHome implements Home {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int iterationCount,
|
||||
DeviceState state, StateChangeBody theStateChanges, boolean stateHasBri, boolean stateHasBriInc, DeviceDescriptor device, String body) {
|
||||
log.debug("Exec Request called with url: " + anItem.getItem().toString());
|
||||
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int itensity, Integer targetBri, Integer targetBriInc, DeviceDescriptor device, String body) {
|
||||
log.debug("Exec Request called with url: " + anItem.getItem().getAsString());
|
||||
String responseString = null;
|
||||
String intermediate;
|
||||
if (anItem.getItem().toString().contains("exec://"))
|
||||
intermediate = anItem.getItem().toString().substring(anItem.getItem().toString().indexOf("://") + 3);
|
||||
intermediate = anItem.getItem().getAsString().substring(anItem.getItem().toString().indexOf("://") + 3);
|
||||
else
|
||||
intermediate = anItem.getItem().toString();
|
||||
for (int x = 0; x < aMultiUtil.getSetCount(); x++) {
|
||||
if (x > 0 || iterationCount > 0) {
|
||||
try {
|
||||
Thread.sleep(aMultiUtil.getTheDelay());
|
||||
} catch (InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (anItem.getDelay() != null && anItem.getDelay() > 0)
|
||||
aMultiUtil.setTheDelay(anItem.getDelay());
|
||||
else
|
||||
aMultiUtil.setTheDelay(aMultiUtil.getDelayDefault());
|
||||
String anError = doExecRequest(intermediate,
|
||||
BrightnessDecode.calculateIntensity(state, theStateChanges, stateHasBri, stateHasBriInc), lightId);
|
||||
if (anError != null) {
|
||||
responseString = anError;
|
||||
x = aMultiUtil.getSetCount();
|
||||
}
|
||||
intermediate = anItem.getItem().getAsString();
|
||||
String anError = doExecRequest(intermediate,
|
||||
BrightnessDecode.calculateIntensity(itensity, targetBri, targetBriInc), lightId);
|
||||
if (anError != null) {
|
||||
responseString = anError;
|
||||
}
|
||||
return responseString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user