Skip to content

Commit

Permalink
[hue] Keep compatibility with hue emulation for groups (openhab#7809)
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Daan Meijer <daan@studioseptember.nl>
  • Loading branch information
lolodomo authored and DaanMeijer committed Sep 1, 2020
1 parent 8ac519c commit 27455ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class FullGroup extends Group {

private State action;
private List<String> lights;
private State state; // Will not be set by hue API
private State groupState; // Will not be set by hue API

FullGroup() {
}
Expand Down Expand Up @@ -61,6 +61,10 @@ public List<String> getLights() {
* @return current state
*/
public State getState() {
return state;
return groupState;
}

public void setState(State state) {
this.groupState = state;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class State {
String colormode;
private boolean reachable;

State() {
public State() {
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected void doConnectedRun() throws IOException, ApiException {
Map<String, FullGroup> lastGroupStateCopy = new HashMap<>(lastGroupStates);

for (final FullGroup fullGroup : hueBridge.getGroups()) {
State groupState = fullGroup.getState();
State groupState = new State();
boolean on = false;
int sumBri = 0;
int nbBri = 0;
Expand Down Expand Up @@ -278,6 +278,7 @@ protected void doConnectedRun() throws IOException, ApiException {
groupState.setColorTemperature(colorRef.getColorTemperature());
groupState.setXY(colorRef.getXY());
}
fullGroup.setState(groupState);
logger.trace("Group {} ({}): on {} bri {} hue {} sat {} temp {} mode {} XY {}", fullGroup.getName(),
fullGroup.getType(), groupState.isOn(), groupState.getBrightness(), groupState.getHue(),
groupState.getSaturation(), groupState.getColorTemperature(), groupState.getColorMode(),
Expand Down

0 comments on commit 27455ed

Please sign in to comment.