From 0dd652f82a026785dbe2f841bb31efa1d041440e Mon Sep 17 00:00:00 2001 From: Admin Date: Thu, 12 Nov 2015 16:31:01 -0600 Subject: [PATCH] Updated device return for HUE emulation based on new information of LUX bulb handling in the API from the Philips dev info. --- README.md | 81 ------------------- pom.xml | 2 +- .../HABridge/api/hue/DeviceResponse.java | 28 +------ .../HABridge/api/hue/DeviceState.java | 46 ----------- 4 files changed, 2 insertions(+), 155 deletions(-) diff --git a/README.md b/README.md index 9c0d1a3..51786c7 100644 --- a/README.md +++ b/README.md @@ -395,57 +395,27 @@ If there are no lights in the system then the bridge will return an empty object "state": { "on": true, "bri": 144, - "hue": 0, - "sat": 254, - "xy": [0,0], - "ct": 0, "alert": "none", "effect": "none", - "colormode": "", "reachable": true }, "type": "Dimmable light", "name": "Table Lamp 1", "modelid": "LWB004", "swversion": "65003148", - "pointsymbol": { - "1": "none", - "2": "none", - "3": "none", - "4": "none", - "5": "none", - "6": "none", - "7": "none", - "8": "none" - } }, "2": { "state": { "on": false, "bri": 0, - "hue": 0, - "sat": 0, - "xy": [0,0], - "ct": 0, "alert": "none", "effect": "none", - "colormode": "", "reachable": true }, "type": "Dimmable light", "name": "Table Lamp 2", "modelid": "LWB004", "swversion": "65003148", - "pointsymbol": { - "1": "none", - "2": "none", - "3": "none", - "4": "none", - "5": "none", - "6": "none", - "7": "none", - "8": "none" - } } } ``` @@ -465,7 +435,6 @@ uniqueid | string 6, 32 | Unique id of the device. manufacturername | string 6, 32 | The manufacturer name will be "Philips". luminaireuniqueid | string 6, 32 | This will be empty. swversion | string 8, 8 | An identifier for the software version running on the light which will be "65003148". -Pointsymbol | object | This parameter is reserved for future functionality and returns a preset hashmap. The state object contains the following fields @@ -473,42 +442,22 @@ Name | Type | Description -----|-------|------------- on | bool | On/Off state of the light. On=true, Off=false bri | uint8 | Brightness of the light. This will be set to 254 as a default. -hue | uint16 | This will be empty. -sat | uint8 | This will be set to 254. -xy | list 2..2 of float 4 | This will be empty. -ct | uint16 | This will be empty. alert | string | This will be set to "none". effect | string | This will be set to "none". -colormode | string 2, 2 | This will be empty. reachable | bool | Indicates if a light can be reached by the bridge and will be set to true. ``` { "state": { - "hue": 0, "on": true, "effect": "none", "alert": "none", "bri": 254, - "sat": 254, - "ct": 0, - "xy": [0, 0], "reachable": true, - "colormode": "" }, "type": "Dimmable light", "name": "Kitchen Ceiling", "modelid": "LWB004", "swversion": "65003148", - "pointsymbol": { - "1": "none", - "2": "none", - "3": "none", - "4": "none", - "5": "none", - "6": "none", - "7": "none", - "8": "none" - } } ``` ### Set light state @@ -575,57 +524,27 @@ rules | object | A collection of all rules and their attributes. This is not giv "state": { "on": false, "bri": 0, - "hue": 0, - "sat": 254, - "xy": [0.0000, 0.0000], - "ct": 0, "alert": "none", "effect": "none", - "colormode": "", "reachable": true }, "type": "Dimmable light", "name": "Table Lamp 1", "modelid": "LWB004", "swversion": "65003148", - "pointsymbol": { - "1": "none", - "2": "none", - "3": "none", - "4": "none", - "5": "none", - "6": "none", - "7": "none", - "8": "none" - } }, "2": { "state": { "on": true, "bri": 254, - "hue": 0, - "sat": 254, - "xy": [0, 0], - "ct": 0, "alert": "none", "effect": "none", - "colormode": "", "reachable": true }, "type": "Dimmable light", "name": "Table Lamp 2", "modelid": "LWB004", "swversion": "65003148", - "pointsymbol": { - "1": "none", - "2": "none", - "3": "none", - "4": "none", - "5": "none", - "6": "none", - "7": "none", - "8": "none" - } } }, "scenes":{ diff --git a/pom.xml b/pom.xml index 0aa81ca..20ef4e3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.bwssystems.HABridge ha-bridge - 1.0.7 + 1.0.8 jar HA Bridge diff --git a/src/main/java/com/bwssystems/HABridge/api/hue/DeviceResponse.java b/src/main/java/com/bwssystems/HABridge/api/hue/DeviceResponse.java index de2b30d..767231b 100644 --- a/src/main/java/com/bwssystems/HABridge/api/hue/DeviceResponse.java +++ b/src/main/java/com/bwssystems/HABridge/api/hue/DeviceResponse.java @@ -1,8 +1,5 @@ package com.bwssystems.HABridge.api.hue; -import java.util.HashMap; -import java.util.Map; - /** * Created by arm on 4/14/15. */ @@ -14,7 +11,6 @@ public class DeviceResponse { private String manufacturername; private String uniqueid; private String swversion; - private Map pointsymbol; public DeviceState getState() { return state; @@ -72,27 +68,6 @@ public class DeviceResponse { this.swversion = swversion; } - public Map getPointsymbol() { - if(pointsymbol == null) - { - pointsymbol = new HashMap<>(); - pointsymbol.put("1", "none"); - pointsymbol.put("2", "none"); - pointsymbol.put("3", "none"); - pointsymbol.put("4", "none"); - pointsymbol.put("5", "none"); - pointsymbol.put("6", "none"); - pointsymbol.put("7", "none"); - pointsymbol.put("8", "none"); - } - - return pointsymbol; - } - - public void setPointsymbol(Map pointsymbol) { - this.pointsymbol = pointsymbol; - } - public static DeviceResponse createResponse(String name, String id){ DeviceState deviceState = new DeviceState(); DeviceResponse response = new DeviceResponse(); @@ -102,14 +77,13 @@ public class DeviceResponse { deviceState.setEffect("none"); deviceState.setAlert("none"); deviceState.setBri(254); - deviceState.setSat(254); response.setName(name); response.setUniqueid(id); response.setManufacturername("Philips"); response.setType("Dimmable light"); response.setModelid("LWB004"); - response.setSwversion("65003148"); + response.setSwversion("66012040"); return response; } diff --git a/src/main/java/com/bwssystems/HABridge/api/hue/DeviceState.java b/src/main/java/com/bwssystems/HABridge/api/hue/DeviceState.java index 7c065f7..fbff709 100644 --- a/src/main/java/com/bwssystems/HABridge/api/hue/DeviceState.java +++ b/src/main/java/com/bwssystems/HABridge/api/hue/DeviceState.java @@ -1,6 +1,5 @@ package com.bwssystems.HABridge.api.hue; -import java.util.List; /** * Created by arm on 4/14/15. @@ -8,14 +7,9 @@ import java.util.List; public class DeviceState { private boolean on; private int bri = 255; - private int hue; - private int sat; private String effect; - private int ct; private String alert; - private String colormode; private boolean reachable; - private List xy; public boolean isOn() { return on; @@ -33,22 +27,6 @@ public class DeviceState { this.bri = bri; } - public int getHue() { - return hue; - } - - public void setHue(int hue) { - this.hue = hue; - } - - public int getSat() { - return sat; - } - - public void setSat(int sat) { - this.sat = sat; - } - public String getEffect() { return effect; } @@ -57,14 +35,6 @@ public class DeviceState { this.effect = effect; } - public int getCt() { - return ct; - } - - public void setCt(int ct) { - this.ct = ct; - } - public String getAlert() { return alert; } @@ -73,14 +43,6 @@ public class DeviceState { this.alert = alert; } - public String getColormode() { - return colormode; - } - - public void setColormode(String colormode) { - this.colormode = colormode; - } - public boolean isReachable() { return reachable; } @@ -89,14 +51,6 @@ public class DeviceState { this.reachable = reachable; } - public List getXy() { - return xy; - } - - public void setXy(List xy) { - this.xy = xy; - } - @Override public String toString() { return "DeviceState{" +