From 37ce496e287d551d9c394f4f05134126b6b7a1e1 Mon Sep 17 00:00:00 2001 From: Markus Michels Date: Thu, 28 Nov 2024 14:16:19 +0100 Subject: [PATCH 1/2] Re-Add/Fix Shelly Plus UNI support Signed-off-by: Markus Michels --- bundles/org.openhab.binding.shelly/README.md | 11 ++++++----- .../internal/ShellyBindingConstants.java | 1 + .../discovery/ShellyThingCreator.java | 6 ++++-- .../resources/OH-INF/i18n/shelly.properties | 1 + .../OH-INF/thing/shellyGen1_sensor.xml | 2 +- .../OH-INF/thing/shellyGen2_relay.xml | 19 +++++++++++++++++++ .../discovery/ShellyThingCreatorTest.java | 2 +- 7 files changed, 33 insertions(+), 9 deletions(-) diff --git a/bundles/org.openhab.binding.shelly/README.md b/bundles/org.openhab.binding.shelly/README.md index 572b6e1f3a357..ea81bf071f629 100644 --- a/bundles/org.openhab.binding.shelly/README.md +++ b/bundles/org.openhab.binding.shelly/README.md @@ -52,7 +52,7 @@ See section [Discovery](#discovery) for details. | shellydimmer | Shelly Dimmer | SHDM-1 | | shellydimmer2 | Shelly Dimmer2 | SHDM-2 | | shellyix3 | Shelly ix3 | SHIX3-1 | -| shellyuni | Shelly UNI, Shelly Plus UNI | SHUNI-1, SNSN-0043X | +| shellyuni | Shelly UNI, Shelly Plus UNI | SHUNI-1 | | shellyplug | Shelly Plug | SHPLG2-1 | | shellyplugs | Shelly Plug-S | SHPLG-S | | shellyem | Shelly EM with integrated Power Meters | SHEM | @@ -86,13 +86,14 @@ See section [Discovery](#discovery) for details. | shellyplus1pm | Shelly Plus 1PM with 1x relay + power meter | SNSW-001P16EU, S3SW-001P16EU | | shellyplus2pm-relay | Shelly Plus 2PM with 2x relay + power meter, relay mode | SNSW-002P16EU, SNSW-102P16EU | | shellyplus2pm-roller | Shelly Plus 2PM with 2x relay + power meter, roller mode | SNSW-002P16EU, SNSW-102P16EU | -| shellyplusplug | Shelly Plug-S | SNPL-00112EU | -| shellyplusplug | Shelly Plug-IT | SNPL-00110IT | -| shellyplusplug | Shelly Plug-UK | SNPL-00112UK | -| shellyplusplugus | Shelly Plug-US | SNPL-00116US | +| shellyplusplug | Shelly Plus Plug | SNPL-00112EU | +| shellyplusplug | Shelly Plus Plug-IT | SNPL-00110IT | +| shellyplusplug | Shelly Plus Plug-UK | SNPL-00112UK | +| shellyplusplugus | Shelly Plus Plug-US | SNPL-00116US | | shellyplusi4 | Shelly Plus i4 with 4x AC input | SNSN-0024X, S3SN-0024X | | shellyplusi4dc | Shelly Plus i4 with 4x DC input | SNSN-0D24X | | shellyplus10v | Shelly Plus Dimmer 0/10V (Gen 2) or 0/1/10V (Gen 3) | SNDM-00100WW, S3DM-0010WW | +| shellyplusuni | Shelly Plus UNI | SNSN-0043X | | shellyplusht | Shelly Plus HT with temperature + humidity sensor | SNSN-0013A | | shellyhtg3 | Shelly Plus HT Gen 3 with temperature + humidity sensor | S3SN-0U12A | | shellyplussmoke | Shelly Plus Smoke sensor | SNSN-0031Z | 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 index a94fe868d617d..ea395915b14b6 100644 --- 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 @@ -76,6 +76,7 @@ public class ShellyBindingConstants { THING_TYPE_SHELLYPLUSI4, // THING_TYPE_SHELLYPLUSI4DC, // THING_TYPE_SHELLYPLUSDIMMER10V, // + THING_TYPE_SHELLYPLUSUNI, // THING_TYPE_SHELLYPLUSHT, // THING_TYPE_SHELLYPLUSHTG3, // THING_TYPE_SHELLYPLUSSMOKE, // 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 108e6eb574d9e..1b3fd9d32e454 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 @@ -295,6 +295,8 @@ public class ShellyThingCreator { THING_TYPE_SHELLYPLUSI4DC_STR); public static final ThingTypeUID THING_TYPE_SHELLYPLUSHT = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUSHT_STR); + public static final ThingTypeUID THING_TYPE_SHELLYPLUSUNI = new ThingTypeUID(BINDING_ID, + THING_TYPE_SHELLYPLUSUNI_STR); public static final ThingTypeUID THING_TYPE_SHELLYPLUSHTG3 = new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUSHTG3_STR); public static final ThingTypeUID THING_TYPE_SHELLYPLUSSMOKE = new ThingTypeUID(BINDING_ID, @@ -398,7 +400,7 @@ public class ShellyThingCreator { THING_TYPE_MAPPING.put(SHELLYDT_PLUSHT, THING_TYPE_SHELLYPLUSHT_STR); THING_TYPE_MAPPING.put(SHELLYDT_PLUSHTG3, THING_TYPE_SHELLYPLUSHTG3_STR); THING_TYPE_MAPPING.put(SHELLYDT_PLUSSMOKE, THING_TYPE_SHELLYPLUSSMOKE_STR); - THING_TYPE_MAPPING.put(SHELLYDT_PLUSUNI, THING_TYPE_SHELLYUNI_STR); + THING_TYPE_MAPPING.put(SHELLYDT_PLUSUNI, THING_TYPE_SHELLYPLUSUNI_STR); THING_TYPE_MAPPING.put(SHELLYDT_PLUSDIMMERUS, THING_TYPE_SHELLYPLUSDIMMERUS_STR); THING_TYPE_MAPPING.put(SHELLYDT_PLUSDIMMER10V, THING_TYPE_SHELLYPLUSDIMMER10V_STR); THING_TYPE_MAPPING.put(SHELLYDT_PLUSDIMMER0110VG3, THING_TYPE_SHELLYPLUSDIMMER10V_STR); @@ -488,7 +490,7 @@ public class ShellyThingCreator { THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSI4DC_STR, THING_TYPE_SHELLYPLUSI4DC_STR); THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSHT_STR, THING_TYPE_SHELLYPLUSHT_STR); THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSSMOKE_STR, THING_TYPE_SHELLYPLUSSMOKE_STR); - THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSUNI_STR, THING_TYPE_SHELLYUNI_STR); + THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSUNI_STR, THING_TYPE_SHELLYPLUSUNI_STR); THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSDIMMERUS_STR, THING_TYPE_SHELLYPLUSDIMMERUS_STR); THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSDIMMER10V_STR, THING_TYPE_SHELLYPLUSDIMMER10V_STR); THING_TYPE_MAPPING.put(THING_TYPE_SHELLYPLUSDIMMER0110VG3_STR, THING_TYPE_SHELLYPLUSDIMMER10V_STR); diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly.properties b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly.properties index f023763233e86..fb00262ac1c0b 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly.properties +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/i18n/shelly.properties @@ -97,6 +97,7 @@ thing-type.shelly.shellyplus2pm-roller.description = Shelly Plus 2PM - Roller Co thing-type.shelly.shellyplusplug.description = Shelly Plus Plug S/IT/UK/US . Outlet with Power Meter thing-type.shelly.shellyplusi4.description = Shelly Plus i4 - 4xInput Device thing-type.shelly.shellyplusi4dc.description = Shelly Plus i4DC - 4xDC Input Device +thing-type.shelly.shellyplusuni.description = Shelly Plus UNI - Universal Module thing-type.shelly.shellyplusht.description = Shelly Plus HT - Humidity and Temperature sensor with display thing-type.shelly.shellyplushtg3.description = Shelly Plus HT Gen 3 - Humidity and Temperature sensor with display thing-type.shelly.shellyplussmoke.description = Shelly Plus Smoke - Smoke Detector with Alarm diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml index 6234c8b7b3ba3..fac3c05204bf9 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml @@ -310,7 +310,7 @@ - Number:Dimensionless + Number:Dimensionless @text/channel-type.shelly.sensorHumidity.description Humidity diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen2_relay.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen2_relay.xml index 1a0d7bb605152..ced065a340e84 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen2_relay.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen2_relay.xml @@ -129,6 +129,25 @@ + + + @text/thing-type.shelly.shellyplusuni.description + + + + + + + + + + + + + serviceName + + + @text/thing-type.shelly.shelly1mini.description diff --git a/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreatorTest.java b/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreatorTest.java index b0fa2871b92fe..4c5b35daf1dfb 100644 --- a/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreatorTest.java +++ b/bundles/org.openhab.binding.shelly/src/test/java/org/openhab/binding/shelly/internal/discovery/ShellyThingCreatorTest.java @@ -155,7 +155,7 @@ private static Stream provideTestCasesForGetThingUIDReturnsThingUidBy Arguments.of(SHELLYDT_PLUSHT, "", THING_TYPE_SHELLYPLUSHT_STR), // Arguments.of(SHELLYDT_PLUSHTG3, "", THING_TYPE_SHELLYPLUSHTG3_STR), // Arguments.of(SHELLYDT_PLUSSMOKE, "", THING_TYPE_SHELLYPLUSSMOKE_STR), // - Arguments.of(SHELLYDT_PLUSUNI, "", THING_TYPE_SHELLYUNI_STR), // + Arguments.of(SHELLYDT_PLUSUNI, "", THING_TYPE_SHELLYPLUSUNI_STR), // Arguments.of(SHELLYDT_PLUSDIMMERUS, "", THING_TYPE_SHELLYPLUSDIMMERUS_STR), // Arguments.of(SHELLYDT_PLUSDIMMER10V, "", THING_TYPE_SHELLYPLUSDIMMER10V_STR), // Arguments.of(SHELLYDT_PLUSDIMMER0110VG3, "", THING_TYPE_SHELLYPLUSDIMMER10V_STR), // From d50bcd840dd369808c61f7e4732e6aeaeea325a3 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Wed, 4 Dec 2024 20:19:29 +0100 Subject: [PATCH 2/2] Update bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml Co-authored-by: lsiepel Signed-off-by: Jacob Laursen --- .../src/main/resources/OH-INF/thing/shellyGen1_sensor.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml index fac3c05204bf9..6234c8b7b3ba3 100644 --- a/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml +++ b/bundles/org.openhab.binding.shelly/src/main/resources/OH-INF/thing/shellyGen1_sensor.xml @@ -310,7 +310,7 @@ - Number:Dimensionless + Number:Dimensionless @text/channel-type.shelly.sensorHumidity.description Humidity