2 * Copyright (c) 2010-2024 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.shelly.internal.api;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyOtaCheckResult;
20 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyRollerStatus;
21 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsDevice;
22 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsLogin;
23 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsStatus;
24 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsUpdate;
25 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyShortLightStatus;
26 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyStatusLight;
27 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyStatusRelay;
28 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyStatusSensor;
29 import org.openhab.binding.shelly.internal.config.ShellyThingConfiguration;
32 * The {@link ShellyApiInterface} Defines device API
34 * @author Markus Michels - Initial contribution
37 public interface ShellyApiInterface {
38 boolean isInitialized();
40 void initialize() throws ShellyApiException;
42 void setConfig(String thingName, ShellyThingConfiguration config);
44 ShellySettingsDevice getDeviceInfo() throws ShellyApiException;
46 ShellyDeviceProfile getDeviceProfile(String thingType, @Nullable ShellySettingsDevice device)
47 throws ShellyApiException;
49 ShellySettingsStatus getStatus() throws ShellyApiException;
51 void setLedStatus(String ledName, boolean value) throws ShellyApiException;
53 void setSleepTime(int value) throws ShellyApiException;
55 ShellyStatusRelay getRelayStatus(int relayIndex) throws ShellyApiException;
57 void setRelayTurn(int id, String turnMode) throws ShellyApiException;
59 void resetMeterTotal(int id) throws ShellyApiException;
61 ShellyRollerStatus getRollerStatus(int rollerIndex) throws ShellyApiException;
63 void setRollerTurn(int relayIndex, String turnMode) throws ShellyApiException;
65 void setRollerPos(int relayIndex, int position) throws ShellyApiException;
67 void setAutoTimer(int index, String timerName, double value) throws ShellyApiException;
69 ShellyStatusSensor getSensorStatus() throws ShellyApiException;
71 ShellyStatusLight getLightStatus() throws ShellyApiException;
73 ShellyShortLightStatus getLightStatus(int index) throws ShellyApiException;
75 void setLightMode(String mode) throws ShellyApiException;
77 void setLightParm(int lightIndex, String parm, String value) throws ShellyApiException;
79 void setLightParms(int lightIndex, Map<String, String> parameters) throws ShellyApiException;
81 ShellyShortLightStatus setLightTurn(int id, String turnMode) throws ShellyApiException;
83 void setBrightness(int id, int brightness, boolean autoOn) throws ShellyApiException;
85 void setValveMode(int id, boolean auto) throws ShellyApiException;
87 void setValveTemperature(int valveId, double value) throws ShellyApiException;
89 void setValveProfile(int valveId, int value) throws ShellyApiException;
91 void setValvePosition(int valveId, double value) throws ShellyApiException;
93 void setValveBoostTime(int valveId, int value) throws ShellyApiException;
95 void startValveBoost(int valveId, int value) throws ShellyApiException;
97 void muteSmokeAlarm(int smokeId) throws ShellyApiException;
99 ShellyOtaCheckResult checkForUpdate() throws ShellyApiException;
101 ShellySettingsUpdate firmwareUpdate(String uri) throws ShellyApiException;
103 ShellySettingsLogin getLoginSettings() throws ShellyApiException;
105 ShellySettingsLogin setLoginCredentials(String user, String password) throws ShellyApiException;
107 String setWiFiRecovery(boolean enable) throws ShellyApiException;
109 boolean setWiFiRangeExtender(boolean enable) throws ShellyApiException;
111 boolean setEthernet(boolean enable) throws ShellyApiException;
113 boolean setBluetooth(boolean enable) throws ShellyApiException;
115 String deviceReboot() throws ShellyApiException;
117 String setDebug(boolean enabled) throws ShellyApiException;
119 String getDebugLog(String id) throws ShellyApiException;
121 String setCloud(boolean enabled) throws ShellyApiException;
123 String setApRoaming(boolean enable) throws ShellyApiException;
125 String factoryReset() throws ShellyApiException;
127 String resetStaCache() throws ShellyApiException;
129 int getTimeoutsRecovered();
131 int getTimeoutErrors();
133 String getCoIoTDescription() throws ShellyApiException;
135 ShellySettingsLogin setCoIoTPeer(String peer) throws ShellyApiException;
137 void setActionURLs() throws ShellyApiException;
139 void sendIRKey(String keyCode) throws ShellyApiException, IllegalArgumentException;
141 void postEvent(String device, String index, String event, Map<String, String> parms) throws ShellyApiException;