2 * Copyright (c) 2010-2023 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.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.hue.internal.api.dto.clip1.State.ColorMode;
19 * Builder for the current state of a hue light.
21 * @author Dominic Lerbs - Initial contribution
22 * @author Markus Mazurczak - Added possibility to set modelId to "PAR16 50 TW" to test osram workaround
23 * @author Markus Rathgeb - migrated to plain Java test
24 * @author Christoph Weitkamp - Added support for bulbs using CIE XY colormode only
27 public class HueLightState {
32 int colorTemperature = 153;
34 String alert = "none";
35 String effect = "none";
36 String colorMode = "hs";
37 String model = "LCT001";
38 String vendor = "Philips";
40 public HueLightState() {
43 public HueLightState(String model, String vendor) {
48 public HueLightState bri(int brightness) {
49 this.brightness = brightness;
53 public HueLightState hue(int hue) {
58 public HueLightState sat(int saturation) {
59 this.saturation = saturation;
63 public HueLightState ct(int colorTemperature) {
64 this.colorTemperature = colorTemperature;
68 public HueLightState on(boolean isOn) {
73 public HueLightState alert(String alert) {
78 public HueLightState effect(String effect) {
83 public HueLightState colormode(ColorMode colorMode) {
84 this.colorMode = colorMode.toString();
89 public String toString() {
95 " \"on\": " + isOn + "," + //
96 " \"bri\": " + brightness + "," + //
97 " \"hue\": " + hue + "," + //
98 " \"sat\": " + saturation + "," + //
103 " \"ct\": " + colorTemperature + "," + //
104 " \"alert\": \"" + alert + "\"," + //
105 " \"effect\": \"" + effect + "\"," + //
106 " \"colormode\": \"" + colorMode + "\"," + //
107 " \"reachable\": true" + //
109 " \"type\": \"Extended color light\"," + //
110 " \"name\": \"Hue Light 1\"," + //
111 " \"modelid\": \"" + model + "\"," + //
112 " \"manufacturername\": \"" + vendor + "\"," + //
113 " \"swversion\": \"65003148\"," + //
114 " \"uniqueid\": \"00:17:88:01:00:e1:88:29-0b\"," + //
115 " \"pointsymbol\": {" + //
116 " \"1\": \"none\"," + //
117 " \"2\": \"none\"," + //
118 " \"3\": \"none\"," + //
119 " \"4\": \"none\"," + //
120 " \"5\": \"none\"," + //
121 " \"6\": \"none\"," + //
122 " \"7\": \"none\"," + //
123 " \"8\": \"none\"" + //