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 org.openhab.binding.digitalstrom.internal.lib.sensorjobexecutor.sensorjob.SensorJob}
85 * will be added to the
86 * {@link org.openhab.binding.digitalstrom.internal.lib.sensorjobexecutor.SensorJobExecutor}.</li>
89 * @return new state value
94 * Returns the value as {@link Integer}.
96 * @return integer value
99 Integer getValueAsInteger();
102 * Returns the value as {@link String}.
104 * @return string value
107 String getValueAsString();
110 * Returns the value as {@link Short}.
112 * @return short value
115 Short getValueAsShort();
118 * Returns the value as {@link Float}.
120 * @return float value
123 Float getValueAsFloat();
126 * Returns the value as {@link Short}-array.
128 * @return short[] value
131 Short[] getValueAsShortArray();
134 * Returns the state update type.
136 * @return state update type
141 * Returns the update type as {@link SensorEnum} or null, if the type is not a {@link #UPDATE_DEVICE_SENSOR} type.
143 * @return type as {@link SensorEnum} or null
145 SensorEnum getTypeAsSensorEnum();
148 * Returns true, if this {@link DeviceStateUpdate} is a {@link #UPDATE_DEVICE_SENSOR} type, otherwise false.
150 * @return true, if it is a sensor type
152 boolean isSensorUpdateType();
155 * Returns the scene id of this {@link DeviceStateUpdate}, if this {@link DeviceStateUpdate} is a scene update type,
156 * otherwise it will be returned -1.
158 * @return the scene id or -1
163 * Returns the scene configuration or output reading priority, if this {@link DeviceStateUpdate} is a
164 * {@link #UPDATE_SCENE_CONFIG} or {@link #UPDATE_SCENE_OUTPUT} type.
166 * @return scene reading priority
168 Short getScenePriority();
171 * Returns true, if this {@link DeviceStateUpdate} is a {@link #UPDATE_SCENE_CONFIG} or {@link #UPDATE_SCENE_OUTPUT}
172 * type, otherwise false.
174 * @return true, if it is a scene reading type
176 boolean isSceneUpdateType();
179 * Returns the update type as {@link DeviceBinarayInputEnum} or null, if the type is not a {@link #BINARY_INPUT}
182 * @return type as {@link DeviceBinarayInputEnum} or null
184 DeviceBinarayInputEnum getTypeAsDeviceBinarayInputEnum();
187 * Returns true, if this {@link DeviceStateUpdate} is a {@link #BINARY_INPUT} type, otherwise false.
189 * @return true, if it is a binary input type
191 boolean isBinarayInputType();