2 * Copyright (c) 2010-2022 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";
36 String vendor = "Philips";
38 public HueLightState() {
41 public HueLightState(String model, String vendor) {
46 public HueLightState bri(int brightness) {
47 this.brightness = brightness;
51 public HueLightState hue(int hue) {
56 public HueLightState sat(int saturation) {
57 this.saturation = saturation;
61 public HueLightState ct(int colorTemperature) {
62 this.colorTemperature = colorTemperature;
66 public HueLightState on(boolean isOn) {
71 public HueLightState alert(String alert) {
76 public HueLightState effect(String effect) {
81 public HueLightState colormode(ColorMode colorMode) {
82 this.colorMode = colorMode.toString();
87 public String toString() {
93 " \"on\": " + isOn + "," + //
94 " \"bri\": " + brightness + "," + //
95 " \"hue\": " + hue + "," + //
96 " \"sat\": " + saturation + "," + //
101 " \"ct\": " + colorTemperature + "," + //
102 " \"alert\": \"" + alert + "\"," + //
103 " \"effect\": \"" + effect + "\"," + //
104 " \"colormode\": \"" + colorMode + "\"," + //
105 " \"reachable\": true" + //
107 " \"type\": \"Extended color light\"," + //
108 " \"name\": \"Hue Light 1\"," + //
109 " \"modelid\": \"" + model + "\"," + //
110 " \"manufacturername\": \"" + vendor + "\"," + //
111 " \"swversion\": \"65003148\"," + //
112 " \"uniqueid\": \"00:17:88:01:00:e1:88:29-0b\"," + //
113 " \"pointsymbol\": {" + //
114 " \"1\": \"none\"," + //
115 " \"2\": \"none\"," + //
116 " \"3\": \"none\"," + //
117 " \"4\": \"none\"," + //
118 " \"5\": \"none\"," + //
119 " \"6\": \"none\"," + //
120 " \"7\": \"none\"," + //
121 " \"8\": \"none\"" + //