2 * Copyright (c) 2010-2023 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.structure.devices.deviceparameters;
15 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.DeviceBinarayInputEnum;
16 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum;
19 * Represents a device state update for lights, joker, shades and sensor data.
21 * @author Michael Ochel - Initial contribution
22 * @author Matthias Siegele - Initial contribution
24 public interface DeviceStateUpdate {
27 // in certain circumstances it is also better to rename SLAT_ANGLE to e.g. SECONDARY_OUTPUT
29 static final String OUTPUT = "output";
30 static final String ON_OFF = "OnOff";
31 static final String OUTPUT_INCREASE = "outputIncrese";
32 static final String OUTPUT_DECREASE = "outputDecrese";
33 static final String OUTPUT_STOP = "outputStop";
34 static final String OUTPUT_MOVE = "outputMove";
37 static final String SLATPOSITION = "slatposition";
38 static final String SLAT_ANGLE = "slatAngle";
39 static final String SLAT_INCREASE = "slatIncrese";
40 static final String SLAT_DECREASE = "slatDecrese";
41 static final String SLAT_ANGLE_INCREASE = "slatAngleIncrese";
42 static final String SLAT_ANGLE_DECREASE = "slatAngleDecrese";
43 static final String OPEN_CLOSE = "openClose";
44 static final String OPEN_CLOSE_ANGLE = "openCloseAngle";
45 static final String SLAT_MOVE = "slatMove";
46 static final String SLAT_STOP = "slatStop";
49 static final String UPDATE_OUTPUT_VALUE = "outputValue";
50 static final String UPDATE_DEVICE_SENSOR = "deviceSensor-";
53 static final String UPDATE_CIRCUIT_METER = "circuitMeter";
56 static final String BINARY_INPUT = "binaryInput-";
59 /** A scene call can have the value between 0 and 127. */
60 static final String UPDATE_CALL_SCENE = "callScene";
61 static final String UPDATE_UNDO_SCENE = "undoScene";
62 static final String UPDATE_SCENE_OUTPUT = "sceneOutput";
63 static final String UPDATE_SCENE_CONFIG = "sceneConfig";
66 /** command to refresh the output value of a device. */
67 static final String REFRESH_OUTPUT = "refreshOutput";
70 static final int ON_VALUE = 1;
71 static final int OFF_VALUE = -1;
74 * Returns the state update value.
79 * <li>For all OnOff-types the value for off is lower than 0 and for on higher than 0.</li>
80 * <li>For all Increase- and Decrease-types the value is the new output value.</li>
81 * <li>For SceneCall-type the value is between 0 and 127.</li>
82 * <li>For all SceneUndo-types the value is the new output value.</li>
83 * <li>For all SensorUpdate-types will read the sensor data directly, if the value is 0, otherwise a
84 * {@link SensorJob} will be added to the {@link SensorJobExecutor}.</li>
87 * @return new state value
92 * Returns the value as {@link Integer}.
94 * @return integer value
97 Integer getValueAsInteger();
100 * Returns the value as {@link String}.
102 * @return string value
105 String getValueAsString();
108 * Returns the value as {@link Short}.
110 * @return short value
113 Short getValueAsShort();
116 * Returns the value as {@link Float}.
118 * @return float value
121 Float getValueAsFloat();
124 * Returns the value as {@link Short}-array.
126 * @return short[] value
129 Short[] getValueAsShortArray();
132 * Returns the state update type.
134 * @return state update type
139 * Returns the update type as {@link SensorEnum} or null, if the type is not a {@link #UPDATE_DEVICE_SENSOR} type.
141 * @return type as {@link SensorEnum} or null
143 SensorEnum getTypeAsSensorEnum();
146 * Returns true, if this {@link DeviceStateUpdate} is a {@link #UPDATE_DEVICE_SENSOR} type, otherwise false.
148 * @return true, if it is a sensor type
150 boolean isSensorUpdateType();
153 * Returns the scene id of this {@link DeviceStateUpdate}, if this {@link DeviceStateUpdate} is a scene update type,
154 * otherwise it will be returned -1.
156 * @return the scene id or -1
161 * Returns the scene configuration or output reading priority, if this {@link DeviceStateUpdate} is a
162 * {@link #UPDATE_SCENE_CONFIG} or {@link #UPDATE_SCENE_OUTPUT} type.
164 * @return scene reading priority
166 Short getScenePriority();
169 * Returns true, if this {@link DeviceStateUpdate} is a {@link #UPDATE_SCENE_CONFIG} or {@link #UPDATE_SCENE_OUTPUT}
170 * type, otherwise false.
172 * @return true, if it is a scene reading type
174 boolean isSceneUpdateType();
177 * Returns the update type as {@link DeviceBinarayInputEnum} or null, if the type is not a {@link #BINARY_INPUT}
180 * @return type as {@link DeviceBinarayInputEnum} or null
182 DeviceBinarayInputEnum getTypeAsDeviceBinarayInputEnum();
185 * Returns true, if this {@link DeviceStateUpdate} is a {@link #BINARY_INPUT} type, otherwise false.
187 * @return true, if it is a binary input type
189 boolean isBinarayInputType();