]> git.basschouten.com Git - openhab-addons.git/blob
aea75c0e82d3aed52b79c9dfab14e2e858a9b204
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.vesync.internal.dto.requests;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * The {@link VeSyncRequestManagedDeviceBypassV2} is a Java class used as a DTO to hold the Vesync's API's common
19  * request data for V2 ByPass payloads.
20  *
21  * @author David Goodyear - Initial contribution
22  */
23 public class VeSyncRequestManagedDeviceBypassV2 extends VeSyncAuthenticatedRequest {
24
25     @SerializedName("deviceRegion")
26     public String deviceRegion = "";
27
28     @SerializedName("debugMode")
29     public boolean debugMode = false;
30
31     @SerializedName("cid")
32     public String cid = "";
33
34     @SerializedName("configModule")
35     public String configModule = "";
36
37     @SerializedName("payload")
38     public VesyncManagedDeviceBase payload = new VesyncManagedDeviceBase();
39
40     /**
41      * Contains basic information about the device.
42      */
43     public class VesyncManagedDeviceBase {
44
45         @SerializedName("method")
46         public String method;
47
48         @SerializedName("source")
49         public String source = "APP";
50
51         @SerializedName("data")
52         public EmptyPayload data = new EmptyPayload();
53     }
54
55     public static class EmptyPayload {
56     }
57
58     public static class SetSwitchPayload extends EmptyPayload {
59
60         public SetSwitchPayload(final boolean enabled, final int id) {
61             this.enabled = enabled;
62             this.id = id;
63         }
64
65         @SerializedName("enabled")
66         public boolean enabled = true;
67
68         @SerializedName("id")
69         public int id = -1;
70     }
71
72     public static class EnabledPayload extends EmptyPayload {
73
74         public EnabledPayload(final boolean enabled) {
75             this.enabled = enabled;
76         }
77
78         @SerializedName("enabled")
79         public boolean enabled = true;
80     }
81
82     public static class SetLevelPayload extends EmptyPayload {
83
84         public SetLevelPayload(final int id, final String type, final int level) {
85             this.id = id;
86             this.type = type;
87             this.level = level;
88         }
89
90         @SerializedName("id")
91         public int id = -1;
92
93         @SerializedName("level")
94         public int level = -1;
95
96         @SerializedName("type")
97         public String type = "";
98     }
99
100     public static class SetState extends EmptyPayload {
101
102         public SetState(final boolean state) {
103             this.state = state;
104         }
105
106         @SerializedName("state")
107         public boolean state = false;
108     }
109
110     public static class SetNightLight extends EmptyPayload {
111
112         public SetNightLight(final String state) {
113             this.nightLight = state;
114         }
115
116         @SerializedName("night_light")
117         public String nightLight = "";
118     }
119
120     public static class SetNightLightBrightness extends EmptyPayload {
121
122         public SetNightLightBrightness(final int state) {
123             this.nightLightLevel = state;
124         }
125
126         @SerializedName("night_light_brightness")
127         public int nightLightLevel = 0;
128     }
129
130     public static class SetTargetHumidity extends EmptyPayload {
131
132         public SetTargetHumidity(final int state) {
133             this.targetHumidity = state;
134         }
135
136         @SerializedName("target_humidity")
137         public int targetHumidity = 0;
138     }
139
140     public static class SetChildLock extends EmptyPayload {
141
142         public SetChildLock(final boolean childLock) {
143             this.childLock = childLock;
144         }
145
146         @SerializedName("child_lock")
147         public boolean childLock = false;
148     }
149
150     public static class SetMode extends EmptyPayload {
151
152         public SetMode(final String mode) {
153             this.mode = mode;
154         }
155
156         @SerializedName("mode")
157         public String mode = "";
158     }
159
160     public VeSyncRequestManagedDeviceBypassV2() {
161         super();
162         method = "bypassV2";
163     }
164 }