Adjust namePattern for plus plug to accept US, UK, and IT versions

This commit is contained in:
Michael Zanetti 2023-03-01 16:33:08 +01:00
parent f8c3d17a0f
commit 90af2e22e9

View File

@ -306,7 +306,7 @@ void IntegrationPluginShelly::discoverThings(ThingDiscoveryInfo *info)
} else if (info->thingClassId() == shellyPlugThingClassId) { } else if (info->thingClassId() == shellyPlugThingClassId) {
namePattern = QRegExp("^shellyplug(-s)?-[0-9A-Z]+$"); namePattern = QRegExp("^shellyplug(-s)?-[0-9A-Z]+$");
} else if (info->thingClassId() == shellyPlusPlugThingClassId) { } 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) { } else if (info->thingClassId() == shellyRgbw2ThingClassId) {
namePattern = QRegExp("^shellyrgbw2-[0-9A-Z]+$"); namePattern = QRegExp("^shellyrgbw2-[0-9A-Z]+$");
} else if (info->thingClassId() == shellyDimmerThingClassId) { } else if (info->thingClassId() == shellyDimmerThingClassId) {
@ -371,10 +371,12 @@ void IntegrationPluginShelly::setupThing(ThingSetupInfo *info)
if (idParamTypeMap.contains(thing->thingClassId())) { if (idParamTypeMap.contains(thing->thingClassId())) {
QString shellyId = info->thing()->paramValue(idParamTypeMap.value(info->thing()->thingClassId())).toString(); QString shellyId = info->thing()->paramValue(idParamTypeMap.value(info->thing()->thingClassId())).toString();
if (!shellyId.contains("Plus")) { if (shellyId.contains("Plus")
setupGen1(info); || shellyId.startsWith("ShellyPlug") // Plus plug variants don't have Plus in the name, but are camelcased as opposed to 1st gen plugs
} else { ) {
setupGen2(info); setupGen2(info);
} else {
setupGen1(info);
} }
return; return;