From 90af2e22e9791326273a5467403120ea6945b299 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 1 Mar 2023 16:33:08 +0100 Subject: [PATCH] Adjust namePattern for plus plug to accept US, UK, and IT versions --- shelly/integrationpluginshelly.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index 6bd1d8ca..cd7fdd41 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -306,7 +306,7 @@ void IntegrationPluginShelly::discoverThings(ThingDiscoveryInfo *info) } else if (info->thingClassId() == shellyPlugThingClassId) { namePattern = QRegExp("^shellyplug(-s)?-[0-9A-Z]+$"); } else if (info->thingClassId() == shellyPlusPlugThingClassId) { - namePattern = QRegExp("^(ShellyPlusPlugS)-[0-9A-Z]+$"); + namePattern = QRegExp("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$"); } else if (info->thingClassId() == shellyRgbw2ThingClassId) { namePattern = QRegExp("^shellyrgbw2-[0-9A-Z]+$"); } else if (info->thingClassId() == shellyDimmerThingClassId) { @@ -371,10 +371,12 @@ void IntegrationPluginShelly::setupThing(ThingSetupInfo *info) if (idParamTypeMap.contains(thing->thingClassId())) { QString shellyId = info->thing()->paramValue(idParamTypeMap.value(info->thing()->thingClassId())).toString(); - if (!shellyId.contains("Plus")) { - setupGen1(info); - } else { + if (shellyId.contains("Plus") + || shellyId.startsWith("ShellyPlug") // Plus plug variants don't have Plus in the name, but are camelcased as opposed to 1st gen plugs + ) { setupGen2(info); + } else { + setupGen1(info); } return;