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.nanoleaf.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.library.types.OnOffType;
19 import com.google.gson.annotations.SerializedName;
22 * Represents overall state settings of the light panels
24 * @author Martin Raepple - Initial contribution
29 private @Nullable On on;
30 private @Nullable Brightness brightness;
31 private @Nullable Hue hue;
32 @SerializedName("sat")
33 private @Nullable Sat saturation;
35 private @Nullable Ct colorTemperature;
37 private @Nullable String colorMode;
39 public @Nullable On getOn() {
43 public OnOffType getOnOff() {
45 return OnOffType.from((localOn != null && localOn.getValue()));
48 public void setOn(On on) {
52 public @Nullable Brightness getBrightness() {
56 public void setBrightness(Brightness brightness) {
57 this.brightness = brightness;
60 public @Nullable Hue getHue() {
64 public void setHue(Hue hue) {
68 public @Nullable Sat getSaturation() {
72 public void setSaturation(Sat sat) {
73 this.saturation = sat;
76 public @Nullable Ct getColorTemperature() {
77 return colorTemperature;
80 public void setColorTemperature(Ct ct) {
81 this.colorTemperature = ct;
84 public @Nullable String getColorMode() {
88 public void setColorMode(String colorMode) {
89 this.colorMode = colorMode;
92 public void setState(IntegerState value) {
93 if (value instanceof Brightness brightnessState) {
94 this.setBrightness(brightnessState);
95 } else if (value instanceof Hue hueState) {
96 this.setHue(hueState);
97 } else if (value instanceof Sat satState) {
98 this.setSaturation(satState);
99 } else if (value instanceof Ct ctState) {
100 this.setColorTemperature(ctState);
104 public void setState(BooleanState value) {
105 if (value instanceof On onState) {