mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 00:10:20 +00:00
Updated device return for HUE emulation based on new information of LUX
bulb handling in the API from the Philips dev info.
This commit is contained in:
81
README.md
81
README.md
@@ -395,57 +395,27 @@ If there are no lights in the system then the bridge will return an empty object
|
|||||||
"state": {
|
"state": {
|
||||||
"on": true,
|
"on": true,
|
||||||
"bri": 144,
|
"bri": 144,
|
||||||
"hue": 0,
|
|
||||||
"sat": 254,
|
|
||||||
"xy": [0,0],
|
|
||||||
"ct": 0,
|
|
||||||
"alert": "none",
|
"alert": "none",
|
||||||
"effect": "none",
|
"effect": "none",
|
||||||
"colormode": "",
|
|
||||||
"reachable": true
|
"reachable": true
|
||||||
},
|
},
|
||||||
"type": "Dimmable light",
|
"type": "Dimmable light",
|
||||||
"name": "Table Lamp 1",
|
"name": "Table Lamp 1",
|
||||||
"modelid": "LWB004",
|
"modelid": "LWB004",
|
||||||
"swversion": "65003148",
|
"swversion": "65003148",
|
||||||
"pointsymbol": {
|
|
||||||
"1": "none",
|
|
||||||
"2": "none",
|
|
||||||
"3": "none",
|
|
||||||
"4": "none",
|
|
||||||
"5": "none",
|
|
||||||
"6": "none",
|
|
||||||
"7": "none",
|
|
||||||
"8": "none"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"state": {
|
"state": {
|
||||||
"on": false,
|
"on": false,
|
||||||
"bri": 0,
|
"bri": 0,
|
||||||
"hue": 0,
|
|
||||||
"sat": 0,
|
|
||||||
"xy": [0,0],
|
|
||||||
"ct": 0,
|
|
||||||
"alert": "none",
|
"alert": "none",
|
||||||
"effect": "none",
|
"effect": "none",
|
||||||
"colormode": "",
|
|
||||||
"reachable": true
|
"reachable": true
|
||||||
},
|
},
|
||||||
"type": "Dimmable light",
|
"type": "Dimmable light",
|
||||||
"name": "Table Lamp 2",
|
"name": "Table Lamp 2",
|
||||||
"modelid": "LWB004",
|
"modelid": "LWB004",
|
||||||
"swversion": "65003148",
|
"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".
|
manufacturername | string 6, 32 | The manufacturer name will be "Philips".
|
||||||
luminaireuniqueid | string 6, 32 | This will be empty.
|
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".
|
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
|
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
|
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.
|
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".
|
alert | string | This will be set to "none".
|
||||||
effect | 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.
|
reachable | bool | Indicates if a light can be reached by the bridge and will be set to true.
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"state": {
|
"state": {
|
||||||
"hue": 0,
|
|
||||||
"on": true,
|
"on": true,
|
||||||
"effect": "none",
|
"effect": "none",
|
||||||
"alert": "none",
|
"alert": "none",
|
||||||
"bri": 254,
|
"bri": 254,
|
||||||
"sat": 254,
|
|
||||||
"ct": 0,
|
|
||||||
"xy": [0, 0],
|
|
||||||
"reachable": true,
|
"reachable": true,
|
||||||
"colormode": ""
|
|
||||||
},
|
},
|
||||||
"type": "Dimmable light",
|
"type": "Dimmable light",
|
||||||
"name": "Kitchen Ceiling",
|
"name": "Kitchen Ceiling",
|
||||||
"modelid": "LWB004",
|
"modelid": "LWB004",
|
||||||
"swversion": "65003148",
|
"swversion": "65003148",
|
||||||
"pointsymbol": {
|
|
||||||
"1": "none",
|
|
||||||
"2": "none",
|
|
||||||
"3": "none",
|
|
||||||
"4": "none",
|
|
||||||
"5": "none",
|
|
||||||
"6": "none",
|
|
||||||
"7": "none",
|
|
||||||
"8": "none"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### Set light state
|
### Set light state
|
||||||
@@ -575,57 +524,27 @@ rules | object | A collection of all rules and their attributes. This is not giv
|
|||||||
"state": {
|
"state": {
|
||||||
"on": false,
|
"on": false,
|
||||||
"bri": 0,
|
"bri": 0,
|
||||||
"hue": 0,
|
|
||||||
"sat": 254,
|
|
||||||
"xy": [0.0000, 0.0000],
|
|
||||||
"ct": 0,
|
|
||||||
"alert": "none",
|
"alert": "none",
|
||||||
"effect": "none",
|
"effect": "none",
|
||||||
"colormode": "",
|
|
||||||
"reachable": true
|
"reachable": true
|
||||||
},
|
},
|
||||||
"type": "Dimmable light",
|
"type": "Dimmable light",
|
||||||
"name": "Table Lamp 1",
|
"name": "Table Lamp 1",
|
||||||
"modelid": "LWB004",
|
"modelid": "LWB004",
|
||||||
"swversion": "65003148",
|
"swversion": "65003148",
|
||||||
"pointsymbol": {
|
|
||||||
"1": "none",
|
|
||||||
"2": "none",
|
|
||||||
"3": "none",
|
|
||||||
"4": "none",
|
|
||||||
"5": "none",
|
|
||||||
"6": "none",
|
|
||||||
"7": "none",
|
|
||||||
"8": "none"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"2": {
|
"2": {
|
||||||
"state": {
|
"state": {
|
||||||
"on": true,
|
"on": true,
|
||||||
"bri": 254,
|
"bri": 254,
|
||||||
"hue": 0,
|
|
||||||
"sat": 254,
|
|
||||||
"xy": [0, 0],
|
|
||||||
"ct": 0,
|
|
||||||
"alert": "none",
|
"alert": "none",
|
||||||
"effect": "none",
|
"effect": "none",
|
||||||
"colormode": "",
|
|
||||||
"reachable": true
|
"reachable": true
|
||||||
},
|
},
|
||||||
"type": "Dimmable light",
|
"type": "Dimmable light",
|
||||||
"name": "Table Lamp 2",
|
"name": "Table Lamp 2",
|
||||||
"modelid": "LWB004",
|
"modelid": "LWB004",
|
||||||
"swversion": "65003148",
|
"swversion": "65003148",
|
||||||
"pointsymbol": {
|
|
||||||
"1": "none",
|
|
||||||
"2": "none",
|
|
||||||
"3": "none",
|
|
||||||
"4": "none",
|
|
||||||
"5": "none",
|
|
||||||
"6": "none",
|
|
||||||
"7": "none",
|
|
||||||
"8": "none"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scenes":{
|
"scenes":{
|
||||||
|
|||||||
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>1.0.7</version>
|
<version>1.0.8</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>HA Bridge</name>
|
<name>HA Bridge</name>
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.bwssystems.HABridge.api.hue;
|
package com.bwssystems.HABridge.api.hue;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by arm on 4/14/15.
|
* Created by arm on 4/14/15.
|
||||||
*/
|
*/
|
||||||
@@ -14,7 +11,6 @@ public class DeviceResponse {
|
|||||||
private String manufacturername;
|
private String manufacturername;
|
||||||
private String uniqueid;
|
private String uniqueid;
|
||||||
private String swversion;
|
private String swversion;
|
||||||
private Map<String, String> pointsymbol;
|
|
||||||
|
|
||||||
public DeviceState getState() {
|
public DeviceState getState() {
|
||||||
return state;
|
return state;
|
||||||
@@ -72,27 +68,6 @@ public class DeviceResponse {
|
|||||||
this.swversion = swversion;
|
this.swversion = swversion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> 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<String, String> pointsymbol) {
|
|
||||||
this.pointsymbol = pointsymbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DeviceResponse createResponse(String name, String id){
|
public static DeviceResponse createResponse(String name, String id){
|
||||||
DeviceState deviceState = new DeviceState();
|
DeviceState deviceState = new DeviceState();
|
||||||
DeviceResponse response = new DeviceResponse();
|
DeviceResponse response = new DeviceResponse();
|
||||||
@@ -102,14 +77,13 @@ public class DeviceResponse {
|
|||||||
deviceState.setEffect("none");
|
deviceState.setEffect("none");
|
||||||
deviceState.setAlert("none");
|
deviceState.setAlert("none");
|
||||||
deviceState.setBri(254);
|
deviceState.setBri(254);
|
||||||
deviceState.setSat(254);
|
|
||||||
|
|
||||||
response.setName(name);
|
response.setName(name);
|
||||||
response.setUniqueid(id);
|
response.setUniqueid(id);
|
||||||
response.setManufacturername("Philips");
|
response.setManufacturername("Philips");
|
||||||
response.setType("Dimmable light");
|
response.setType("Dimmable light");
|
||||||
response.setModelid("LWB004");
|
response.setModelid("LWB004");
|
||||||
response.setSwversion("65003148");
|
response.setSwversion("66012040");
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.bwssystems.HABridge.api.hue;
|
package com.bwssystems.HABridge.api.hue;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by arm on 4/14/15.
|
* Created by arm on 4/14/15.
|
||||||
@@ -8,14 +7,9 @@ import java.util.List;
|
|||||||
public class DeviceState {
|
public class DeviceState {
|
||||||
private boolean on;
|
private boolean on;
|
||||||
private int bri = 255;
|
private int bri = 255;
|
||||||
private int hue;
|
|
||||||
private int sat;
|
|
||||||
private String effect;
|
private String effect;
|
||||||
private int ct;
|
|
||||||
private String alert;
|
private String alert;
|
||||||
private String colormode;
|
|
||||||
private boolean reachable;
|
private boolean reachable;
|
||||||
private List<Double> xy;
|
|
||||||
|
|
||||||
public boolean isOn() {
|
public boolean isOn() {
|
||||||
return on;
|
return on;
|
||||||
@@ -33,22 +27,6 @@ public class DeviceState {
|
|||||||
this.bri = bri;
|
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() {
|
public String getEffect() {
|
||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
@@ -57,14 +35,6 @@ public class DeviceState {
|
|||||||
this.effect = effect;
|
this.effect = effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCt() {
|
|
||||||
return ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCt(int ct) {
|
|
||||||
this.ct = ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAlert() {
|
public String getAlert() {
|
||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
@@ -73,14 +43,6 @@ public class DeviceState {
|
|||||||
this.alert = alert;
|
this.alert = alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getColormode() {
|
|
||||||
return colormode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColormode(String colormode) {
|
|
||||||
this.colormode = colormode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isReachable() {
|
public boolean isReachable() {
|
||||||
return reachable;
|
return reachable;
|
||||||
}
|
}
|
||||||
@@ -89,14 +51,6 @@ public class DeviceState {
|
|||||||
this.reachable = reachable;
|
this.reachable = reachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Double> getXy() {
|
|
||||||
return xy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setXy(List<Double> xy) {
|
|
||||||
this.xy = xy;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DeviceState{" +
|
return "DeviceState{" +
|
||||||
|
|||||||
Reference in New Issue
Block a user