]> git.basschouten.com Git - openhab-addons.git/blob
2ea5e9ad25ab3de88cad2323a4c64e69e2a8421a
[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.serverconnection;
14
15 import java.util.List;
16 import java.util.Map;
17
18 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.BaseSensorValues;
19 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.AssignedSensors;
20 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.SensorValues;
21 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlConfig;
22 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlInternals;
23 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlStatus;
24 import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlValues;
25 import org.openhab.binding.digitalstrom.internal.lib.structure.Apartment;
26 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit;
27 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device;
28 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.CachedMeteringValue;
29 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.DeviceConfig;
30 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.DeviceSceneSpec;
31 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.DeviceParameterClassEnum;
32 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.MeteringTypeEnum;
33 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.MeteringUnitsEnum;
34 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum;
35 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID;
36 import org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants.Scene;
37 import org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants.SceneEnum;
38
39 import com.google.gson.JsonArray;
40 import com.google.gson.JsonObject;
41
42 /**
43  * digitalSTROM-API based on dSS-Version higher then 1.14.5.
44  * digitalSTROM documentation can be found at http://developer.digitalstrom.org/Architecture/v1.1/dss-json.pdf
45  *
46  * @author Alexander Betker - Initial contribution
47  *
48  * @author Michael Ochel - add missing java-doc, update digitalSTROM-JSON-API as far as possible to the pdf version from
49  *         June 19, 2014 and add checkConnection method and ALL_METERS constant
50  * @author Matthias Siegele - add missing java-doc, update digitalSTROM-JSON-API as far as possible to the pdf version
51  *         from June 19, 2014 and add checkConnection method and ALL_METERS constant
52  */
53 public interface DsAPI {
54
55     /**
56      * Meter field to get all meters by calling {@link #getLatest(String, MeteringTypeEnum, String, MeteringUnitsEnum)}.
57      * It has to be set by meterDSIDs.
58      */
59     static final String ALL_METERS = ".meters(all)";
60
61     /**
62      * Calls the scene sceneNumber on all devices of the apartment. If groupID
63      * or groupName are specified. Only devices contained in this group will be
64      * addressed.
65      *
66      * @param sessionToken can be null, if a
67      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
68      *            registered at the {@link HttpTransport}
69      * @param groupID not required
70      * @param groupName not required
71      * @param sceneNumber required
72      * @param force not required
73      * @return true, if successful
74      */
75     boolean callApartmentScene(String sessionToken, Short groupID, String groupName, Scene sceneNumber, Boolean force);
76
77     /**
78      * Returns all zones
79      *
80      * @param sessionToken can be null, if a
81      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
82      *            registered at the {@link HttpTransport}
83      * @return Apartment
84      */
85     Apartment getApartmentStructure(String sessionToken);
86
87     /**
88      * Returns the list of devices in the apartment. If unassigned is true,
89      * only devices that are not assigned to a zone will be returned.
90      *
91      * @param sessionToken can be null, if a
92      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
93      *            registered at the {@link HttpTransport}
94      * @return List of devices
95      */
96     List<Device> getApartmentDevices(String sessionToken);
97
98     /**
99      * Returns an array containing all digitalSTROM-Meters of the apartment.
100      *
101      * @param sessionToken can be null, if a
102      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
103      *            registered at the {@link HttpTransport}
104      * @return List of all {@link Circuit}s
105      */
106     List<Circuit> getApartmentCircuits(String sessionToken);
107
108     /**
109      * Returns a list of dSID's of all meters(dSMs)
110      *
111      * @param sessionToken can be null, if a
112      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
113      *            registered at the {@link HttpTransport}
114      * @return String-List with dSID's
115      */
116     List<String> getMeterList(String sessionToken);
117
118     /**
119      * Calls the sceneNumber on all devices in the given zone. If groupID or groupName
120      * are specified only devices contained in this group will be addressed.
121      *
122      * @param sessionToken can be null, if a
123      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
124      *            registered at the {@link HttpTransport}
125      * @param zoneID needs either id or name
126      * @param zoneName needs either id or name
127      * @param groupID not required
128      * @param groupName not required
129      * @param sceneNumber required (only a zone/user scene is possible - sceneNumber 0..63 )
130      * @param force not required
131      * @return true on success
132      */
133     boolean callZoneScene(String sessionToken, Integer zoneID, String zoneName, Short groupID, String groupName,
134             SceneEnum sceneNumber, Boolean force);
135
136     /**
137      * Turns the device on. This will call the scene "max" on the device.
138      *
139      * @param sessionToken can be null, if a
140      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
141      *            registered at the {@link HttpTransport}
142      * @param dSID needs either dSID, dSUID or name
143      * @param dSUID needs either dSID, dSUID or name
144      * @param deviceName needs either dSID, dsUID or name
145      * @return true, if successful
146      */
147     boolean turnDeviceOn(String sessionToken, DSID dSID, String dSUID, String deviceName);
148
149     /**
150      * Turns the device off. This will call the scene "min" on the device.
151      *
152      * @param sessionToken can be null, if a
153      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
154      *            registered at the {@link HttpTransport}
155      * @param dSID needs either dSID, dSUID or name
156      * @param dSUID needs either dSID, dSUID or name
157      * @param deviceName needs either dSID, dsUID or name
158      * @return true, if successful
159      */
160     boolean turnDeviceOff(String sessionToken, DSID dSID, String dSUID, String deviceName);
161
162     /**
163      * Sets the output value of device.
164      *
165      * @param sessionToken can be null, if a
166      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
167      *            registered at the {@link HttpTransport}
168      * @param dSID needs either dSID, dSUID or name
169      * @param dSUID needs either dSID, dSUID or name
170      * @param deviceName needs either dSID, dsUID or name
171      * @param value required (0 - 255)
172      * @return true, if successful
173      */
174     boolean setDeviceValue(String sessionToken, DSID dSID, String dSUID, String deviceName, Integer value);
175
176     /**
177      * Gets the value of configuration class at offset index.
178      *
179      * @param sessionToken can be null, if a
180      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
181      *            registered at the {@link HttpTransport}
182      * @param dSID needs either dSID, dSUID or name
183      * @param dSUID needs either dSID, dSUID or name
184      * @param deviceName needs either dSID, dsUID or name
185      * @param clazz required
186      * @param index required
187      * @return config with values
188      */
189     DeviceConfig getDeviceConfig(String sessionToken, DSID dSID, String dSUID, String deviceName,
190             DeviceParameterClassEnum clazz, Integer index);
191
192     /**
193      * Gets the device output value from parameter at the given offset.
194      * The available parameters and offsets depend on the features of the
195      * hardware components.
196      *
197      * @param sessionToken can be null, if a
198      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
199      *            registered at the {@link HttpTransport}
200      * @param dSID needs either dSID, dSUID or name
201      * @param dSUID needs either dSID, dSUID or name
202      * @param deviceName needs either dSID, dsUID or name
203      * @param offset required (known offset e.g. 0)
204      * @return current device output value or -1, if the request was not successful
205      */
206     int getDeviceOutputValue(String sessionToken, DSID dSID, String dSUID, String deviceName, Short offset);
207
208     /**
209      * Sets the device output value at the given offset. The available
210      * parameters and offsets depend on the features of the hardware components.
211      *
212      * @param sessionToken can be null, if a
213      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
214      *            registered at the {@link HttpTransport}
215      * @param dSID needs either dSID, dSUID or name
216      * @param dSUID needs either dSID, dSUID or name
217      * @param deviceName needs either dSID, dsUID or name
218      * @param offset required
219      * @param value required (0 - 65535)
220      * @return true, if successful
221      */
222     boolean setDeviceOutputValue(String sessionToken, DSID dSID, String dSUID, String deviceName, Short offset,
223             Integer value);
224
225     /**
226      * Gets the device configuration for a specific scene command.
227      *
228      * @param sessionToken can be null, if a
229      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
230      *            registered at the {@link HttpTransport}
231      * @param dSID needs either dSID, dSUID or name
232      * @param dSUID needs either dSID, dSUID or name
233      * @param deviceName needs either dSID, dsUID or name
234      * @param sceneID required (0 .. 255)
235      * @return scene configuration
236      */
237     DeviceSceneSpec getDeviceSceneMode(String sessionToken, DSID dSID, String dSUID, String deviceName, Short sceneID);
238
239     /**
240      * Requests the sensor value for a given index.
241      *
242      * @param sessionToken can be null, if a
243      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
244      *            registered at the {@link HttpTransport}
245      * @param dSID needs either dSID, dSUID or name
246      * @param dSUID needs either dSID, dSUID or name
247      * @param deviceName needs either dSID, dsUID or name
248      * @param sensorIndex required
249      * @return sensor value
250      */
251     short getDeviceSensorValue(String sessionToken, DSID dSID, String dSUID, String deviceName, Short sensorIndex);
252
253     /**
254      * Calls scene sceneNumber on the device.
255      *
256      * @param sessionToken can be null, if a
257      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
258      *            registered at the {@link HttpTransport}
259      * @param dSID needs either dSID, dSUID or name
260      * @param dSUID needs either dSID, dSUID or name
261      * @param deviceName needs either dSID, dsUID or name
262      * @param sceneNumber required
263      * @param force not required
264      * @return true, if successful
265      */
266     boolean callDeviceScene(String sessionToken, DSID dSID, String dSUID, String deviceName, Scene sceneNumber,
267             Boolean force);
268
269     /**
270      * Subscribes to an event given by the name. The subscriptionID is a unique id
271      * that is defined by the subscriber. It is possible to subscribe to several events,
272      * using the same subscription id, this allows to retrieve a grouped output of the
273      * events (i.e. get output of all subscribed by the given id).
274      *
275      * @param sessionToken can be null, if a
276      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
277      *            registered at the {@link HttpTransport}
278      * @param eventName required
279      * @param subscriptionID required
280      * @param connectionTimeout to set
281      * @param readTimeout to set
282      * @return true on success
283      */
284     boolean subscribeEvent(String sessionToken, String eventName, Integer subscriptionID, int connectionTimeout,
285             int readTimeout);
286
287     /**
288      * Unsubscribes from an event given by the name. The subscriptionID is a unique
289      * id that was used in the subscribe call.
290      *
291      * @param sessionToken can be null, if a
292      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
293      *            registered at the {@link HttpTransport}
294      * @param eventName required
295      * @param subscriptionID required
296      * @param connectionTimeout to set
297      * @param readTimeout to set
298      * @return true on success
299      */
300     boolean unsubscribeEvent(String sessionToken, String eventName, Integer subscriptionID, int connectionTimeout,
301             int readTimeout);
302
303     /**
304      * Gets event information and output. The subscriptionID is a unique id
305      * that was used in the subscribe call. All events, subscribed with the
306      * given id will be handled by this call. A timeout, in case no events
307      * are taken place, can be specified (in ms). By default the timeout
308      * is disabled: 0 (zero), if no events occur the call will block.
309      *
310      * @param sessionToken can be null, if a
311      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
312      *            registered at the {@link HttpTransport}
313      * @param subscriptionID required
314      * @param timeout optional
315      * @return Event-String
316      */
317     String getEvent(String sessionToken, Integer subscriptionID, Integer timeout);
318
319     /**
320      * Returns the dSS time in UTC seconds since epoch.
321      *
322      * @param sessionToken can be null, if a
323      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
324      *            registered at the {@link HttpTransport}
325      * @return time
326      */
327     int getTime(String sessionToken);
328
329     /**
330      * <b>Description partially taken form digitalSTROM JSON-API:</b><br>
331      * Returns the version of the digitalSTROM-Server software version as {@link Map}.<br>
332      * <br>
333      * <b>Key, value:</b><br>
334      * <ul>
335      * <li><b>version</b> the dSS application version</li>
336      * <li><b>distroVersion</b> the host platform firmware release (since v1.10)</li>
337      * <li><b>Hardware</b> the host platform hardware identifier (since v1.10)</li>
338      * <li><b>Revision</b> the host platform hardware revision number (since v1.10)</li>
339      * <li><b>Serial</b> the host platform hardware serial number (since v1.10)</li>
340      * <li><b>Ethernet</b> the host platform IEEE Mac address (since v1.10)</li>
341      * <li><b>MachineID</b> the host system unique id (since v1.10)</li>
342      * <li><b>Kernel</b> the host system Linux kernel release string (since v1.10)</li>
343      * </ul>
344      *
345      * @return the digitalSTROM-Server software version
346      */
347     Map<String, String> getSystemVersion();
348
349     /**
350      * Creates a new session using the registered application token
351      *
352      * @param applicationToken required
353      * @return sessionToken
354      */
355     String loginApplication(String applicationToken);
356
357     /**
358      * Creates a new session.
359      *
360      * @param user required
361      * @param password required
362      * @return new session token
363      */
364     String login(String user, String password);
365
366     /**
367      * Destroys the session and signs out the user
368      *
369      * @return true, if logout was successful, otherwise false
370      */
371     boolean logout();
372
373     /**
374      * Returns the dSID of the digitalSTROM Server.
375      *
376      * @param sessionToken can be null, if a
377      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
378      *            registered at the {@link HttpTransport}
379      * @return dSID
380      */
381     Map<String, String> getDSID(String sessionToken);
382
383     /**
384      * Returns a token for passwordless login. The token will need to be approved
385      * by a user first, the caller must not be logged in.
386      *
387      * @param applicationName required
388      * @return applicationToken
389      */
390     String requestAppplicationToken(String applicationName);
391
392     /**
393      * Revokes an application token, caller must be logged in.
394      *
395      * @param sessionToken can be null, if a
396      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
397      *            registered at the {@link HttpTransport}
398      * @param applicationToken to login
399      * @return true, if successful, otherwise false
400      */
401     boolean revokeToken(String applicationToken, String sessionToken);
402
403     /**
404      * Enables an application token, caller must be logged in.
405      *
406      * @param sessionToken can be null, if a
407      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
408      *            registered at the {@link HttpTransport}
409      * @param applicationToken required
410      * @return true, if successful, otherwise false
411      */
412     boolean enableApplicationToken(String applicationToken, String sessionToken);
413
414     /**
415      * Returns all resolutions stored on this dSS
416      *
417      * @param sessionToken can be null, if a
418      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
419      *            registered at the {@link HttpTransport}
420      * @return List of resolutions
421      */
422     List<Integer> getResolutions(String sessionToken);
423
424     /**
425      * Returns cached energy meter value or cached power consumption
426      * value in watt (W). The type parameter defines what should
427      * be returned, valid types, 'energyDelta' are 'energy' and
428      * 'consumption' you can also see at {@link MeteringTypeEnum}. 'energy' and 'energyDelta' are available in two
429      * units: 'Wh' (default) and 'Ws' you can also see at {@link MeteringUnitsEnum}. The meterDSIDs parameter follows
430      * the
431      * set-syntax, currently it supports: .meters(dsid1,dsid2,...) and .meters(all)
432      *
433      * @param sessionToken can be null, if a
434      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
435      *            registered at the {@link HttpTransport}
436      * @param type required
437      * @param meterDSIDs required
438      * @param unit optional
439      * @return cached metering values
440      */
441     List<CachedMeteringValue> getLatest(String sessionToken, MeteringTypeEnum type, String meterDSIDs,
442             MeteringUnitsEnum unit);
443
444     /**
445      * Returns cached energy meter value or cached power consumption
446      * value in watt (W). The type parameter defines what should
447      * be returned, valid types, 'energyDelta' are 'energy' and
448      * 'consumption' you can also see at {@link MeteringTypeEnum}. 'energy' and 'energyDelta' are available in two
449      * units: 'Wh' (default) and 'Ws' you can also see at {@link MeteringUnitsEnum}. <br>
450      * The meterDSIDs parameter you can directly pass a {@link List} of the digitalSTROM-Meter dSID's as {@link String}.
451      *
452      * @param sessionToken can be null, if a
453      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
454      *            registered at the {@link HttpTransport}
455      * @param type required
456      * @param meterDSIDs required
457      * @param unit optional
458      * @return cached metering values
459      */
460     List<CachedMeteringValue> getLatest(String sessionToken, MeteringTypeEnum type, List<String> meterDSIDs,
461             MeteringUnitsEnum unit);
462
463     /**
464      * Checks the connection and returns the HTTP-Status-Code.
465      *
466      * @param sessionToken can be null, if a
467      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
468      *            registered at the {@link HttpTransport}
469      * @return HTTP-Status-Code
470      */
471     int checkConnection(String sessionToken);
472
473     /**
474      * Returns the configured scene output value for the given sceneId of the digitalSTROM-Device with the given dSID.
475      * <br>
476      * At array position 0 is the output value and at position 1 the angle value, if the device is a blind.
477      *
478      * @param sessionToken can be null, if a
479      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
480      *            registered at the {@link HttpTransport}
481      * @param dSID needs either dSID, dSUID or name
482      * @param dSUID needs either dSID, dSUID or name
483      * @param deviceName needs either dSID, dsUID or name
484      * @param sceneId required
485      * @return scene value at array position 0 and angle at position 1
486      */
487     int[] getSceneValue(String sessionToken, DSID dSID, String dSUID, String deviceName, Short sceneId);
488
489     /**
490      * Calls the INC scene on the digitalSTROM-Device with the given dSID and returns true if the request was success.
491      *
492      * @param sessionToken can be null, if a
493      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
494      *            registered at the {@link HttpTransport}
495      * @param dSID needs either dSID, dSUID or name
496      * @param dSUID needs either dSID, dSUID or name
497      * @param deviceName needs either dSID, dsUID or name
498      * @return success true otherwise false
499      */
500     boolean increaseValue(String sessionToken, DSID dSID, String dSUID, String deviceName);
501
502     /**
503      * Calls the DEC scene on the digitalSTROM-Device with the given dSID and returns true if the request was
504      * successful.
505      *
506      * @param sessionToken can be null, if a
507      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
508      *            registered at the {@link HttpTransport}
509      * @param dSID needs either dSID, dSUID or name
510      * @param dSUID needs either dSID, dSUID or name
511      * @param deviceName needs either dSID, dsUID or name
512      * @return success true otherwise false
513      */
514     boolean decreaseValue(String sessionToken, DSID dSID, String dSUID, String deviceName);
515
516     /**
517      * Undos the given sceneNumer of the digitalSTROM-Device with the given dSID and returns true if the request was
518      * successful.
519      *
520      * @param sessionToken can be null, if a
521      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
522      *            registered at the {@link HttpTransport}
523      * @param dSID needs either dSID, dSUID or name
524      * @param dSUID needs either dSID, dSUID or name
525      * @param deviceName needs either dSID, dsUID or name
526      * @param sceneNumber required
527      * @return success true otherwise false
528      */
529     boolean undoDeviceScene(String sessionToken, DSID dSID, String dSUID, String deviceName, Scene sceneNumber);
530
531     /**
532      * Undo the given sceneNumer on the digitalSTROM apartment-group with the given groupID or groupName and returns
533      * true
534      * if the request was successful.
535      *
536      * @param sessionToken can be null, if a
537      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
538      *            registered at the {@link HttpTransport}
539      * @param groupID needs either groupID or groupName
540      * @param groupName needs either groupID or groupName
541      * @param sceneNumber required
542      * @return success true otherwise false
543      */
544     boolean undoApartmentScene(String sessionToken, Short groupID, String groupName, Scene sceneNumber);
545
546     /**
547      * Undo the given sceneNumer on the digitalSTROM zone-group with the given zoneID or zoneName and groupID or
548      * groupName and returns true if the request was successful.
549      *
550      * @param sessionToken can be null, if a
551      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
552      *            registered at the {@link HttpTransport}
553      * @param zoneID needs either zoneID or zoneName
554      * @param zoneName needs either zoneID or zoneName
555      * @param groupID needs either groupID or groupName
556      * @param groupName needs either groupID or groupName
557      * @param sceneNumber required
558      * @return success true otherwise false
559      */
560     boolean undoZoneScene(String sessionToken, Integer zoneID, String zoneName, Short groupID, String groupName,
561             SceneEnum sceneNumber);
562
563     /**
564      * Returns user defined name of the digitalSTROM installation.
565      *
566      * @param sessionToken can be null, if a
567      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
568      *            registered at the {@link HttpTransport}
569      * @return name of the digitalSTROM installation
570      */
571     String getInstallationName(String sessionToken);
572
573     /**
574      * Returns user defined name of the zone from the given zone id.
575      *
576      * @param sessionToken can be null, if a
577      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
578      *            registered at the {@link HttpTransport}
579      * @param zoneID required
580      * @return name of the given zone id
581      */
582     String getZoneName(String sessionToken, Integer zoneID);
583
584     /**
585      * Returns user defined name of the device from the given dSID
586      *
587      * @param sessionToken can be null, if a
588      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
589      *            registered at the {@link HttpTransport}
590      * @param dSID needs either dSID or dSUID
591      * @param dSUID needs either dSID or dSUID
592      * @return name of the device with the given dSID or dSUID
593      */
594     String getDeviceName(String sessionToken, DSID dSID, String dSUID);
595
596     /**
597      * Returns user defined name of the circuit from the given dSID.
598      *
599      * @param sessionToken can be null, if a
600      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
601      *            registered at the {@link HttpTransport}
602      * @param dSID required
603      * @return name of the given circuit dSID
604      */
605     String getCircuitName(String sessionToken, DSID dSID);
606
607     /**
608      * Returns user defined name of the scene from the given zoneID, groupID and sceneID.
609      *
610      * @param sessionToken can be null, if a
611      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
612      *            registered at the {@link HttpTransport}
613      * @param zoneID (0 is broadcast)
614      * @param zoneName of the zone
615      * @param groupID (0 is broadcast)
616      * @param sceneID (between 0 and 127)
617      * @return name of the scene otherwise null
618      */
619     String getSceneName(String sessionToken, Integer zoneID, String zoneName, Short groupID, Short sceneID);
620
621     /**
622      * Returns the temperature control status to the given zone.
623      *
624      * @param sessionToken can be null, if a
625      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
626      *            registered at the {@link HttpTransport}
627      * @param zoneID required or zoneName
628      * @param zoneName required or zoneID
629      * @return temperature control status to the given zone
630      */
631     TemperatureControlStatus getZoneTemperatureControlStatus(String sessionToken, Integer zoneID, String zoneName);
632
633     /**
634      * Returns the temperature control configuration of the given zone. It's like the temperature control status added
635      * by the following control values.
636      *
637      * CtrlKp = Control proportional factor
638      * CtrlTs = Control sampling time
639      * CtrlTi = Control integrator time constant
640      * CtrlKd = Control differential factor
641      * CtrlImin = Control minimum integrator value
642      * CtrlImax = Control maximum integrator value
643      * CtrlYmin = Control minimum control value
644      * CtrlYmax = Control maximum control value
645      * CtrlAntiWindUp = Control integrator anti wind up: 0=inactive, 1=active
646      * CtrlKeepFloorWarm = Control mode with higher priority on comfort: 0=inactive, 1=active
647      *
648      * @param sessionToken can be null, if a
649      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
650      *            registered at the {@link HttpTransport}
651      * @param zoneID required or zoneName
652      * @param zoneName required or zoneID
653      * @return temperature control status with configuration parameters
654      */
655     TemperatureControlConfig getZoneTemperatureControlConfig(String sessionToken, Integer zoneID, String zoneName);
656
657     /**
658      * Returns the temperature control values to their control modes of the given zone.
659      * There are following control modes:
660      * <ul>
661      * <li>0 Off</li>
662      * <li>1 Comfort</li>
663      * <li>2 Economy</li>
664      * <li>3 Not Used</li>
665      * <li>4 Night</li>
666      * <li>5 Holiday</li>
667      * <li>6 Cooling</li>
668      * <li>7 CollingOff</li>
669      * </ul>
670      *
671      * @param sessionToken can be null, if a
672      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
673      *            registered at the {@link HttpTransport}
674      * @param zoneID required or zoneName
675      * @param zoneName required or zoneID
676      * @return temperature control values of control modes
677      */
678     TemperatureControlValues getZoneTemperatureControlValues(String sessionToken, Integer zoneID, String zoneName);
679
680     /**
681      * Set the configuration of the zone temperature control.
682      *
683      * @param sessionToken can be null, if a
684      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
685      *            registered at the {@link HttpTransport}
686      * @param zoneID (required alternative zoneName)
687      * @param zoneName (required alternative zoneID)
688      * @param controlDSUID dSUID of the meter or service that runs the control algorithm for this zone (optional)
689      * @param controlMode Control mode, can be one of: 0=off; 1=pid-control; 2=zone-follower; 3=fixed-value; 4=manual
690      *            (Optional)
691      * @param referenceZone Zone number of the reference zone (Optional for ControlMode 2)
692      * @param ctrlOffset Control value offset (Optional for ControlMode 2)
693      * @param emergencyValue Fixed control value in case of malfunction (Optional for ControlMode 1)
694      * @param manualValue Control value for manual mode (Optional for ControlMode 1)
695      * @param ctrlKp Control proportional factor (Optional for ControlMode 1)
696      * @param ctrlTs Control sampling time (Optional for ControlMode 1)
697      * @param ctrlTi Control integrator time constant (Optional for ControlMode 1)
698      * @param ctrlKd Control differential factor (Optional for ControlMode 1)
699      * @param ctrlImin Control minimum integrator value (Optional for ControlMode 1)
700      * @param ctrlImax Control maximum integrator value (Optional for ControlMode 1)
701      * @param ctrlYmin Control minimum control value (Optional for ControlMode 1)
702      * @param ctrlYmax Control maximum control value (Optional for ControlMode 1)
703      * @param ctrlAntiWindUp Control integrator anti wind up (Optional for ControlMode 1)
704      * @param ctrlKeepFloorWarm Control mode with higher priority on comfort (Optional for ControlMode 1)
705      * @return true, if successful
706      */
707     boolean setZoneTemperatureControlConfig(String sessionToken, Integer zoneID, String zoneName, String controlDSUID,
708             Short controlMode, Integer referenceZone, Float ctrlOffset, Float emergencyValue, Float manualValue,
709             Float ctrlKp, Float ctrlTs, Float ctrlTi, Float ctrlKd, Float ctrlImin, Float ctrlImax, Float ctrlYmin,
710             Float ctrlYmax, Boolean ctrlAntiWindUp, Boolean ctrlKeepFloorWarm);
711
712     /**
713      * Returns the assigned Sensor dSUID of a zone.
714      *
715      *
716      * @param sessionToken can be null, if a
717      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
718      *            registered at the {@link HttpTransport}
719      * @param zoneID required or zoneName
720      * @param zoneName required or zoneID
721      * @return assigned Sensor dSUID of the given zone.
722      */
723     AssignedSensors getZoneAssignedSensors(String sessionToken, Integer zoneID, String zoneName);
724
725     /**
726      * Sets the temperature control state of a given zone.<br>
727      * Control states: 0=internal; 1=external; 2=exbackup; 3=emergency
728      *
729      * @param sessionToken can be null, if a
730      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
731      *            registered at the {@link HttpTransport}
732      * @param zoneID required or zoneName
733      * @param zoneName required or zoneID
734      * @param controlState required
735      * @return success true otherwise false
736      */
737     boolean setZoneTemperatureControlState(String sessionToken, Integer zoneID, String zoneName, String controlState);
738
739     /**
740      * Sets the wished temperature (control mode =
741      * {@link org.openhab.binding.digitalstrom.internal.lib.climate.constants.ControlModes#PID_CONTROL}) or control
742      * valve value for a
743      * operation mode, see {@link org.openhab.binding.digitalstrom.internal.lib.climate.constants.OperationModes}.<br>
744      * To set the values a {@link List} with an object array has to be set as controlVlaues parameter. The 1th field has
745      * to be a {@link String} for the
746      * {@link org.openhab.binding.digitalstrom.internal.lib.climate.constants.OperationModes}
747      * name and the 2nd field has to be an {@link Integer} for the
748      * new value. If the control mode is
749      * {@link org.openhab.binding.digitalstrom.internal.lib.climate.constants.ControlModes#PID_CONTROL} it is the
750      * nominal temperature, otherwise it is
751      * the control valve value.
752      *
753      * @param sessionToken can be null, if a
754      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
755      *            registered at the {@link HttpTransport}
756      * @param zoneID required or zoneName
757      * @param zoneName required or zoneID
758      * @param controlValues new control values
759      * @return success true otherwise false
760      */
761     boolean setZoneTemperatureControlValues(String sessionToken, Integer zoneID, String zoneName,
762             List<Object[]> controlValues);
763
764     /**
765      * Returns the value of a Sensor of the given zone.
766      *
767      *
768      * @param sessionToken can be null, if a
769      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
770      *            registered at the {@link HttpTransport}
771      * @param zoneID required or zoneName
772      * @param zoneName required or zoneID
773      * @return value of a Sensor of the given zone
774      */
775     SensorValues getZoneSensorValues(String sessionToken, Integer zoneID, String zoneName);
776
777     /**
778      * Set the source of a sensor in a zone to a given device source address.
779      *
780      * @param sessionToken can be null, if a
781      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
782      *            registered at the {@link HttpTransport}
783      * @param zoneID required or zoneName
784      * @param zoneName required or zoneID
785      * @param sensorType to set
786      * @param dSID to set
787      * @return success true otherwise false
788      */
789     boolean setZoneSensorSource(String sessionToken, Integer zoneID, String zoneName, SensorEnum sensorType, DSID dSID);
790
791     /**
792      * Remove all assignments for a particular sensor type in a zone.
793      *
794      * @param sessionToken can be null, if a
795      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
796      *            registered at the {@link HttpTransport}
797      * @param zoneID required or zoneName
798      * @param zoneName required or zoneID
799      * @param sensorType to clear
800      * @return success true otherwise false
801      *
802      */
803     boolean clearZoneSensorSource(String sessionToken, Integer zoneID, String zoneName, SensorEnum sensorType);
804
805     /**
806      * Returns internal status information of the temperature control of a zone.
807      *
808      * @param sessionToken can be null, if a
809      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
810      *            registered at the {@link HttpTransport}
811      * @param zoneID required or zoneName
812      * @param zoneName required or zoneID
813      * @return internal status information of the temperature control of a zone
814      */
815     TemperatureControlInternals getZoneTemperatureControlInternals(String sessionToken, Integer zoneID,
816             String zoneName);
817
818     /**
819      * Returns the temperature control status of all zones.
820      *
821      * @param sessionToken can be null, if a
822      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
823      *            registered at the {@link HttpTransport}
824      * @return temperature control status of all zones
825      */
826     List<TemperatureControlStatus> getApartmentTemperatureControlStatus(String sessionToken);
827
828     /**
829      * Returns the temperature control status of all zones.
830      *
831      * @param sessionToken can be null, if a
832      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
833      *            registered at the {@link HttpTransport}
834      * @return temperature control status of all zones
835      */
836     Map<Integer, TemperatureControlConfig> getApartmentTemperatureControlConfig(String sessionToken);
837
838     /**
839      * Returns the temperature control status of all zones.
840      *
841      * @param sessionToken can be null, if a
842      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
843      *            registered at the {@link HttpTransport}
844      * @return temperature control status of all zones
845      */
846     Map<Integer, TemperatureControlValues> getApartmentTemperatureControlValues(String sessionToken);
847
848     /**
849      * Returns the assigned Sensor dSUID of all zones.
850      *
851      *
852      * @param sessionToken can be null, if a
853      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
854      *            registered at the {@link HttpTransport}
855      * @return assigned Sensor dSUID of all zones.
856      */
857     Map<Integer, AssignedSensors> getApartmentAssignedSensors(String sessionToken);
858
859     /**
860      * Returns the value of a Sensor of all zones.
861      *
862      * @param sessionToken can be null, if a
863      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
864      *            registered at the {@link HttpTransport}
865      * @return value of a Sensor of all zones
866      */
867     Map<Integer, BaseSensorValues> getApartmentSensorValues(String sessionToken);
868
869     /**
870      * <b>Description taken form digitalSTROM JSON-API:</b><br>
871      * Returns a part of the tree specified by query. All queries start from the root.
872      * The properties to be included have to be put in parentheses. A query to get
873      * all device from zone4 would look like this: ’/apartment/zones/zone4/*(ZoneID,name)’.
874      * More complex combinations (see example below) are also possible.
875      *
876      * @param sessionToken can be null, if a
877      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
878      *            registered at the {@link HttpTransport}
879      * @param query required
880      * @return response as {@link JsonObject}
881      */
882     JsonObject query(String sessionToken, String query);
883
884     /**
885      * <b>Description taken form digitalSTROM JSON-API:</b><br>
886      * Differs from query(1) only in the format of the the returned json struct.<br>
887      * <br>
888      * <i>Folder selects the nodes to descend, Property declares which attributes
889      * we are extracting from the current node. If no properties are declared for a
890      * folder, nothing is extracted, and the node will not show up in the resulting
891      * json structure.</i>
892      *
893      * @param sessionToken can be null, if a
894      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
895      *            registered at the {@link HttpTransport}
896      * @param query required
897      * @return response as {@link JsonObject}
898      */
899     JsonObject query2(String sessionToken, String query);
900
901     /**
902      * <b>Description taken form digitalSTROM JSON-API:</b><br>
903      * Set the output value of a group of devices in a zone to a given value. <br>
904      * <br>
905      * <b>Notice:</b> Setting output values directly bypasses the group state machine
906      * and is not recommended.<br>
907      * <br>
908      * If the group parameters are omitted the command is sent as broadcast
909      * to all devices in the selected zone. <br>
910      * <br>
911      * <b>Notice:</b> Setting output values without a group identification is strongly
912      * unrecommended.<br>
913      *
914      * @param sessionToken can be null, if a
915      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
916      *            registered at the {@link HttpTransport}
917      * @param zoneID or zoneName are required
918      * @param zoneName or zoneID are required
919      * @param groupID optional
920      * @param groupName optional
921      * @param value required
922      * @return true, if request was successful, otherwise false
923      */
924     boolean setZoneOutputValue(String sessionToken, Integer zoneID, String zoneName, Short groupID, String groupName,
925             Integer value);
926
927     /**
928      * <b>Description taken form digitalSTROM JSON-API:</b><br>
929      * Executes the "blink" function on a group of devices in a zone for identification
930      * purposes.
931      *
932      * @param sessionToken can be null, if a
933      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
934      *            registered at the {@link HttpTransport}
935      * @param zoneID or zoneName are required
936      * @param zoneName or zoneID are required
937      * @param groupID optional
938      * @param groupName optional
939      * @return true, if request was successful, otherwise false
940      */
941     boolean zoneBlink(String sessionToken, Integer zoneID, String zoneName, Short groupID, String groupName);
942
943     /**
944      * <b>Description taken form digitalSTROM JSON-API:</b><br>
945      * Send a sensor value to a group of devices in a zone.<br>
946      * If the group parameter is omitted the command is sent as broadcast to
947      * all devices in the selected zone. The reference for the sensor type definitions
948      * can be found in the ds-basics document.
949      *
950      * @param sessionToken can be null, if a
951      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
952      *            registered at the {@link HttpTransport}
953      * @param zoneID or zoneName are required
954      * @param zoneName or zoneID are required
955      * @param groupID optional
956      * @param sourceDSUID optional
957      * @param sensorValue required
958      * @param sensorType required
959      * @return true, if request was successful, otherwise false
960      */
961     boolean pushZoneSensorValue(String sessionToken, Integer zoneID, String zoneName, Short groupID, String sourceDSUID,
962             Float sensorValue, SensorEnum sensorType);
963
964     /**
965      * <b>Description taken form digitalSTROM JSON-API:</b><br>
966      * Returns the string value of the property, this call will fail if the property is
967      * not of type ’string’.
968      *
969      * @param sessionToken can be null, if a
970      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
971      *            registered at the {@link HttpTransport}
972      * @param path to property required
973      * @return {@link String} value of the property
974      */
975     String propertyTreeGetString(String sessionToken, String path);
976
977     /**
978      * <b>Description taken form digitalSTROM JSON-API:</b><br>
979      * Sets the string value of the property, this call will fail if the property is not
980      * of type ’string’.
981      *
982      * @param sessionToken can be null, if a
983      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
984      *            registered at the {@link HttpTransport}
985      * @param path to property required
986      * @return {@link JsonArray} of child nodes
987      */
988     JsonArray propertyTreeGetChildren(String sessionToken, String path);
989
990     /**
991      * <b>Description taken form digitalSTROM JSON-API:</b><br>
992      * Sets the string value of the property, this call will fail if the property is not
993      * of type ’string’.
994      *
995      * @param sessionToken can be null, if a
996      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
997      *            registered at the {@link HttpTransport}
998      * @param path required
999      * @param value required
1000      * @return true, if successful
1001      */
1002     Boolean propertyTreeSetString(String sessionToken, String path, String value);
1003
1004     /**
1005      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1006      * Returns the integer value of the property, this call will fail if the property is
1007      * not of type ’integer’.
1008      *
1009      * @param sessionToken can be null, if a
1010      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1011      *            registered at the {@link HttpTransport}
1012      * @param path required
1013      * @return {@link Integer} value of the property
1014      */
1015     Integer propertyTreeGetInteger(String sessionToken, String path);
1016
1017     /**
1018      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1019      * Sets the integer value of the property, this call will fail if the property is not
1020      * of type ’integer’.
1021      *
1022      * @param sessionToken can be null, if a
1023      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1024      *            registered at the {@link HttpTransport}
1025      * @param path required
1026      * @param value required
1027      * @return true, if successful
1028      */
1029     Boolean propertyTreeSetInteger(String sessionToken, String path, Integer value);
1030
1031     /**
1032      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1033      * Returns the boolean value of the property, this call will fail if the property is
1034      * not of type ’boolean’.
1035      *
1036      * @param sessionToken can be null, if a
1037      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1038      *            registered at the {@link HttpTransport}
1039      * @param path required
1040      * @return {@link Boolean} value of the property
1041      */
1042     Boolean propertyTreeGetBoolean(String sessionToken, String path);
1043
1044     /**
1045      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1046      * Returns the boolean value of the property, this call will fail if the property is
1047      * not of type ’boolean’.
1048      *
1049      * @param sessionToken can be null, if a
1050      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1051      *            registered at the {@link HttpTransport}
1052      * @param path required
1053      * @param value required
1054      * @return true, if successful
1055      */
1056     Boolean propertyTreeSetBoolean(String sessionToken, String path, Boolean value);
1057
1058     /**
1059      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1060      * Returns the type of the property as {@link String}, this can be "none", "string", "integer" or
1061      * "boolean".
1062      *
1063      * @param sessionToken can be null, if a
1064      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1065      *            registered at the {@link HttpTransport}
1066      * @param path required
1067      * @return the type of the property as {@link String}
1068      */
1069     String propertyTreeGetType(String sessionToken, String path);
1070
1071     /**
1072      * Returns the flag values of a property as {@link Map}. The key is the flag type and the value the {@link Boolean}
1073      * value.<br>
1074      * <br>
1075      * Flag types are:<br>
1076      * - READABLE <br>
1077      * - WRITEABLE <br>
1078      * - ARCHIVE <br>
1079      *
1080      * @param sessionToken can be null, if a
1081      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1082      *            registered at the {@link HttpTransport}
1083      * @param path required
1084      * @return the type of the property as {@link String}
1085      */
1086     Map<String, Boolean> propertyTreeGetFlages(String sessionToken, String path);
1087
1088     /**
1089      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1090      * Sets a given flag of a property.
1091      *
1092      * @param sessionToken can be null, if a
1093      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1094      *            registered at the {@link HttpTransport}
1095      * @param path required
1096      * @param flag required
1097      * @param value required
1098      * @return true, if successful
1099      */
1100     Boolean propertyTreeSetFlag(String sessionToken, String path, String flag, Boolean value);
1101
1102     /**
1103      * <b>Description taken form digitalSTROM JSON-API:</b><br>
1104      * Removes a property node.
1105      *
1106      * @param sessionToken can be null, if a
1107      *            {@link org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager} is
1108      *            registered at the {@link HttpTransport}
1109      * @param path required
1110      * @return true, if successful
1111      */
1112     Boolean propertyTreeRemove(String sessionToken, String path);
1113 }