]> git.basschouten.com Git - openhab-addons.git/blob
41c1aa2351592aadb8e7b8e09babdb63e0f569b5
[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.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl;
14
15 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.BaseTemperatureControl;
16 import org.openhab.binding.digitalstrom.internal.lib.serverconnection.constants.JSONApiResponseKeysEnum;
17
18 import com.google.gson.JsonObject;
19
20 /**
21  * The {@link TemperatureControlInternals} acts as container for the digitalSTROM json-method
22  * <i>getTemperatureControlInternals</i>. So the {@link TemperatureControlInternals} contains all internal heating
23  * control configurations of a zone.
24  *
25  * @author Michael Ochel - Initial contribution
26  * @author Matthias Siegele - Initial contribution
27  */
28 public class TemperatureControlInternals extends BaseTemperatureControl {
29
30     private Short controlState;
31     private Float ctrlTRecent;
32     private Float ctrlTReference;
33     private Float ctrlTError;
34     private Float ctrlTErrorPrev;
35     private Float ctrlIntegral;
36     private Float ctrlYp;
37     private Float ctrlYi;
38     private Float ctrlYd;
39     private Float ctrlY;
40     private Short ctrlAntiWindUp;
41
42     /**
43      * Creates a new {@link TemperatureControlInternals} through the {@link JsonObject} which will be returned by an
44      * zone
45      * call.<br>
46      * Because of zone calls does not include a zoneID or zoneName in the json response, the zoneID and zoneName have to
47      * be handed over the constructor.
48      *
49      * @param jObject must not be null
50      * @param zoneID must not be null
51      * @param zoneName can be null
52      */
53     public TemperatureControlInternals(JsonObject jObject, Integer zoneID, String zoneName) {
54         super(jObject, zoneID, zoneName);
55         if (isNotSetOff()) {
56             if (jObject.get(JSONApiResponseKeysEnum.CONTROL_STATE.getKey()) != null) {
57                 this.controlState = jObject.get(JSONApiResponseKeysEnum.CONTROL_STATE.getKey()).getAsShort();
58             }
59             if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_RECENT.getKey()) != null) {
60                 this.ctrlTRecent = jObject.get(JSONApiResponseKeysEnum.CTRL_T_RECENT.getKey()).getAsFloat();
61             }
62             if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_REFERENCE.getKey()) != null) {
63                 this.ctrlTReference = jObject.get(JSONApiResponseKeysEnum.CTRL_T_REFERENCE.getKey()).getAsFloat();
64             }
65             if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR.getKey()) != null) {
66                 this.ctrlTError = jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR.getKey()).getAsFloat();
67             }
68             if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR_PREV.getKey()) != null) {
69                 this.ctrlTErrorPrev = jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR_PREV.getKey()).getAsFloat();
70             }
71             if (jObject.get(JSONApiResponseKeysEnum.CTRL_INTEGRAL.getKey()) != null) {
72                 this.ctrlIntegral = jObject.get(JSONApiResponseKeysEnum.CTRL_INTEGRAL.getKey()).getAsFloat();
73             }
74             if (jObject.get(JSONApiResponseKeysEnum.CTRL_YP.getKey()) != null) {
75                 this.ctrlY = jObject.get(JSONApiResponseKeysEnum.CTRL_YP.getKey()).getAsFloat();
76             }
77             if (jObject.get(JSONApiResponseKeysEnum.CTRL_YI.getKey()) != null) {
78                 this.ctrlYi = jObject.get(JSONApiResponseKeysEnum.CTRL_YI.getKey()).getAsFloat();
79             }
80             if (jObject.get(JSONApiResponseKeysEnum.CTRL_YD.getKey()) != null) {
81                 this.ctrlYd = jObject.get(JSONApiResponseKeysEnum.CTRL_YD.getKey()).getAsFloat();
82             }
83             if (jObject.get(JSONApiResponseKeysEnum.CTRL_Y.getKey()) != null) {
84                 this.ctrlY = jObject.get(JSONApiResponseKeysEnum.CTRL_Y.getKey()).getAsFloat();
85             }
86             if (jObject.get(JSONApiResponseKeysEnum.CTRL_ANTI_WIND_UP.getKey()) != null) {
87                 this.ctrlAntiWindUp = jObject.get(JSONApiResponseKeysEnum.CTRL_ANTI_WIND_UP.getKey()).getAsShort();
88             }
89         }
90     }
91
92     /**
93      * Returns the controleState for heating of the zone.
94      *
95      * @return the controlState
96      */
97     public Short getControlState() {
98         return controlState;
99     }
100
101     /**
102      * Returns the ctrlTRecent for heating of the zone.
103      *
104      * @return the ctrlTRecent
105      */
106     public Float getCtrlTRecent() {
107         return ctrlTRecent;
108     }
109
110     /**
111      * Returns the ctrlTReference for heating of the zone.
112      *
113      * @return the ctrlTReference
114      */
115     public Float getCtrlTReference() {
116         return ctrlTReference;
117     }
118
119     /**
120      * Returns the ctrlTError for heating of the zone.
121      *
122      * @return the ctrlTError
123      */
124     public Float getCtrlTError() {
125         return ctrlTError;
126     }
127
128     /**
129      * Returns the ctrlTErrorPrev for heating of the zone.
130      *
131      * @return the ctrlTErrorPrev
132      */
133     public Float getCtrlTErrorPrev() {
134         return ctrlTErrorPrev;
135     }
136
137     /**
138      * Returns the ctrlIntegral for heating of the zone.
139      *
140      * @return the ctrlIntegral
141      */
142     public Float getCtrlIntegral() {
143         return ctrlIntegral;
144     }
145
146     /**
147      * Returns the ctrlYp for heating of the zone.
148      *
149      * @return the ctrlYp
150      */
151     public Float getCtrlYp() {
152         return ctrlYp;
153     }
154
155     /**
156      * Returns the ctrlYi for heating of the zone.
157      *
158      * @return the ctrlYi
159      */
160     public Float getCtrlYi() {
161         return ctrlYi;
162     }
163
164     /**
165      * Returns the ctrlYd for heating of the zone.
166      *
167      * @return the ctrlYd
168      */
169     public Float getCtrlYd() {
170         return ctrlYd;
171     }
172
173     /**
174      * Returns the ctrlY for heating of the zone.
175      *
176      * @return the ctrlY
177      */
178     public Float getCtrlY() {
179         return ctrlY;
180     }
181
182     /**
183      * Returns the ctrlAntiWindUp for heating of the zone.
184      *
185      * @return the ctrlAntiWindUp
186      */
187     public Short getCtrlAntiWindUp() {
188         return ctrlAntiWindUp;
189     }
190
191     /*
192      * (non-Javadoc)
193      *
194      * @see java.lang.Object#toString()
195      */
196     @Override
197     public String toString() {
198         return "TemperatureControlInternals [controlState=" + controlState + ", ctrlTRecent=" + ctrlTRecent
199                 + ", ctrlTReference=" + ctrlTReference + ", ctrlTError=" + ctrlTError + ", ctrlTErrorPrev="
200                 + ctrlTErrorPrev + ", ctrlIntegral=" + ctrlIntegral + ", ctrlYp=" + ctrlYp + ", ctrlYi=" + ctrlYi
201                 + ", ctrlYd=" + ctrlYd + ", ctrlY=" + ctrlY + ", ctrlAntiWindUp=" + ctrlAntiWindUp + "]";
202     }
203 }