mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 00:10:20 +00:00
Fixed color for MQTT and TCP
This commit is contained in:
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>5.2.0RC14</version>
|
<version>5.2.0RC15</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ 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.ColorData;
|
import com.bwssystems.HABridge.hue.ColorData;
|
||||||
|
import com.bwssystems.HABridge.hue.ColorDecode;
|
||||||
import com.bwssystems.HABridge.hue.DeviceDataDecode;
|
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;
|
||||||
@@ -100,6 +101,9 @@ public class MQTTHome implements Home {
|
|||||||
intensity, targetBri, targetBriInc, false);
|
intensity, targetBri, targetBriInc, false);
|
||||||
mqttObject = DeviceDataDecode.replaceDeviceData(mqttObject, device);
|
mqttObject = DeviceDataDecode.replaceDeviceData(mqttObject, device);
|
||||||
mqttObject = TimeDecode.replaceTimeValue(mqttObject);
|
mqttObject = TimeDecode.replaceTimeValue(mqttObject);
|
||||||
|
if (colorData != null) {
|
||||||
|
mqttObject = ColorDecode.replaceColorData(mqttObject, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), false);
|
||||||
|
}
|
||||||
if (mqttObject.substring(0, 1).equalsIgnoreCase("{"))
|
if (mqttObject.substring(0, 1).equalsIgnoreCase("{"))
|
||||||
mqttObject = "[" + mqttObject + "]";
|
mqttObject = "[" + mqttObject + "]";
|
||||||
MQTTMessage[] mqttMessages = aGsonHandler.fromJson(mqttObject, MQTTMessage[].class);
|
MQTTMessage[] mqttMessages = aGsonHandler.fromJson(mqttObject, MQTTMessage[].class);
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ public class TCPHome implements Home {
|
|||||||
theUrlBody = ColorDecode.replaceColorData(theUrlBody, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), true);
|
theUrlBody = ColorDecode.replaceColorData(theUrlBody, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), true);
|
||||||
}
|
}
|
||||||
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
||||||
|
if (colorData != null) {
|
||||||
|
theUrlBody = ColorDecode.replaceColorData(theUrlBody, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), true);
|
||||||
|
}
|
||||||
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);
|
||||||
@@ -96,6 +99,9 @@ public class TCPHome implements Home {
|
|||||||
theUrlBody = ColorDecode.replaceColorData(theUrlBody, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), false);
|
theUrlBody = ColorDecode.replaceColorData(theUrlBody, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), false);
|
||||||
}
|
}
|
||||||
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
theUrlBody = DeviceDataDecode.replaceDeviceData(theUrlBody, device);
|
||||||
|
if (colorData != null) {
|
||||||
|
theUrlBody = ColorDecode.replaceColorData(theUrlBody, colorData, BrightnessDecode.calculateIntensity(intensity, targetBri, targetBriInc), false);
|
||||||
|
}
|
||||||
theUrlBody = StringEscapeUtils.unescapeJava(theUrlBody);
|
theUrlBody = StringEscapeUtils.unescapeJava(theUrlBody);
|
||||||
sendData = theUrlBody.getBytes();
|
sendData = theUrlBody.getBytes();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user