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.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl;
15 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.BaseTemperatureControl;
16 import org.openhab.binding.digitalstrom.internal.lib.serverconnection.constants.JSONApiResponseKeysEnum;
18 import com.google.gson.JsonObject;
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.
25 * @author Michael Ochel - Initial contribution
26 * @author Matthias Siegele - Initial contribution
28 public class TemperatureControlInternals extends BaseTemperatureControl {
30 private Short controlState;
31 private Float ctrlTRecent;
32 private Float ctrlTReference;
33 private Float ctrlTError;
34 private Float ctrlTErrorPrev;
35 private Float ctrlIntegral;
40 private Short ctrlAntiWindUp;
43 * Creates a new {@link TemperatureControlInternals} through the {@link JsonObject} which will be returned by an
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.
49 * @param jObject must not be null
50 * @param zoneID must not be null
51 * @param zoneName can be null
53 public TemperatureControlInternals(JsonObject jObject, Integer zoneID, String zoneName) {
54 super(jObject, zoneID, zoneName);
56 if (jObject.get(JSONApiResponseKeysEnum.CONTROL_STATE.getKey()) != null) {
57 this.controlState = jObject.get(JSONApiResponseKeysEnum.CONTROL_STATE.getKey()).getAsShort();
59 if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_RECENT.getKey()) != null) {
60 this.ctrlTRecent = jObject.get(JSONApiResponseKeysEnum.CTRL_T_RECENT.getKey()).getAsFloat();
62 if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_REFERENCE.getKey()) != null) {
63 this.ctrlTReference = jObject.get(JSONApiResponseKeysEnum.CTRL_T_REFERENCE.getKey()).getAsFloat();
65 if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR.getKey()) != null) {
66 this.ctrlTError = jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR.getKey()).getAsFloat();
68 if (jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR_PREV.getKey()) != null) {
69 this.ctrlTErrorPrev = jObject.get(JSONApiResponseKeysEnum.CTRL_T_ERROR_PREV.getKey()).getAsFloat();
71 if (jObject.get(JSONApiResponseKeysEnum.CTRL_INTEGRAL.getKey()) != null) {
72 this.ctrlIntegral = jObject.get(JSONApiResponseKeysEnum.CTRL_INTEGRAL.getKey()).getAsFloat();
74 if (jObject.get(JSONApiResponseKeysEnum.CTRL_YP.getKey()) != null) {
75 this.ctrlY = jObject.get(JSONApiResponseKeysEnum.CTRL_YP.getKey()).getAsFloat();
77 if (jObject.get(JSONApiResponseKeysEnum.CTRL_YI.getKey()) != null) {
78 this.ctrlYi = jObject.get(JSONApiResponseKeysEnum.CTRL_YI.getKey()).getAsFloat();
80 if (jObject.get(JSONApiResponseKeysEnum.CTRL_YD.getKey()) != null) {
81 this.ctrlYd = jObject.get(JSONApiResponseKeysEnum.CTRL_YD.getKey()).getAsFloat();
83 if (jObject.get(JSONApiResponseKeysEnum.CTRL_Y.getKey()) != null) {
84 this.ctrlY = jObject.get(JSONApiResponseKeysEnum.CTRL_Y.getKey()).getAsFloat();
86 if (jObject.get(JSONApiResponseKeysEnum.CTRL_ANTI_WIND_UP.getKey()) != null) {
87 this.ctrlAntiWindUp = jObject.get(JSONApiResponseKeysEnum.CTRL_ANTI_WIND_UP.getKey()).getAsShort();
93 * Returns the controleState for heating of the zone.
95 * @return the controlState
97 public Short getControlState() {
102 * Returns the ctrlTRecent for heating of the zone.
104 * @return the ctrlTRecent
106 public Float getCtrlTRecent() {
111 * Returns the ctrlTReference for heating of the zone.
113 * @return the ctrlTReference
115 public Float getCtrlTReference() {
116 return ctrlTReference;
120 * Returns the ctrlTError for heating of the zone.
122 * @return the ctrlTError
124 public Float getCtrlTError() {
129 * Returns the ctrlTErrorPrev for heating of the zone.
131 * @return the ctrlTErrorPrev
133 public Float getCtrlTErrorPrev() {
134 return ctrlTErrorPrev;
138 * Returns the ctrlIntegral for heating of the zone.
140 * @return the ctrlIntegral
142 public Float getCtrlIntegral() {
147 * Returns the ctrlYp for heating of the zone.
151 public Float getCtrlYp() {
156 * Returns the ctrlYi for heating of the zone.
160 public Float getCtrlYi() {
165 * Returns the ctrlYd for heating of the zone.
169 public Float getCtrlYd() {
174 * Returns the ctrlY for heating of the zone.
178 public Float getCtrlY() {
183 * Returns the ctrlAntiWindUp for heating of the zone.
185 * @return the ctrlAntiWindUp
187 public Short getCtrlAntiWindUp() {
188 return ctrlAntiWindUp;
194 * @see java.lang.Object#toString()
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 + "]";