mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
Updated handling of dimming/brightness request. This could be buggy if
the echo changed to not send an on command when changing dimming. The HUE state change API is not consistent for brightness handling.
This commit is contained in:
@@ -204,23 +204,39 @@ public class HueMulator {
|
||||
return null;
|
||||
}
|
||||
|
||||
String responseString;
|
||||
String url;
|
||||
String responseString =null;
|
||||
String url = null;
|
||||
if (state.isOn()) {
|
||||
responseString = "[{\"success\":{\"/lights/" + lightId + "/state/on\":true}}]";
|
||||
responseString = "[{\"success\":{\"/lights/" + lightId + "/state/on\":true}}";
|
||||
url = device.getOnUrl();
|
||||
} else {
|
||||
responseString = "[{\"success\":{\"/lights/" + lightId + "/state/on\":false}}]";
|
||||
} else if (request.body().contains("false")) {
|
||||
responseString = "[{\"success\":{\"/lights/" + lightId + "/state/on\":false}}";
|
||||
url = device.getOffUrl();
|
||||
}
|
||||
|
||||
if(device.getDeviceType().contains("activity"))
|
||||
if(request.body().contains("bri"))
|
||||
{
|
||||
if(url == null)
|
||||
{
|
||||
url = device.getOnUrl();
|
||||
responseString = "[";
|
||||
}
|
||||
else
|
||||
responseString = responseString + ",";
|
||||
|
||||
responseString = responseString + "{\"success\":{\"/lights/" + lightId + "/state/bri\":" + state.getBri() + "}}]";
|
||||
}
|
||||
else
|
||||
responseString = responseString + "]";
|
||||
|
||||
|
||||
if(device.getDeviceType().toLowerCase().contains("activity"))
|
||||
{
|
||||
log.debug("executing activity to Harmony: " + url);
|
||||
RunActivity anActivity = new Gson().fromJson(url, RunActivity.class);
|
||||
myHarmony.startActivity(anActivity);
|
||||
}
|
||||
else if(device.getDeviceType().contains("button"))
|
||||
else if(device.getDeviceType().toLowerCase().contains("button"))
|
||||
{
|
||||
log.debug("executing button press to Harmony: " + url);
|
||||
ButtonPress aDeviceButton = new Gson().fromJson(url, ButtonPress.class);
|
||||
|
||||
Reference in New Issue
Block a user