[shelly] Fix support for Shelly Plug US (#18775)

* Fix Shelly Plug US: This is a Gen2 device, but the service name is
missing the "plus" - shellyplugus instead of shellyplusplugus. As a
result the thing uses the Gen1 API, which does not work.

Signed-off-by: Markus Michels <markus7017@gmail.com>
pull/18664/head
Markus Michels 2025-06-12 15:02:55 -04:00 committed by GitHub
parent 78c4962b6a
commit b3893bf8f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 3 deletions

View File

@ -1226,7 +1226,7 @@ If the Shelly Add-On is installed:
The roller positioning calibration has to be performed using the Shelly Web UI or App before the position can be set in percent.
Refer to [Smartify Roller Shutters with openHAB and Shelly](doc/UseCaseSmartRoller.md) for more information on roller integration.
### Shelly Plus Plug-S/IT/UK/US (thing-type: shellyplusplug)
### Shelly Plus Plug-S/IT/UK/US (thing-type: shellyplusplug, shellyplusplugus)
| Group | Channel | Type | read-only | Description |
| ----- | ------------ | -------- | --------- | --------------------------------------------------------------------------------- |

View File

@ -201,6 +201,7 @@ public class ShellyThingCreator {
public static final String THING_TYPE_SHELLYPLUSSMOKE_STR = "shellyplussmoke";
public static final String THING_TYPE_SHELLYPLUSUNI_STR = "shellyplusuni";
public static final String THING_TYPE_SHELLYPLUSPLUGS_STR = "shellyplusplug";
public static final String SVC_TYPE_SHELLYPLUSPLUGUS_STR = "shellyplugus";
public static final String THING_TYPE_SHELLYPLUSPLUGUS_STR = "shellyplusplugus";
public static final String THING_TYPE_SHELLYPLUSDIMMERUS_STR = "shellypluswdus";
public static final String THING_TYPE_SHELLYPLUSDIMMER10V_STR = "shellyplus10v";
@ -515,6 +516,7 @@ public class ShellyThingCreator {
Map.entry(THING_TYPE_SHELLYPLUS1PMG4_STR, THING_TYPE_SHELLYPLUS1PM_STR),
Map.entry(THING_TYPE_SHELLYPLUS2PM_RELAY_STR, THING_TYPE_SHELLYPLUS2PM_RELAY_STR),
Map.entry(THING_TYPE_SHELLYPLUS2PM_ROLLER_STR, THING_TYPE_SHELLYPLUS2PM_ROLLER_STR),
Map.entry(SVC_TYPE_SHELLYPLUSPLUGUS_STR, THING_TYPE_SHELLYPLUSPLUGUS_STR),
Map.entry(THING_TYPE_SHELLYPLUSPLUGS_STR, THING_TYPE_SHELLYPLUSPLUGS_STR),
Map.entry(THING_TYPE_SHELLYPLUSPLUGUS_STR, THING_TYPE_SHELLYPLUSPLUGUS_STR),
Map.entry(THING_TYPE_SHELLYPLUSI4_STR, THING_TYPE_SHELLYPLUSI4_STR),
@ -604,7 +606,7 @@ public class ShellyThingCreator {
if (serviceNameLowerCase.startsWith(THING_TYPE_SHELLY2_PREFIX)) { // Shelly v2
return getRelayOrRollerType(THING_TYPE_SHELLY2_RELAY_STR, THING_TYPE_SHELLY2_ROLLER_STR, mode);
}
if (serviceNameLowerCase.startsWith(THING_TYPE_SHELLYPLUG_STR)) {
if (serviceNameLowerCase.startsWith(THING_TYPE_SHELLYPLUG_STR) && !serviceNameLowerCase.contains("plugus")) {
// shellyplug-s needs to be mapped to shellyplugs to follow the schema
// for the thing types: <thing type>-<mode>
if (serviceNameLowerCase.startsWith(THING_TYPE_SHELLYPLUGS_STR) || serviceNameLowerCase.contains("-s")) {

View File

@ -94,7 +94,8 @@ thing-type.shelly.shellyplus1.description = Shelly Plus 1 (Single Relay Switch)
thing-type.shelly.shellyplus1pm.description = Shelly Plus 1PM - Single Relay Switch with Power Meter
thing-type.shelly.shellyplus2pm-relay.description = Shelly Plus 2PM - Dual Relay Switch with Power Meter
thing-type.shelly.shellyplus2pm-roller.description = Shelly Plus 2PM - Roller Control with Power Meter
thing-type.shelly.shellyplusplug.description = Shelly Plus Plug S/IT/UK/US . Outlet with Power Meter
thing-type.shelly.shellyplusplug.description = Shelly Plus Plug S/IT/UK. Outlet with Power Meter
thing-type.shelly.shellyplusplugus.description = Shelly Plus Plug 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

View File

@ -87,6 +87,20 @@
<config-description-ref uri="thing-type:shelly:relay-gen2"/>
</thing-type>
<thing-type id="shellyplusplugus">
<label>ShellyPlus Plug US</label>
<description>@text/thing-type.shelly.shellyplusplugus.description</description>
<category>PowerOutlet</category>
<semantic-equipment-tag>PowerOutlet</semantic-equipment-tag>
<channel-groups>
<channel-group id="relay" typeId="relayChannelPlug"/>
<channel-group id="meter" typeId="meter"/>
<channel-group id="device" typeId="deviceStatus"/>
</channel-groups>
<representation-property>serviceName</representation-property>
<config-description-ref uri="thing-type:shelly:relay-gen2"/>
</thing-type>
<thing-type id="shellyplusi4">
<label>ShellyPlus i4</label>

View File

@ -91,6 +91,7 @@ public class ShellyDeviceProfileTest {
Arguments.of(THING_TYPE_SHELLYPLUS2PM_RELAY_STR, true, false), //
Arguments.of(THING_TYPE_SHELLYPLUS2PM_ROLLER_STR, true, false), //
Arguments.of(THING_TYPE_SHELLYPLUSPLUGS_STR, true, false), //
Arguments.of(THING_TYPE_SHELLYPLUSPLUGUS_STR, true, false), //
Arguments.of(THING_TYPE_SHELLYPLUSI4_STR, true, false), //
Arguments.of(THING_TYPE_SHELLYPLUSI4DC_STR, true, false), //
Arguments.of(THING_TYPE_SHELLY1MINI_STR, true, false), //

View File

@ -89,6 +89,7 @@ public class ShellyThingCreatorTest {
Arguments.of("shellyplug-su1-" + DEVICE_ID, "", "", THING_TYPE_SHELLYPLUGS_STR), //
Arguments.of("shellyplugu1-" + DEVICE_ID, "", "", THING_TYPE_SHELLYPLUGU1_STR), //
Arguments.of("shellyplugu12-" + DEVICE_ID, "", "", THING_TYPE_SHELLYPLUGU1_STR), //
Arguments.of("shellyplugus-" + DEVICE_ID, "", "", THING_TYPE_SHELLYPLUSPLUGUS_STR), //
Arguments.of("shellyrgbw2-" + DEVICE_ID, "", "color", THING_TYPE_SHELLYRGBW2_COLOR_STR), //
Arguments.of("shellyrgbw2-" + DEVICE_ID, "", "", THING_TYPE_SHELLYRGBW2_WHITE_STR), //
Arguments.of("shellyrgbw2-" + DEVICE_ID, "", "colour", THING_TYPE_SHELLYRGBW2_WHITE_STR), //