mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 16:17:30 +00:00
Added device data value passing, off state change for brigthness, hex
intensity values, updatd ui to cgo back to device touched after edit/add.
This commit is contained in:
10
README.md
10
README.md
@@ -292,7 +292,7 @@ There is a new format for the on/dim/off URL areas. The new editor handles the i
|
|||||||
Here are the fields that can be put into the call item:
|
Here are the fields that can be put into the call item:
|
||||||
Json Type | field name | What | Use
|
Json Type | field name | What | Use
|
||||||
----------|------------|------|-----
|
----------|------------|------|-----
|
||||||
String or JsonElement | item| This is the payload that will be called for devices | Required
|
String or JsonElement | item | This is the payload that will be called for devices | Required
|
||||||
Integer | count | This is how many times this items will be executed | Optional
|
Integer | count | This is how many times this items will be executed | Optional
|
||||||
Integer | delay | This is how long we will wait until the next call after | Optional
|
Integer | delay | This is how long we will wait until the next call after | Optional
|
||||||
String | type | This is the type of device we are executing | Required
|
String | type | This is the type of device we are executing | Required
|
||||||
@@ -332,7 +332,7 @@ Headers can be added as well using a Json construct [{"name":"header type name",
|
|||||||
|
|
||||||
Another option that is detected by the bridge is to use UDP or TCP direct calls such as `udp://<ip_address>:<port>/<your stuff here>` to send a UDP request. TCP calls are handled the same way as `tcp://<ip_address>:<port>/<your stuff here>`. If your data for the UDP or TCP request is formatted as "0x00F009B9" lexical hex format, the bridge will convert the data into a binary stream to send.
|
Another option that is detected by the bridge is to use UDP or TCP direct calls such as `udp://<ip_address>:<port>/<your stuff here>` to send a UDP request. TCP calls are handled the same way as `tcp://<ip_address>:<port>/<your stuff here>`. If your data for the UDP or TCP request is formatted as "0x00F009B9" lexical hex format, the bridge will convert the data into a binary stream to send.
|
||||||
|
|
||||||
You can also use the value replacement constructs within these statements. Such as using the expressions "${time.format(Java time format string)}" for inserting a date/time stamp, ${intensity.percent} for 0-100 or ${intensity.decimal_percent} for 0.00-1.00 or ${intensity.byte} for 0-255 for straight pass through of the value or items that require special calculated values using ${intensity.math()} i.e. "${intensity.math(X/4)}". See Value Passing Controls Below.
|
You can also use the value replacement constructs within these statements. Such as using the expressions "${time.format(Java time format string)}" for inserting a date/time stamp, ${intensity.percent} or ${intensity.percent.hex} for 0-100 or ${intensity.decimal_percent} for 0.00-1.00 or ${intensity.byte} or ${intensity.byte.hex} for 0-255 for straight pass through of the value or items that require special calculated values using ${intensity.math()} i.e. "${intensity.math(X/4)}" or "${intensity.math(X/4).hex}". See Value Passing Controls Below.
|
||||||
Examples:
|
Examples:
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -382,9 +382,13 @@ In the URL areas, the format of the execution is just providing what command lin
|
|||||||
[{"item":"/home/pi/scripts/dothisscript.sh","type":"cmdDevice"}]
|
[{"item":"/home/pi/scripts/dothisscript.sh","type":"cmdDevice"}]
|
||||||
```
|
```
|
||||||
#### Value Passing Controls
|
#### Value Passing Controls
|
||||||
There are multiple replacement constructs available to be put into any of the calls except Harmony items, Net Items and HAL items. These constructs are: "${time.format(Java time format string)}", "${intensity.percent}", "${intensity.decimal_percent}", "${intensity.byte}" and "${intensity.math(using X in your calc)}".
|
There are multiple replacement constructs available to be put into any of the calls except Harmony items, Net Items and HAL items. These constructs are: "${time.format(Java time format string)}", "${intensity.percent}", "${intensity.percent.hex}", "${intensity.decimal_percent}", "${intensity.byte}", "${intensity.byte.hex}", "${intensity.math(using X in your calc)}" and "${intensity.math(using X in your calc).hex}".
|
||||||
|
|
||||||
You can control items that require special calculated values using ${intensity.math(<your expression using "X" as the value to operate on>)} i.e. "${intensity.math(X/4)}".
|
You can control items that require special calculated values using ${intensity.math(<your expression using "X" as the value to operate on>)} i.e. "${intensity.math(X/4)}".
|
||||||
|
|
||||||
For the items that want to have a date time put into the message, utilize ${time.format(yyyy-MM-ddTHH:mm:ssXXX)} where "yyyy-MM-ddTHH:mm:ssXXX" can be any format from the Java SimpleDateFormat documented here: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
|
For the items that want to have a date time put into the message, utilize ${time.format(yyyy-MM-ddTHH:mm:ssXXX)} where "yyyy-MM-ddTHH:mm:ssXXX" can be any format from the Java SimpleDateFormat documented here: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
|
||||||
|
|
||||||
|
Also, device data can be inserted into your payloads by the use of "${device.name}", "${device.id}", "${device.uniqueid}", "${device.targetDevice}", "${device.mapId}", "${device.mapType}" and "${device.deviceType}". These work just like the dimming value replacements.
|
||||||
e.g.
|
e.g.
|
||||||
```
|
```
|
||||||
[{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=10&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.math(X/4)}","type":"httpDevice"}]
|
[{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=10&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.math(X/4)}","type":"httpDevice"}]
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.bwssystems.HABridge</groupId>
|
<groupId>com.bwssystems.HABridge</groupId>
|
||||||
<artifactId>ha-bridge</artifactId>
|
<artifactId>ha-bridge</artifactId>
|
||||||
<version>4.2.1d</version>
|
<version>4.3.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -62,9 +62,18 @@ public class DeviceDescriptor{
|
|||||||
@SerializedName("noState")
|
@SerializedName("noState")
|
||||||
@Expose
|
@Expose
|
||||||
private boolean noState;
|
private boolean noState;
|
||||||
|
@SerializedName("offState")
|
||||||
|
@Expose
|
||||||
|
private boolean offState;
|
||||||
@SerializedName("requesterAddress")
|
@SerializedName("requesterAddress")
|
||||||
@Expose
|
@Expose
|
||||||
private String requesterAddress;
|
private String requesterAddress;
|
||||||
|
@SerializedName("description")
|
||||||
|
@Expose
|
||||||
|
private String description;
|
||||||
|
@SerializedName("comments")
|
||||||
|
@Expose
|
||||||
|
private String comments;
|
||||||
|
|
||||||
private DeviceState deviceState;
|
private DeviceState deviceState;
|
||||||
|
|
||||||
@@ -222,6 +231,14 @@ public class DeviceDescriptor{
|
|||||||
this.noState = noState;
|
this.noState = noState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isOffState() {
|
||||||
|
return offState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffState(boolean offState) {
|
||||||
|
this.offState = offState;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRequesterAddress() {
|
public String getRequesterAddress() {
|
||||||
return requesterAddress;
|
return requesterAddress;
|
||||||
}
|
}
|
||||||
@@ -230,6 +247,22 @@ public class DeviceDescriptor{
|
|||||||
this.requesterAddress = requesterAddress;
|
this.requesterAddress = requesterAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComments() {
|
||||||
|
return comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComments(String comments) {
|
||||||
|
this.comments = comments;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean containsType(String aType) {
|
public boolean containsType(String aType) {
|
||||||
if(aType == null)
|
if(aType == null)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ public class BrightnessDecode {
|
|||||||
private static final String INTENSITY_MATH = "${intensity.math(";
|
private static final String INTENSITY_MATH = "${intensity.math(";
|
||||||
private static final String INTENSITY_MATH_VALUE = "X";
|
private static final String INTENSITY_MATH_VALUE = "X";
|
||||||
private static final String INTENSITY_MATH_CLOSE = ")}";
|
private static final String INTENSITY_MATH_CLOSE = ")}";
|
||||||
|
private static final String INTENSITY_MATH_CLOSE_HEX = ").hex}";
|
||||||
|
private static final String INTENSITY_PERCENT_HEX = "${intensity.percent.hex}";
|
||||||
|
private static final String INTENSITY_BYTE_HEX = "${intensity.byte.hex}";
|
||||||
|
|
||||||
public static int calculateIntensity(int setIntensity, Integer targetBri, Integer targetBriInc) {
|
public static int calculateIntensity(int setIntensity, Integer targetBri, Integer targetBriInc) {
|
||||||
if (targetBri != null) {
|
if (targetBri != null) {
|
||||||
@@ -45,50 +48,79 @@ public class BrightnessDecode {
|
|||||||
if (request == null) {
|
if (request == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (request.contains(INTENSITY_BYTE)) {
|
boolean notDone = true;
|
||||||
if (isHex) {
|
String replaceValue = null;
|
||||||
String hexValue = convertToHex(intensity);
|
String replaceTarget = null;
|
||||||
request = request.replace(INTENSITY_BYTE, hexValue);
|
int percentBrightness = (int) Math.round(intensity / 255.0 * 100);
|
||||||
} else {
|
float decimalBrightness = (float) (intensity / 255.0);
|
||||||
String intensityByte = String.valueOf(intensity);
|
Map<String, BigDecimal> variables = new HashMap<String, BigDecimal>();
|
||||||
request = request.replace(INTENSITY_BYTE, intensityByte);
|
String mathDescriptor = null;
|
||||||
}
|
|
||||||
} else if (request.contains(INTENSITY_PERCENT)) {
|
|
||||||
int percentBrightness = (int) Math.round(intensity / 255.0 * 100);
|
|
||||||
if (isHex) {
|
|
||||||
String hexValue = convertToHex(percentBrightness);
|
|
||||||
request = request.replace(INTENSITY_PERCENT, hexValue);
|
|
||||||
} else {
|
|
||||||
String intensityPercent = String.valueOf(percentBrightness);
|
|
||||||
request = request.replace(INTENSITY_PERCENT, intensityPercent);
|
|
||||||
}
|
|
||||||
} else if (request.contains(INTENSITY_DECIMAL_PERCENT)) {
|
|
||||||
float decimalBrightness = (float) (intensity / 255.0);
|
|
||||||
|
|
||||||
String intensityPercent = String.format("%1.2f", decimalBrightness);
|
while(notDone) {
|
||||||
request = request.replace(INTENSITY_DECIMAL_PERCENT, intensityPercent);
|
notDone = false;
|
||||||
} else if (request.contains(INTENSITY_MATH)) {
|
if (request.contains(INTENSITY_BYTE)) {
|
||||||
Map<String, BigDecimal> variables = new HashMap<String, BigDecimal>();
|
if (isHex) {
|
||||||
String mathDescriptor = request.substring(request.indexOf(INTENSITY_MATH) + INTENSITY_MATH.length(),
|
replaceValue = convertToHex(intensity);
|
||||||
request.indexOf(INTENSITY_MATH_CLOSE));
|
} else {
|
||||||
variables.put(INTENSITY_MATH_VALUE, new BigDecimal(intensity));
|
replaceValue = String.valueOf(intensity);
|
||||||
|
}
|
||||||
|
replaceTarget = INTENSITY_BYTE;
|
||||||
|
notDone = true;
|
||||||
|
} else if (request.contains(INTENSITY_BYTE_HEX)) {
|
||||||
|
replaceValue = convertToHex(intensity);
|
||||||
|
replaceTarget = INTENSITY_BYTE_HEX;
|
||||||
|
notDone = true;
|
||||||
|
} else if (request.contains(INTENSITY_PERCENT)) {
|
||||||
|
if (isHex) {
|
||||||
|
replaceValue = convertToHex(percentBrightness);
|
||||||
|
} else {
|
||||||
|
replaceValue = String.valueOf(percentBrightness);
|
||||||
|
}
|
||||||
|
replaceTarget = INTENSITY_PERCENT;
|
||||||
|
notDone = true;
|
||||||
|
} else if (request.contains(INTENSITY_PERCENT_HEX)) {
|
||||||
|
replaceValue = convertToHex(percentBrightness);
|
||||||
|
replaceTarget = INTENSITY_PERCENT_HEX;
|
||||||
|
notDone = true;
|
||||||
|
} else if (request.contains(INTENSITY_DECIMAL_PERCENT)) {
|
||||||
|
replaceValue = String.format("%1.2f", decimalBrightness);
|
||||||
|
replaceTarget = INTENSITY_DECIMAL_PERCENT;
|
||||||
|
notDone = true;
|
||||||
|
} else if (request.contains(INTENSITY_MATH_CLOSE)) {
|
||||||
|
mathDescriptor = request.substring(request.indexOf(INTENSITY_MATH) + INTENSITY_MATH.length(),
|
||||||
|
request.indexOf(INTENSITY_MATH_CLOSE));
|
||||||
|
variables.put(INTENSITY_MATH_VALUE, new BigDecimal(intensity));
|
||||||
|
|
||||||
try {
|
|
||||||
log.debug("Math eval is: " + mathDescriptor + ", Where " + INTENSITY_MATH_VALUE + " is: "
|
log.debug("Math eval is: " + mathDescriptor + ", Where " + INTENSITY_MATH_VALUE + " is: "
|
||||||
+ String.valueOf(intensity));
|
+ String.valueOf(intensity));
|
||||||
Expression exp = new Expression(mathDescriptor);
|
Integer endResult = calculateMath(variables, mathDescriptor);
|
||||||
BigDecimal result = exp.eval(variables);
|
if(endResult != null) {
|
||||||
Integer endResult = Math.round(result.floatValue());
|
if (isHex) {
|
||||||
if (isHex) {
|
replaceValue = convertToHex(endResult);
|
||||||
String hexValue = convertToHex(endResult);
|
} else {
|
||||||
request = request.replace(INTENSITY_MATH + mathDescriptor + INTENSITY_MATH_CLOSE, hexValue);
|
replaceValue = endResult.toString();
|
||||||
} else {
|
}
|
||||||
request = request.replace(INTENSITY_MATH + mathDescriptor + INTENSITY_MATH_CLOSE,
|
replaceTarget = INTENSITY_MATH + mathDescriptor + INTENSITY_MATH_CLOSE;
|
||||||
endResult.toString());
|
notDone = true;
|
||||||
|
}
|
||||||
|
} else if (request.contains(INTENSITY_MATH_CLOSE_HEX)) {
|
||||||
|
mathDescriptor = request.substring(request.indexOf(INTENSITY_MATH) + INTENSITY_MATH.length(),
|
||||||
|
request.indexOf(INTENSITY_MATH_CLOSE_HEX));
|
||||||
|
variables.put(INTENSITY_MATH_VALUE, new BigDecimal(intensity));
|
||||||
|
|
||||||
|
Integer endResult = calculateMath(variables, mathDescriptor);
|
||||||
|
if(endResult != null) {
|
||||||
|
if (isHex) {
|
||||||
|
replaceValue = convertToHex(endResult);
|
||||||
|
} else {
|
||||||
|
replaceValue = endResult.toString();
|
||||||
|
}
|
||||||
|
replaceTarget = INTENSITY_MATH + mathDescriptor + INTENSITY_MATH_CLOSE_HEX;
|
||||||
|
notDone = true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
log.warn("Could not execute Math: " + mathDescriptor, e);
|
|
||||||
}
|
}
|
||||||
|
if(notDone)
|
||||||
|
request = request.replace(replaceTarget, replaceValue);
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
@@ -108,4 +140,17 @@ public class BrightnessDecode {
|
|||||||
newBytes[1] = theBytes[0];
|
newBytes[1] = theBytes[0];
|
||||||
return new String(newBytes);
|
return new String(newBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Integer calculateMath(Map<String, BigDecimal> variables, String mathDescriptor) {
|
||||||
|
Integer endResult = null;
|
||||||
|
try {
|
||||||
|
Expression exp = new Expression(mathDescriptor);
|
||||||
|
BigDecimal result = exp.eval(variables);
|
||||||
|
endResult = Math.round(result.floatValue());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Could not execute Math: " + mathDescriptor, e);
|
||||||
|
endResult = null;
|
||||||
|
}
|
||||||
|
return endResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
21
src/main/java/com/bwssystems/HABridge/hue/ColorDecode.java
Normal file
21
src/main/java/com/bwssystems/HABridge/hue/ColorDecode.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.bwssystems.HABridge.hue;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ColorDecode {
|
||||||
|
|
||||||
|
public static String convertCIEtoRGB(List<Double> xy) {
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
double Y;
|
||||||
|
|
||||||
|
x = xy.get(0) * 100;
|
||||||
|
y = xy.get(1) * 100;
|
||||||
|
Y= y;
|
||||||
|
double R = 3.240479*((x*Y)/y) + -1.537150*Y + -0.498535*(((1-x-y)*Y)/y);
|
||||||
|
double G = -0.969256*((x*Y)/y) + 1.875992*Y + 0.041556*(((1-x-y)*Y)/y);
|
||||||
|
double B = 0.055648*((x*Y)/y) + -0.204043*Y + 1.057311*(((1-x-y)*Y)/y);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.bwssystems.HABridge.hue;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
|
|
||||||
|
public class DeviceDataDecode {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(DeviceDataDecode.class);
|
||||||
|
private static final String DEVICE_ID = "${device.id}";
|
||||||
|
private static final String DEVICE_UNIQUEID = "${device.uniqueid}";
|
||||||
|
private static final String DEVICE_NAME = "${device.name}";
|
||||||
|
private static final String DEVICE_MAPID = "${device.mapId}";
|
||||||
|
private static final String DEVICE_MAPTYPE = "${device.mapType}";
|
||||||
|
private static final String DEVICE_DEVICETYPE = "${device.deviceType}";
|
||||||
|
private static final String DEVICE_TARGETDEVICE = "${device.targetDevice}";
|
||||||
|
|
||||||
|
public static String replaceDeviceData(String request, DeviceDescriptor device) {
|
||||||
|
if (request == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
boolean notDone = true;
|
||||||
|
|
||||||
|
while(notDone) {
|
||||||
|
notDone = false;
|
||||||
|
if (request.contains(DEVICE_ID)) {
|
||||||
|
request = request.replace(DEVICE_ID, device.getId());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contains(DEVICE_UNIQUEID)) {
|
||||||
|
request = request.replace(DEVICE_UNIQUEID, device.getUniqueid());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contains(DEVICE_NAME)) {
|
||||||
|
request = request.replace(DEVICE_NAME, device.getName());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contains(DEVICE_MAPID)) {
|
||||||
|
request = request.replace(DEVICE_MAPID, device.getMapId());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contains(DEVICE_MAPTYPE)) {
|
||||||
|
request = request.replace(DEVICE_MAPTYPE, device.getMapType());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contains(DEVICE_DEVICETYPE)) {
|
||||||
|
request = request.replace(DEVICE_DEVICETYPE, device.getDeviceType());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contains(DEVICE_TARGETDEVICE)) {
|
||||||
|
request = request.replace(DEVICE_TARGETDEVICE, device.getTargetDevice());
|
||||||
|
notDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("Request <<" + request + ">>, not done: " + notDone);
|
||||||
|
}
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -391,7 +391,7 @@ public class HueMulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String formatSuccessHueResponse(StateChangeBody stateChanges, String body, String lightId,
|
private String formatSuccessHueResponse(StateChangeBody stateChanges, String body, String lightId,
|
||||||
DeviceState deviceState, Integer targetBri, Integer targetBriInc) {
|
DeviceState deviceState, Integer targetBri, Integer targetBriInc, boolean offState) {
|
||||||
|
|
||||||
String responseString = "[";
|
String responseString = "[";
|
||||||
boolean notFirstChange = false;
|
boolean notFirstChange = false;
|
||||||
@@ -406,6 +406,8 @@ public class HueMulator {
|
|||||||
deviceState.setOn(stateChanges.isOn());
|
deviceState.setOn(stateChanges.isOn());
|
||||||
if(!deviceState.isOn() && deviceState.getBri() == 254)
|
if(!deviceState.isOn() && deviceState.getBri() == 254)
|
||||||
deviceState.setBri(0);
|
deviceState.setBri(0);
|
||||||
|
if(!deviceState.isOn() && offState)
|
||||||
|
deviceState.setBri(0);
|
||||||
}
|
}
|
||||||
notFirstChange = true;
|
notFirstChange = true;
|
||||||
}
|
}
|
||||||
@@ -824,7 +826,7 @@ public class HueMulator {
|
|||||||
if (state == null)
|
if (state == null)
|
||||||
state = DeviceState.createDeviceState();
|
state = DeviceState.createDeviceState();
|
||||||
|
|
||||||
responseString = this.formatSuccessHueResponse(theStateChanges, body, lightId, state, targetBri, targetBriInc);
|
responseString = this.formatSuccessHueResponse(theStateChanges, body, lightId, state, targetBri, targetBriInc, device.isOffState());
|
||||||
device.setDeviceState(state);
|
device.setDeviceState(state);
|
||||||
|
|
||||||
return responseString;
|
return responseString;
|
||||||
@@ -964,11 +966,11 @@ public class HueMulator {
|
|||||||
|
|
||||||
if (responseString == null || !responseString.contains("[{\"error\":")) {
|
if (responseString == null || !responseString.contains("[{\"error\":")) {
|
||||||
if(!device.isNoState()) {
|
if(!device.isNoState()) {
|
||||||
responseString = this.formatSuccessHueResponse(theStateChanges, body, lightId, state, targetBri, targetBriInc);
|
responseString = this.formatSuccessHueResponse(theStateChanges, body, lightId, state, targetBri, targetBriInc, device.isOffState());
|
||||||
device.setDeviceState(state);
|
device.setDeviceState(state);
|
||||||
} else {
|
} else {
|
||||||
DeviceState dummyState = DeviceState.createDeviceState();
|
DeviceState dummyState = DeviceState.createDeviceState();
|
||||||
responseString = this.formatSuccessHueResponse(theStateChanges, body, lightId, dummyState, targetBri, targetBriInc);
|
responseString = this.formatSuccessHueResponse(theStateChanges, body, lightId, dummyState, targetBri, targetBriInc, device.isOffState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return responseString;
|
return responseString;
|
||||||
|
|||||||
@@ -21,16 +21,22 @@ public class TimeDecode {
|
|||||||
if (request == null) {
|
if (request == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (request.contains(TIME_FORMAT)) {
|
boolean notDone = true;
|
||||||
String timeFormatDescriptor = request.substring(request.indexOf(TIME_FORMAT) + TIME_FORMAT.length(),
|
|
||||||
request.indexOf(TIME_FORMAT_CLOSE));
|
|
||||||
|
|
||||||
try {
|
while(notDone) {
|
||||||
log.debug("Time eval is: " + timeFormatDescriptor);
|
notDone = false;
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat(timeFormatDescriptor);
|
if (request.contains(TIME_FORMAT)) {
|
||||||
request = request.replace(TIME_FORMAT + timeFormatDescriptor + TIME_FORMAT_CLOSE, dateFormat.format(new Date()));
|
String timeFormatDescriptor = request.substring(request.indexOf(TIME_FORMAT) + TIME_FORMAT.length(),
|
||||||
} catch (Exception e) {
|
request.indexOf(TIME_FORMAT_CLOSE));
|
||||||
log.warn("Could not format current time: " + timeFormatDescriptor, e);
|
|
||||||
|
try {
|
||||||
|
log.debug("Time eval is: " + timeFormatDescriptor);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat(timeFormatDescriptor);
|
||||||
|
request = request.replace(TIME_FORMAT + timeFormatDescriptor + TIME_FORMAT_CLOSE, dateFormat.format(new Date()));
|
||||||
|
notDone = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("Could not format current time: " + timeFormatDescriptor, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.bwssystems.HABridge.Home;
|
|||||||
import com.bwssystems.HABridge.api.CallItem;
|
import com.bwssystems.HABridge.api.CallItem;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||||
|
import com.bwssystems.HABridge.hue.DeviceDataDecode;
|
||||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||||
import com.bwssystems.HABridge.hue.TimeDecode;
|
import com.bwssystems.HABridge.hue.TimeDecode;
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ public class CommandHome implements Home {
|
|||||||
else
|
else
|
||||||
intermediate = anItem.getItem().getAsString();
|
intermediate = anItem.getItem().getAsString();
|
||||||
intermediate = BrightnessDecode.calculateReplaceIntensityValue(intermediate, itensity, targetBri, targetBriInc, false);
|
intermediate = BrightnessDecode.calculateReplaceIntensityValue(intermediate, itensity, targetBri, targetBriInc, false);
|
||||||
|
intermediate = DeviceDataDecode.replaceDeviceData(intermediate, device);
|
||||||
intermediate = TimeDecode.replaceTimeValue(intermediate);
|
intermediate = TimeDecode.replaceTimeValue(intermediate);
|
||||||
String anError = doExecRequest(intermediate, lightId);
|
String anError = doExecRequest(intermediate, lightId);
|
||||||
if (anError != null) {
|
if (anError != null) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.bwssystems.HABridge.IpList;
|
|||||||
import com.bwssystems.HABridge.NamedIP;
|
import com.bwssystems.HABridge.NamedIP;
|
||||||
import com.bwssystems.HABridge.api.CallItem;
|
import com.bwssystems.HABridge.api.CallItem;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
|
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
@@ -161,6 +162,8 @@ public class HarmonyHome implements Home {
|
|||||||
if (url.substring(0, 1).equalsIgnoreCase("{")) {
|
if (url.substring(0, 1).equalsIgnoreCase("{")) {
|
||||||
url = "[" + url + "]";
|
url = "[" + url + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
url = BrightnessDecode.calculateReplaceIntensityValue(url, intensity, targetBri, targetBriInc, false);
|
||||||
ButtonPress[] deviceButtons = aGsonHandler.fromJson(url, ButtonPress[].class);
|
ButtonPress[] deviceButtons = aGsonHandler.fromJson(url, ButtonPress[].class);
|
||||||
Integer theCount = 1;
|
Integer theCount = 1;
|
||||||
for(int z = 0; z < deviceButtons.length; z++) {
|
for(int z = 0; z < deviceButtons.length; z++) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.bwssystems.HABridge.api.hue.HueError;
|
|||||||
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
|
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||||
|
import com.bwssystems.HABridge.hue.DeviceDataDecode;
|
||||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||||
import com.bwssystems.HABridge.hue.TimeDecode;
|
import com.bwssystems.HABridge.hue.TimeDecode;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -49,12 +50,14 @@ public class HTTPHome implements Home {
|
|||||||
|
|
||||||
String anUrl = BrightnessDecode.calculateReplaceIntensityValue(theUrl,
|
String anUrl = BrightnessDecode.calculateReplaceIntensityValue(theUrl,
|
||||||
intensity, targetBri, targetBriInc, false);
|
intensity, targetBri, targetBriInc, false);
|
||||||
|
anUrl = DeviceDataDecode.replaceDeviceData(anUrl, device);
|
||||||
anUrl = TimeDecode.replaceTimeValue(anUrl);
|
anUrl = TimeDecode.replaceTimeValue(anUrl);
|
||||||
|
|
||||||
String aBody = null;
|
String aBody = null;
|
||||||
if(anItem.getHttpBody()!= null && !anItem.getHttpBody().isEmpty()) {
|
if(anItem.getHttpBody()!= null && !anItem.getHttpBody().isEmpty()) {
|
||||||
aBody = BrightnessDecode.calculateReplaceIntensityValue(anItem.getHttpBody(),
|
aBody = BrightnessDecode.calculateReplaceIntensityValue(anItem.getHttpBody(),
|
||||||
intensity, targetBri, targetBriInc, false);
|
intensity, targetBri, targetBriInc, false);
|
||||||
|
aBody = DeviceDataDecode.replaceDeviceData(aBody, device);
|
||||||
aBody = TimeDecode.replaceTimeValue(aBody);
|
aBody = TimeDecode.replaceTimeValue(aBody);
|
||||||
}
|
}
|
||||||
// make call
|
// make call
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.bwssystems.HABridge.NamedIP;
|
|||||||
import com.bwssystems.HABridge.api.CallItem;
|
import com.bwssystems.HABridge.api.CallItem;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||||
|
import com.bwssystems.HABridge.hue.DeviceDataDecode;
|
||||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||||
import com.bwssystems.HABridge.hue.TimeDecode;
|
import com.bwssystems.HABridge.hue.TimeDecode;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
@@ -89,6 +90,7 @@ public class MQTTHome implements Home {
|
|||||||
mqttObject =anItem.getItem().getAsString();
|
mqttObject =anItem.getItem().getAsString();
|
||||||
mqttObject = BrightnessDecode.calculateReplaceIntensityValue(mqttObject,
|
mqttObject = BrightnessDecode.calculateReplaceIntensityValue(mqttObject,
|
||||||
intensity, targetBri, targetBriInc, false);
|
intensity, targetBri, targetBriInc, false);
|
||||||
|
mqttObject = DeviceDataDecode.replaceDeviceData(mqttObject, device);
|
||||||
mqttObject = TimeDecode.replaceTimeValue(mqttObject);
|
mqttObject = TimeDecode.replaceTimeValue(mqttObject);
|
||||||
if (mqttObject.substring(0, 1).equalsIgnoreCase("{"))
|
if (mqttObject.substring(0, 1).equalsIgnoreCase("{"))
|
||||||
mqttObject = "[" + mqttObject + "]";
|
mqttObject = "[" + mqttObject + "]";
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.bwssystems.HABridge.Home;
|
|||||||
import com.bwssystems.HABridge.api.CallItem;
|
import com.bwssystems.HABridge.api.CallItem;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||||
|
import com.bwssystems.HABridge.hue.DeviceDataDecode;
|
||||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||||
import com.bwssystems.HABridge.hue.TimeDecode;
|
import com.bwssystems.HABridge.hue.TimeDecode;
|
||||||
|
|
||||||
@@ -71,9 +72,11 @@ public class TCPHome implements Home {
|
|||||||
theUrlBody = TimeDecode.replaceTimeValue(theUrlBody);
|
theUrlBody = TimeDecode.replaceTimeValue(theUrlBody);
|
||||||
if (theUrlBody.startsWith("0x")) {
|
if (theUrlBody.startsWith("0x")) {
|
||||||
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, true);
|
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, true);
|
||||||
|
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
||||||
sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2));
|
sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2));
|
||||||
} else {
|
} else {
|
||||||
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, false);
|
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, false);
|
||||||
|
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
||||||
theUrlBody = StringEscapeUtils.unescapeJava(theUrlBody);
|
theUrlBody = StringEscapeUtils.unescapeJava(theUrlBody);
|
||||||
sendData = theUrlBody.getBytes();
|
sendData = theUrlBody.getBytes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.bwssystems.HABridge.Home;
|
|||||||
import com.bwssystems.HABridge.api.CallItem;
|
import com.bwssystems.HABridge.api.CallItem;
|
||||||
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
import com.bwssystems.HABridge.dao.DeviceDescriptor;
|
||||||
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
import com.bwssystems.HABridge.hue.BrightnessDecode;
|
||||||
|
import com.bwssystems.HABridge.hue.DeviceDataDecode;
|
||||||
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
import com.bwssystems.HABridge.hue.MultiCommandUtil;
|
||||||
import com.bwssystems.HABridge.hue.TimeDecode;
|
import com.bwssystems.HABridge.hue.TimeDecode;
|
||||||
import com.bwssystems.HABridge.util.UDPDatagramSender;
|
import com.bwssystems.HABridge.util.UDPDatagramSender;
|
||||||
@@ -57,9 +58,11 @@ public class UDPHome implements Home {
|
|||||||
theUrlBody = TimeDecode.replaceTimeValue(theUrlBody);
|
theUrlBody = TimeDecode.replaceTimeValue(theUrlBody);
|
||||||
if (theUrlBody.startsWith("0x")) {
|
if (theUrlBody.startsWith("0x")) {
|
||||||
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, true);
|
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, true);
|
||||||
|
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
||||||
sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2));
|
sendData = DatatypeConverter.parseHexBinary(theUrlBody.substring(2));
|
||||||
} else {
|
} else {
|
||||||
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, false);
|
theUrlBody = BrightnessDecode.calculateReplaceIntensityValue(theUrlBody, intensity, targetBri, targetBriInc, false);
|
||||||
|
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
||||||
theUrlBody = StringEscapeUtils.unescapeJava(theUrlBody);
|
theUrlBody = StringEscapeUtils.unescapeJava(theUrlBody);
|
||||||
sendData = theUrlBody.getBytes();
|
sendData = theUrlBody.getBytes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ String.prototype.replaceAll = function (search, replace)
|
|||||||
|
|
||||||
app.service ('bridgeService', function ($http, $window, ngToast) {
|
app.service ('bridgeService', function ($http, $window, ngToast) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {}, mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, showHal: false, showMqtt: false, showHass: false, showDomoticz: false, showSomfy: false, showLifx: false, habridgeversion: "", viewDevId: ""};
|
this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {}, mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false, isInControl: false, showVera: false, showHarmony: false, showNest: false, showHue: false, showHal: false, showMqtt: false, showHass: false, showDomoticz: false, showSomfy: false, showLifx: false, habridgeversion: "", viewDevId: "", queueDevId: ""};
|
||||||
|
|
||||||
this.displayWarn = function(errorTitle, error) {
|
this.displayWarn = function(errorTitle, error) {
|
||||||
var toastContent = errorTitle;
|
var toastContent = errorTitle;
|
||||||
@@ -1166,6 +1166,26 @@ app.controller('LogsController', function ($scope, $location, $http, $window, br
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.directive('postrenderAction', postrenderAction);
|
||||||
|
/* @ngInject */
|
||||||
|
function postrenderAction($timeout) {
|
||||||
|
// ### Directive Interface
|
||||||
|
// Defines base properties for the directive.
|
||||||
|
var directive = {
|
||||||
|
restrict: 'A',
|
||||||
|
priority: 101,
|
||||||
|
link: link
|
||||||
|
};
|
||||||
|
return directive;
|
||||||
|
|
||||||
|
// ### Link Function
|
||||||
|
// Provides functionality for the directive during the DOM building/data binding stage.
|
||||||
|
function link(scope, element, attrs) {
|
||||||
|
$timeout(function() {
|
||||||
|
scope.$evalAsync(attrs.postrenderAction);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService, ngDialog) {
|
app.controller('ViewingController', function ($scope, $location, $http, $window, bridgeService, ngDialog) {
|
||||||
|
|
||||||
bridgeService.viewDevices();
|
bridgeService.viewDevices();
|
||||||
@@ -1232,9 +1252,14 @@ app.controller('ViewingController', function ($scope, $location, $http, $window,
|
|||||||
$scope.imgBkUrl = "glyphicon glyphicon-plus";
|
$scope.imgBkUrl = "glyphicon glyphicon-plus";
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$watch('bridge.devices', function(devId) {
|
$scope.goToRow = function() {
|
||||||
$scope.$broadcast("rowSelected", bridgeService.state.viewDevId);
|
if (bridgeService.state.queueDevId !== null && bridgeService.state.queueDevId !== "") {
|
||||||
});
|
bridgeService.state.viewDevId = bridgeService.state.queueDevId;
|
||||||
|
$scope.$broadcast("rowSelected", bridgeService.state.viewDevId);
|
||||||
|
console.log("Go to Row selected Id <<" + bridgeService.state.viewDevId + ">>")
|
||||||
|
bridgeService.state.queueDevId = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('ValueDialogCtrl', function ($scope, bridgeService, ngDialog) {
|
app.controller('ValueDialogCtrl', function ($scope, bridgeService, ngDialog) {
|
||||||
@@ -2669,6 +2694,8 @@ app.controller('EditController', function ($scope, $location, $http, bridgeServi
|
|||||||
|
|
||||||
bridgeService.addDevice($scope.device).then(
|
bridgeService.addDevice($scope.device).then(
|
||||||
function () {
|
function () {
|
||||||
|
bridgeService.state.queueDevId = $scope.device.id;
|
||||||
|
console.log("Device updated for Q Id <<" + bridgeService.state.queueDevId + ">>")
|
||||||
$scope.clearDevice();
|
$scope.clearDevice();
|
||||||
$location.path('/');
|
$location.path('/');
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX Devices</a></li>
|
<li ng-if="bridge.showLifx" role="presentation"><a href="#!/lifxdevices">LIFX Devices</a></li>
|
||||||
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
|
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div postrender-action="goToRow()">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h1 class="panel-title">Current devices ({{bridge.devices.length}})</h1>
|
<h1 class="panel-title">Current devices ({{bridge.devices.length}})</h1>
|
||||||
@@ -34,7 +34,6 @@
|
|||||||
<p>
|
<p>
|
||||||
<button class="btn btn-primary" type="submit" ng-click="renumberDevices()">Renumber Devices</button>
|
<button class="btn btn-primary" type="submit" ng-click="renumberDevices()">Renumber Devices</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<scrollable-table watch="bridge.devices">
|
<scrollable-table watch="bridge.devices">
|
||||||
<table class="table table-bordered table-striped table-hover">
|
<table class="table table-bordered table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -42,6 +41,7 @@
|
|||||||
<th>Row</th>
|
<th>Row</th>
|
||||||
<th sortable-header col="id" comparator-fn="comparatorUniqueId">ID</th>
|
<th sortable-header col="id" comparator-fn="comparatorUniqueId">ID</th>
|
||||||
<th sortable-header col="name">Name</th>
|
<th sortable-header col="name">Name</th>
|
||||||
|
<th sortable-header col="description">Description</th>
|
||||||
<th sortable-header col="deviceType">Type</th>
|
<th sortable-header col="deviceType">Type</th>
|
||||||
<th sortable-header col="targetDevice">Target</th>
|
<th sortable-header col="targetDevice">Target</th>
|
||||||
<th sortable-header col="inactive">Inactive</th>
|
<th sortable-header col="inactive">Inactive</th>
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
<td>{{$index+1}}</td>
|
<td>{{$index+1}}</td>
|
||||||
<td>{{device.id}}</td>
|
<td>{{device.id}}</td>
|
||||||
<td>{{device.name}}</td>
|
<td>{{device.name}}</td>
|
||||||
|
<td class="cr">{{device.description}}</td>
|
||||||
<td>{{device.deviceType}}</td>
|
<td>{{device.deviceType}}</td>
|
||||||
<td>{{device.targetDevice}}</td>
|
<td>{{device.targetDevice}}</td>
|
||||||
<td>{{device.inactive}}</td>
|
<td>{{device.inactive}}</td>
|
||||||
@@ -76,6 +77,7 @@
|
|||||||
</scrollable-table>
|
</scrollable-table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h1 class="panel-title">
|
<h1 class="panel-title">
|
||||||
|
|||||||
@@ -65,6 +65,18 @@
|
|||||||
<td><input type="text" class="form-control" id="device-name"
|
<td><input type="text" class="form-control" id="device-name"
|
||||||
ng-model="device.name" placeholder="Device Name"></td>
|
ng-model="device.name" placeholder="Device Name"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label>Description</label></td>
|
||||||
|
|
||||||
|
<td><input type="text" class="form-control" id="device-description"
|
||||||
|
ng-model="device.description" placeholder="Device Description"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label>Comments</label></td>
|
||||||
|
|
||||||
|
<td><input type="text" class="form-control" id="device-comments"
|
||||||
|
ng-model="device.comments" placeholder="Device Comments"></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>Inactive</label></td>
|
<td><label>Inactive</label></td>
|
||||||
<td><input type="checkbox"
|
<td><input type="checkbox"
|
||||||
@@ -77,6 +89,12 @@
|
|||||||
ng-model="device.noState" ng-true-value=true
|
ng-model="device.noState" ng-true-value=true
|
||||||
ng-false-value=false> {{device.noState}}</td>
|
ng-false-value=false> {{device.noState}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><label>Off State Resets Bri</label></td>
|
||||||
|
<td><input type="checkbox"
|
||||||
|
ng-model="device.offState" ng-true-value=true
|
||||||
|
ng-false-value=false> {{device.offState}}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>Filter Address (comma separated list)</label></td>
|
<td><label>Filter Address (comma separated list)</label></td>
|
||||||
<td><input type="text" class="form-control" id="device-requester-addr"
|
<td><input type="text" class="form-control" id="device-requester-addr"
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.bwssystems.color.test;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.bwssystems.HABridge.hue.ColorDecode;
|
||||||
|
|
||||||
|
public class ConvertCIEColorTestCase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testColorConversion() {
|
||||||
|
ArrayList<Double> xy = new ArrayList<Double>(Arrays.asList(new Double(0.3972), new Double(0.4564)));
|
||||||
|
|
||||||
|
String colorDecode = ColorDecode.convertCIEtoRGB(xy);
|
||||||
|
Assert.assertEquals(colorDecode, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user