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.shelly.internal.api;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyOtaCheckResult;
19 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyRollerStatus;
20 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsDevice;
21 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsLogin;
22 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsStatus;
23 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellySettingsUpdate;
24 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyShortLightStatus;
25 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyStatusLight;
26 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyStatusRelay;
27 import org.openhab.binding.shelly.internal.api1.Shelly1ApiJsonDTO.ShellyStatusSensor;
28 import org.openhab.binding.shelly.internal.config.ShellyThingConfiguration;
31 * The {@link ShellyApiInterface} Defines device API
33 * @author Markus Michels - Initial contribution
36 public interface ShellyApiInterface {
37 boolean isInitialized();
39 void initialize() throws ShellyApiException;
41 void setConfig(String thingName, ShellyThingConfiguration config);
43 ShellySettingsDevice getDeviceInfo() throws ShellyApiException;
45 ShellyDeviceProfile getDeviceProfile(String thingType) throws ShellyApiException;
47 ShellySettingsStatus getStatus() throws ShellyApiException;
49 void setLedStatus(String ledName, Boolean value) throws ShellyApiException;
51 void setSleepTime(int value) throws ShellyApiException;
53 ShellyStatusRelay getRelayStatus(int relayIndex) throws ShellyApiException;
55 void setRelayTurn(int id, String turnMode) throws ShellyApiException;
57 public void resetMeterTotal(int id) throws ShellyApiException;
59 public ShellyRollerStatus getRollerStatus(int rollerIndex) throws ShellyApiException;
61 void setRollerTurn(int relayIndex, String turnMode) throws ShellyApiException;
63 void setRollerPos(int relayIndex, int position) throws ShellyApiException;
65 void setAutoTimer(int index, String timerName, double value) throws ShellyApiException;
67 ShellyStatusSensor getSensorStatus() throws ShellyApiException;
69 ShellyStatusLight getLightStatus() throws ShellyApiException;
71 ShellyShortLightStatus getLightStatus(int index) throws ShellyApiException;
73 void setLightMode(String mode) throws ShellyApiException;
75 void setLightParm(int lightIndex, String parm, String value) throws ShellyApiException;
77 void setLightParms(int lightIndex, Map<String, String> parameters) throws ShellyApiException;
79 ShellyShortLightStatus setLightTurn(int id, String turnMode) throws ShellyApiException;
81 void setBrightness(int id, int brightness, boolean autoOn) throws ShellyApiException;
84 void setValveMode(int id, boolean auto) throws ShellyApiException;
86 void setValveTemperature(int valveId, int value) throws ShellyApiException;
88 void setValveProfile(int valveId, int value) throws ShellyApiException;
90 void setValvePosition(int valveId, double value) throws ShellyApiException;
92 void setValveBoostTime(int valveId, int value) throws ShellyApiException;
94 void startValveBoost(int valveId, int value) throws ShellyApiException;
96 void muteSmokeAlarm(int smokeId) throws ShellyApiException;
98 ShellyOtaCheckResult checkForUpdate() throws ShellyApiException;
100 ShellySettingsUpdate firmwareUpdate(String uri) throws ShellyApiException;
102 ShellySettingsLogin getLoginSettings() throws ShellyApiException;
104 ShellySettingsLogin setLoginCredentials(String user, String password) throws ShellyApiException;
106 String setWiFiRecovery(boolean enable) throws ShellyApiException;
108 boolean setWiFiRangeExtender(boolean enable) throws ShellyApiException;
110 boolean setEthernet(boolean enable) throws ShellyApiException;
112 boolean setBluetooth(boolean enable) throws ShellyApiException;
114 String deviceReboot() throws ShellyApiException;
116 String setDebug(boolean enabled) throws ShellyApiException;
118 String getDebugLog(String id) throws ShellyApiException;
120 String setCloud(boolean enabled) throws ShellyApiException;
122 String setApRoaming(boolean enable) throws ShellyApiException;
124 String factoryReset() throws ShellyApiException;
126 String resetStaCache() throws ShellyApiException;
128 int getTimeoutsRecovered();
130 int getTimeoutErrors();
132 String getCoIoTDescription() throws ShellyApiException;
134 ShellySettingsLogin setCoIoTPeer(String peer) throws ShellyApiException;
136 void setActionURLs() throws ShellyApiException;
138 void sendIRKey(String keyCode) throws ShellyApiException, IllegalArgumentException;