diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyApiException.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyApiException.java index 74767600652..50ceb22c4ed 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyApiException.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyApiException.java @@ -14,6 +14,7 @@ package org.openhab.binding.shelly.internal.api; import static org.openhab.binding.shelly.internal.util.ShellyUtils.getString; +import java.io.EOFException; import java.net.ConnectException; import java.net.MalformedURLException; import java.net.NoRouteToHostException; @@ -115,7 +116,7 @@ public class ShellyApiException extends Exception { Class exType = getCauseClass(); return isUnknownHost() || isMalformedURL() || exType == ConnectException.class || exType == SocketException.class || exType == PortUnreachableException.class - || exType == NoRouteToHostException.class; + || exType == NoRouteToHostException.class || exType == EOFException.class; } public boolean isNoRouteToHost() { diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfile.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfile.java index 8af0c403428..0e211e4a92d 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfile.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfile.java @@ -407,7 +407,7 @@ public class ShellyDeviceProfile { public static boolean isGeneration2(String thingType) { return thingType.startsWith("shellyplus") || thingType.startsWith("shellypro") || thingType.contains("mini") || 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) { diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api1/Shelly1CoapHandler.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api1/Shelly1CoapHandler.java index d3fe61dc63f..dcfe5ff28e7 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api1/Shelly1CoapHandler.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api1/Shelly1CoapHandler.java @@ -210,7 +210,7 @@ public class Shelly1CoapHandler implements Shelly1CoapListener { response.getSourceContext().getPeerAddress(), response.getMID(), response.getPayloadString()); } 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; } diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/Shelly2ApiClient.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/Shelly2ApiClient.java index de9d40755b3..79aec4d3791 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/Shelly2ApiClient.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/api2/Shelly2ApiClient.java @@ -477,7 +477,7 @@ public class Shelly2ApiClient extends ShellyHttpClient { } 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(","); profile.settings.favorites = new ArrayList<>(); for (int i = 0; i < favorites.length; i++) { diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java index 44c9e7c9cc5..f395142067a 100755 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java @@ -1481,6 +1481,8 @@ public abstract class ShellyBaseHandler extends BaseThingHandler logger.debug("{}: Device profile re-initialized (thingType={})", thingName, thingType); } } + } catch (ShellyApiException | RuntimeException e) { + logger.debug("{}: Unable to initialize Device Profile", thingName, e); } finally { refreshSettings = false; } diff --git a/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfileTest.java b/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfileTest.java index 6d640bf483f..41bd102d2eb 100644 --- a/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfileTest.java +++ b/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/api/ShellyDeviceProfileTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.params.provider.MethodSource; /** * Tests for {@link ShellyDeviceProfile}. - * + * * @author Jacob Laursen - Initial contribution */ @NonNullByDefault @@ -48,7 +48,7 @@ public class ShellyDeviceProfileTest { Arguments.of(THING_TYPE_SHELLYBLUDW_STR, true, true), // Arguments.of(THING_TYPE_SHELLYBLUMOTION_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 Arguments.of(THING_TYPE_SHELLYBULB_STR, false, false), // // Generation 1