diff --git a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafPanelHandler.java b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafPanelHandler.java index e80545dd901e1..bef5bfb985ed2 100644 --- a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafPanelHandler.java +++ b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/handler/NanoleafPanelHandler.java @@ -286,7 +286,21 @@ public void updatePanelGesture(int gesture) { } public Integer getPanelID() { - return (Integer) getThing().getConfiguration().get(CONFIG_PANEL_ID); + Object panelId = getThing().getConfiguration().get(CONFIG_PANEL_ID); + if (panelId instanceof Integer) { + return (Integer) panelId; + } else if (panelId instanceof Number) { + return ((Number) panelId).intValue(); + } else { + // Fall back to parsing string representation of panel if it is not returning an integer + String stringPanelId = panelId.toString(); + Integer parsedPanelId = Integer.getInteger(stringPanelId); + if (parsedPanelId == null) { + return 0; + } else { + return parsedPanelId; + } + } } private void setPanelColor(HSBType color) {