2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.hue.internal.handler;
15 import org.openhab.binding.hue.internal.State.ColorMode;
18 * Builder for the current state of a hue light.
20 * @author Dominic Lerbs - Initial contribution
21 * @author Markus Mazurczak - Added possibility to set modelId to "PAR16 50 TW" to test osram workaround
22 * @author Markus Rathgeb - migrated to plain Java test
23 * @author Christoph Weitkamp - Added support for bulbs using CIE XY colormode only
25 public class HueLightState {
30 int colorTemperature = 153;
32 String alert = "none";
33 String effect = "none";
34 String colorMode = "hs";
35 String model = "LCT001";
37 public HueLightState() {
40 public HueLightState(String model) {
44 public HueLightState bri(int brightness) {
45 this.brightness = brightness;
49 public HueLightState hue(int hue) {
54 public HueLightState sat(int saturation) {
55 this.saturation = saturation;
59 public HueLightState ct(int colorTemperature) {
60 this.colorTemperature = colorTemperature;
64 public HueLightState on(boolean isOn) {
69 public HueLightState alert(String alert) {
74 public HueLightState effect(String effect) {
79 public HueLightState colormode(ColorMode colorMode) {
80 this.colorMode = colorMode.toString();
85 public String toString() {
91 " \"on\": " + isOn + "," + //
92 " \"bri\": " + brightness + "," + //
93 " \"hue\": " + hue + "," + //
94 " \"sat\": " + saturation + "," + //
99 " \"ct\": " + colorTemperature + "," + //
100 " \"alert\": \"" + alert + "\"," + //
101 " \"effect\": \"" + effect + "\"," + //
102 " \"colormode\": \"" + colorMode + "\"," + //
103 " \"reachable\": true" + //
105 " \"type\": \"Extended color light\"," + //
106 " \"name\": \"Hue Light 1\"," + //
107 " \"modelid\": \"" + model + "\"," + //
108 " \"swversion\": \"65003148\"," + //
109 " \"uniqueid\": \"00:17:88:01:00:e1:88:29-0b\"," + //
110 " \"pointsymbol\": {" + //
111 " \"1\": \"none\"," + //
112 " \"2\": \"none\"," + //
113 " \"3\": \"none\"," + //
114 " \"4\": \"none\"," + //
115 " \"5\": \"none\"," + //
116 " \"6\": \"none\"," + //
117 " \"7\": \"none\"," + //
118 " \"8\": \"none\"" + //