diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java old mode 100644 new mode 100755 index eb2ddfe99b9..36a4ec5471b --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyBindingConstants.java @@ -47,6 +47,7 @@ public class ShellyBindingConstants { public static final String THING_TYPE_SHELLY4PRO_STR = "shelly4pro"; public static final String THING_TYPE_SHELLYPLUG_STR = "shellyplug"; public static final String THING_TYPE_SHELLYPLUGS_STR = "shellyplugs"; + public static final String THING_TYPE_SHELLYPLUGU1_STR = "shellyplugu1"; // Shely Plug US public static final String THING_TYPE_SHELLYDIMMER_STR = "shellydimmer"; public static final String THING_TYPE_SHELLYDIMMER2_STR = "shellydimmer2"; public static final String THING_TYPE_SHELLYIX3_STR = "shellyix3"; @@ -73,6 +74,7 @@ public class ShellyBindingConstants { public static final String SHELLYDT_1PM = "SHSW-PM"; public static final String SHELLYDT_SHPLG = "SHPLG-1"; public static final String SHELLYDT_SHPLG_S = "SHPLG-S"; + public static final String SHELLYDT_SHPLG_U1 = "SHPLG-U1"; public static final String SHELLYDT_SHELLY2 = "SHSW-21"; public static final String SHELLYDT_SHELLY25 = "SHSW-25"; public static final String SHELLYDT_SHPRO = "SHSW-44"; @@ -108,6 +110,8 @@ public class ShellyBindingConstants { public static final ThingTypeUID THING_TYPE_SHELLY4PRO = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLY4PRO_STR); public static final ThingTypeUID THING_TYPE_SHELLYPLUG = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUG_STR); public static final ThingTypeUID THING_TYPE_SHELLYPLUGS = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUGS_STR); + public static final ThingTypeUID THING_TYPE_SHELLYPLUGU1 = new ThingTypeUID(BINDING_ID, + THING_TYPE_SHELLYPLUGU1_STR); public static final ThingTypeUID THING_TYPE_SHELLYDIMMER = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYDIMMER_STR); public static final ThingTypeUID THING_TYPE_SHELLYDIMMER2 = new ThingTypeUID(BINDING_ID, @@ -138,18 +142,16 @@ public class ShellyBindingConstants { public static final ThingTypeUID THING_TYPE_SHELLYUNKNOWN = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYUNKNOWN_STR); - public static final Set SUPPORTED_THING_TYPES_UIDS = Collections - .unmodifiableSet(Stream - .of(THING_TYPE_SHELLY1, THING_TYPE_SHELLY1PM, THING_TYPE_SHELLYEM, THING_TYPE_SHELLY3EM, - THING_TYPE_SHELLY2_RELAY, THING_TYPE_SHELLY2_ROLLER, THING_TYPE_SHELLY25_RELAY, - THING_TYPE_SHELLY25_ROLLER, THING_TYPE_SHELLY4PRO, THING_TYPE_SHELLYPLUG, - THING_TYPE_SHELLYPLUGS, THING_TYPE_SHELLYDIMMER, THING_TYPE_SHELLYDIMMER2, - THING_TYPE_SHELLYIX3, THING_TYPE_SHELLYBULB, THING_TYPE_SHELLYDUO, THING_TYPE_SHELLYVINTAGE, - THING_TYPE_SHELLYRGBW2_COLOR, THING_TYPE_SHELLYRGBW2_WHITE, THING_TYPE_SHELLYHT, - THING_TYPE_SHELLYSENSE, THING_TYPE_SHELLYEYE, THING_TYPE_SHELLYSMOKE, THING_TYPE_SHELLYGAS, - THING_TYPE_SHELLYFLOOD, THING_TYPE_SHELLYDOORWIN, THING_TYPE_SHELLYDOORWIN2, - THING_TYPE_SHELLYBUTTON1, THING_TYPE_SHELLYPROTECTED, THING_TYPE_SHELLYUNKNOWN) - .collect(Collectors.toSet())); + public static final Set SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet( + Stream.of(THING_TYPE_SHELLY1, THING_TYPE_SHELLY1PM, THING_TYPE_SHELLYEM, THING_TYPE_SHELLY3EM, + THING_TYPE_SHELLY2_RELAY, THING_TYPE_SHELLY2_ROLLER, THING_TYPE_SHELLY25_RELAY, + THING_TYPE_SHELLY25_ROLLER, THING_TYPE_SHELLY4PRO, THING_TYPE_SHELLYPLUG, THING_TYPE_SHELLYPLUGS, + THING_TYPE_SHELLYPLUGU1, THING_TYPE_SHELLYDIMMER, THING_TYPE_SHELLYDIMMER2, THING_TYPE_SHELLYIX3, + THING_TYPE_SHELLYBULB, THING_TYPE_SHELLYDUO, THING_TYPE_SHELLYVINTAGE, THING_TYPE_SHELLYRGBW2_COLOR, + THING_TYPE_SHELLYRGBW2_WHITE, THING_TYPE_SHELLYHT, THING_TYPE_SHELLYSENSE, THING_TYPE_SHELLYEYE, + THING_TYPE_SHELLYSMOKE, THING_TYPE_SHELLYGAS, THING_TYPE_SHELLYFLOOD, THING_TYPE_SHELLYDOORWIN, + THING_TYPE_SHELLYDOORWIN2, THING_TYPE_SHELLYBUTTON1, THING_TYPE_SHELLYPROTECTED, + THING_TYPE_SHELLYUNKNOWN).collect(Collectors.toSet())); // Thing Configuration Properties public static final String CONFIG_DEVICEIP = "deviceIp"; diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyHandlerFactory.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/ShellyHandlerFactory.java old mode 100644 new mode 100755 diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/coap/ShellyCoapHandler.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/coap/ShellyCoapHandler.java index 66416db0a19..574f2938e6e 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/coap/ShellyCoapHandler.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/coap/ShellyCoapHandler.java @@ -237,7 +237,7 @@ public class ShellyCoapHandler implements ShellyCoapListener { reqStatus = sendRequest(reqStatus, config.deviceIp, COLOIT_URI_DEVSTATUS, Type.NON); discovering = true; } - } catch (IllegalArgumentException | NullPointerException e) { + } catch (JsonSyntaxException | IllegalArgumentException | NullPointerException e) { logger.debug("{}: Unable to process CoIoT Message for payload={}", thingName, payload, e); resetSerial(); } diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/config/ShellyThingConfiguration.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/config/ShellyThingConfiguration.java old mode 100644 new mode 100755 diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyDiscoveryParticipant.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyDiscoveryParticipant.java old mode 100644 new mode 100755 index 620576e4f5b..5f7010cb87e --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyDiscoveryParticipant.java @@ -186,7 +186,7 @@ public class ShellyDiscoveryParticipant implements MDNSDiscoveryParticipant { String thingLabel = deviceName.isEmpty() ? name + " - " + address : deviceName + " (" + name + "@" + address + ")"; return DiscoveryResultBuilder.create(thingUID).withProperties(properties).withLabel(thingLabel) - .withRepresentationProperty(name).build(); + .withRepresentationProperty(PROPERTY_DEV_NAME).build(); } } catch (IOException | NullPointerException e) { // maybe some format description was buggy diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreator.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreator.java index abeb9d7e324..2f231463443 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreator.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreator.java @@ -32,11 +32,13 @@ import org.openhab.core.thing.ThingUID; public class ShellyThingCreator { private static final Map THING_TYPE_MAPPING = new LinkedHashMap<>(); static { - // mapping by thing type + // mapping by device type id THING_TYPE_MAPPING.put(SHELLYDT_1PM, THING_TYPE_SHELLY1PM_STR); THING_TYPE_MAPPING.put(SHELLYDT_1, THING_TYPE_SHELLY1_STR); THING_TYPE_MAPPING.put(SHELLYDT_3EM, THING_TYPE_SHELLY3EM_STR); THING_TYPE_MAPPING.put(SHELLYDT_EM, THING_TYPE_SHELLYEM_STR); + THING_TYPE_MAPPING.put(SHELLYDT_SHPLG_S, THING_TYPE_SHELLYPLUGS_STR); + THING_TYPE_MAPPING.put(SHELLYDT_SHPLG_U1, THING_TYPE_SHELLYPLUGU1_STR); THING_TYPE_MAPPING.put(SHELLYDT_GAS, THING_TYPE_SHELLYGAS_STR); THING_TYPE_MAPPING.put(SHELLYDT_DW, THING_TYPE_SHELLYDOORWIN_STR); THING_TYPE_MAPPING.put(SHELLYDT_DW2, THING_TYPE_SHELLYDOORWIN2_STR); @@ -112,6 +114,9 @@ public class ShellyThingCreator { if (name.startsWith(THING_TYPE_SHELLYPLUGS_STR) || name.contains("-s")) { return THING_TYPE_SHELLYPLUGS_STR; } + if (name.startsWith(THING_TYPE_SHELLYPLUGU1_STR)) { + return THING_TYPE_SHELLYPLUGU1_STR; + } return THING_TYPE_SHELLYPLUG_STR; } if (name.startsWith(THING_TYPE_SHELLYRGBW2_PREFIX)) { 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 old mode 100644 new mode 100755 diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyComponents.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyComponents.java index 796067fb061..5345b5325bb 100644 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyComponents.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyComponents.java @@ -207,7 +207,7 @@ public class ShellyComponents { toQuantityType(getDouble(lastMin1), DIGITS_WATT, SmartHomeUnits.WATT)); // convert totalWatts into kw/h - totalWatts = totalWatts / (60.0 * 10000.0); + totalWatts = totalWatts / (60.0 * 1000.0); updated |= thingHandler.updateChannel(groupName, CHANNEL_METER_CURRENTWATTS, toQuantityType(getDouble(currentWatts), DIGITS_WATT, SmartHomeUnits.WATT)); updated |= thingHandler.updateChannel(groupName, CHANNEL_METER_TOTALKWH, diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly_de.properties b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly_de.properties index 100022069be..3d3890cfdaa 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly_de.properties +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly_de.properties @@ -465,7 +465,7 @@ channel-type.shelly.colorEffectRGBW2.option.1 = Meteoritenregen channel-type.shelly.colorEffectRGBW2.option.2 = Farbverlauf channel-type.shelly.colorEffectRGBW2.option.3 = Blitzen channel-type.shelly.sensorTemp.label = Temperatur -channel-type.shelly.sensorTemp.description = Aktuelle Temperatur des Sensors in ∞C +channel-type.shelly.sensorTemp.description = Aktuelle Temperatur des Sensors in °C channel-type.shelly.sensorExtTemp.label = Temperatur channel-type.shelly.sensorExtTemp.description = Aktuelle Temperatur des externen Sensors in ∞C channel-type.shelly.sensorExtHum.label = Luftfeuchtigkeit diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/lights.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/lights.xml index 09bc887f94a..b3daaf21b0a 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/lights.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/lights.xml @@ -14,6 +14,7 @@ + deviceName @@ -27,6 +28,7 @@ + deviceName @@ -40,6 +42,7 @@ + deviceName @@ -54,6 +57,7 @@ + deviceName @@ -78,6 +82,7 @@ + deviceName diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/relay.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/relay.xml index 6ebd13869f6..649d1093864 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/relay.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/relay.xml @@ -13,6 +13,7 @@ + deviceName @@ -26,6 +27,7 @@ + deviceName @@ -43,6 +45,7 @@ + deviceName @@ -64,6 +67,7 @@ + deviceName @@ -82,8 +86,10 @@ + deviceName + Shelly2 in Roller Mode @@ -94,6 +100,7 @@ + deviceName @@ -116,8 +123,10 @@ + deviceName + Shelly2 in Roller Mode @@ -128,6 +137,7 @@ + deviceName @@ -163,6 +173,7 @@ + deviceName @@ -175,6 +186,7 @@ + deviceName @@ -188,6 +200,21 @@ + deviceName + + + + + + Shelly Plug US with relay and meter + + + + + + + + deviceName @@ -201,6 +228,7 @@ + deviceName @@ -214,6 +242,7 @@ + deviceName @@ -227,6 +256,7 @@ + deviceName diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/sensor.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/sensor.xml index 3131955efc7..d877c0c694c 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/sensor.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/sensor.xml @@ -14,6 +14,7 @@ + deviceName @@ -27,6 +28,7 @@ + deviceName @@ -39,6 +41,7 @@ + deviceName @@ -51,6 +54,7 @@ + deviceName @@ -64,6 +68,7 @@ + deviceName @@ -77,6 +82,7 @@ + deviceName @@ -90,6 +96,7 @@ + deviceName @@ -103,6 +110,7 @@ + deviceName diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/unknown.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/unknown.xml index 03a20ca8c08..7555e75eccf 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/unknown.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/unknown.xml @@ -8,6 +8,7 @@ A password protected or unknown device. + deviceName @@ -30,6 +31,7 @@ This device is currently not supported + deviceName