mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
a21ee9de6f
commit
16c2b2ef74
@ -14,6 +14,7 @@ package org.openhab.binding.shelly.internal.api;
|
|||||||
|
|
||||||
import static org.openhab.binding.shelly.internal.util.ShellyUtils.getString;
|
import static org.openhab.binding.shelly.internal.util.ShellyUtils.getString;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.net.ConnectException;
|
import java.net.ConnectException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.NoRouteToHostException;
|
import java.net.NoRouteToHostException;
|
||||||
@ -115,7 +116,7 @@ public class ShellyApiException extends Exception {
|
|||||||
Class<?> exType = getCauseClass();
|
Class<?> exType = getCauseClass();
|
||||||
return isUnknownHost() || isMalformedURL() || exType == ConnectException.class
|
return isUnknownHost() || isMalformedURL() || exType == ConnectException.class
|
||||||
|| exType == SocketException.class || exType == PortUnreachableException.class
|
|| exType == SocketException.class || exType == PortUnreachableException.class
|
||||||
|| exType == NoRouteToHostException.class;
|
|| exType == NoRouteToHostException.class || exType == EOFException.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoRouteToHost() {
|
public boolean isNoRouteToHost() {
|
||||||
|
@ -407,7 +407,7 @@ public class ShellyDeviceProfile {
|
|||||||
public static boolean isGeneration2(String thingType) {
|
public static boolean isGeneration2(String thingType) {
|
||||||
return thingType.startsWith("shellyplus") || thingType.startsWith("shellypro") || thingType.contains("mini")
|
return thingType.startsWith("shellyplus") || thingType.startsWith("shellypro") || thingType.contains("mini")
|
||||||
|| thingType.startsWith("shellywall") || (thingType.startsWith("shelly") && thingType.contains("g3"))
|
|| thingType.startsWith("shellywall") || (thingType.startsWith("shelly") && thingType.contains("g3"))
|
||||||
|| isBluSeries(thingType);
|
|| isBluSeries(thingType) || thingType.startsWith(THING_TYPE_SHELLYBLUGW_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBluSeries(String thingType) {
|
public static boolean isBluSeries(String thingType) {
|
||||||
|
@ -210,7 +210,7 @@ public class Shelly1CoapHandler implements Shelly1CoapListener {
|
|||||||
response.getSourceContext().getPeerAddress(), response.getMID(), response.getPayloadString());
|
response.getSourceContext().getPeerAddress(), response.getMID(), response.getPayloadString());
|
||||||
}
|
}
|
||||||
if (thingHandler.isStopping()) {
|
if (thingHandler.isStopping()) {
|
||||||
logger.debug("{}: Thing is shutting down, ignore CoIOT message", thingName);
|
logger.debug("{}: Thing is not yet initialized / shutting down, ignore CoIOT message", thingName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ public class Shelly2ApiClient extends ShellyHttpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fillRollerFavorites(ShellyDeviceProfile profile, Shelly2GetConfigResult dc) {
|
private void fillRollerFavorites(ShellyDeviceProfile profile, Shelly2GetConfigResult dc) {
|
||||||
if (dc.sys.uiData.cover != null) {
|
if (dc.sys.uiData.cover != null && !dc.sys.uiData.cover.isEmpty()) {
|
||||||
String[] favorites = dc.sys.uiData.cover.split(",");
|
String[] favorites = dc.sys.uiData.cover.split(",");
|
||||||
profile.settings.favorites = new ArrayList<>();
|
profile.settings.favorites = new ArrayList<>();
|
||||||
for (int i = 0; i < favorites.length; i++) {
|
for (int i = 0; i < favorites.length; i++) {
|
||||||
|
@ -1481,6 +1481,8 @@ public abstract class ShellyBaseHandler extends BaseThingHandler
|
|||||||
logger.debug("{}: Device profile re-initialized (thingType={})", thingName, thingType);
|
logger.debug("{}: Device profile re-initialized (thingType={})", thingName, thingType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ShellyApiException | RuntimeException e) {
|
||||||
|
logger.debug("{}: Unable to initialize Device Profile", thingName, e);
|
||||||
} finally {
|
} finally {
|
||||||
refreshSettings = false;
|
refreshSettings = false;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import org.junit.jupiter.params.provider.MethodSource;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link ShellyDeviceProfile}.
|
* Tests for {@link ShellyDeviceProfile}.
|
||||||
*
|
*
|
||||||
* @author Jacob Laursen - Initial contribution
|
* @author Jacob Laursen - Initial contribution
|
||||||
*/
|
*/
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
@ -48,7 +48,7 @@ public class ShellyDeviceProfileTest {
|
|||||||
Arguments.of(THING_TYPE_SHELLYBLUDW_STR, true, true), //
|
Arguments.of(THING_TYPE_SHELLYBLUDW_STR, true, true), //
|
||||||
Arguments.of(THING_TYPE_SHELLYBLUMOTION_STR, true, true), //
|
Arguments.of(THING_TYPE_SHELLYBLUMOTION_STR, true, true), //
|
||||||
Arguments.of(THING_TYPE_SHELLYBLUHT_STR, true, true), //
|
Arguments.of(THING_TYPE_SHELLYBLUHT_STR, true, true), //
|
||||||
Arguments.of(THING_TYPE_SHELLYBLUGW_STR, false, false), //
|
Arguments.of(THING_TYPE_SHELLYBLUGW_STR, true, false), //
|
||||||
// Shelly Bulb
|
// Shelly Bulb
|
||||||
Arguments.of(THING_TYPE_SHELLYBULB_STR, false, false), //
|
Arguments.of(THING_TYPE_SHELLYBULB_STR, false, false), //
|
||||||
// Generation 1
|
// Generation 1
|
||||||
|
Loading…
Reference in New Issue
Block a user