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.tplinksmarthome.internal.model;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import com.google.gson.annotations.Expose;
18 import com.google.gson.annotations.SerializedName;
21 * Data class to set the Brightness of a Smart Home dimmer (HS220).
22 * Setter methods for data and getter for error response.
24 * @author Hilbrand Bouwkamp - Initial contribution
27 public class SetBrightness implements HasErrorResponse {
29 public static class Brightness extends ErrorResponse {
30 @Expose(deserialize = false)
31 private int brightness;
34 public String toString() {
35 return "brightness:" + brightness + super.toString();
39 public static class Dimmer {
41 private Brightness setBrightness = new Brightness();
44 public String toString() {
45 return "set_brightness:{" + setBrightness + "}";
50 @SerializedName("smartlife.iot.dimmer")
51 private Dimmer dimmer = new Dimmer();
54 public ErrorResponse getErrorResponse() {
55 return dimmer.setBrightness;
58 public void setBrightness(int brightness) {
59 dimmer.setBrightness.brightness = brightness;
63 public String toString() {
64 return "smartlife.iot.dimmer:{" + dimmer + "}";