Shelly: Set discovery insensitive to upper / lower case
This commit is contained in:
parent
10c54614d6
commit
530fcd6b68
@ -86,7 +86,7 @@ void IntegrationPluginShelly::discoverThings(ThingDiscoveryInfo *info)
|
||||
if (info->thingClassId() == shelly1ThingClassId) {
|
||||
namePattern = QRegExp("^shelly1-[0-9A-Z]+$");
|
||||
} else if (info->thingClassId() == shellyPlus1ThingClassId) {
|
||||
namePattern = QRegExp("^ShellyPlus1-[0-9A-Z]+$");
|
||||
namePattern = QRegExp("^ShellyPlus1-[0-9A-Z]+$", Qt::CaseInsensitive);
|
||||
} else if (info->thingClassId() == shelly1pmThingClassId) {
|
||||
namePattern = QRegExp("^shelly1pm-[0-9A-Z]+$");
|
||||
} else if (info->thingClassId() == shellyPlus1pmThingClassId) {
|
||||
@ -96,15 +96,15 @@ 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|ShellyPlug(US|IT|UK))-[0-9A-Z]+$");
|
||||
namePattern = QRegExp("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$", Qt::CaseInsensitive);
|
||||
} else if (info->thingClassId() == shellyRgbw2ThingClassId) {
|
||||
namePattern = QRegExp("^shellyrgbw2-[0-9A-Z]+$");
|
||||
} else if (info->thingClassId() == shellyDimmerThingClassId) {
|
||||
namePattern = QRegExp("^(shellydimmer(2)?|ShellyVintage)-[0-9A-Z]+$");
|
||||
namePattern = QRegExp("^(shellydimmer(2)?|ShellyVintage)-[0-9A-Z]+$", Qt::CaseInsensitive);
|
||||
} else if (info->thingClassId() == shelly2ThingClassId) {
|
||||
namePattern = QRegExp("^shellyswitch-[0-9A-Z]+$");
|
||||
} else if (info->thingClassId() == shelly25ThingClassId) {
|
||||
namePattern = QRegExp("^(shellyswitch25|ShellyPlus2PM)-[0-9A-Z]+$");
|
||||
namePattern = QRegExp("^(shellyswitch25|ShellyPlus2PM)-[0-9A-Z]+$", Qt::CaseInsensitive);
|
||||
} else if (info->thingClassId() == shellyButton1ThingClassId) {
|
||||
namePattern = QRegExp("^shellybutton1-[0-9-A-Z]+$");
|
||||
} else if (info->thingClassId() == shellyEmThingClassId) {
|
||||
@ -112,7 +112,7 @@ void IntegrationPluginShelly::discoverThings(ThingDiscoveryInfo *info)
|
||||
} else if (info->thingClassId() == shellyEm3ThingClassId) {
|
||||
namePattern = QRegExp("^shellyem3-[0-9A-Z]+$");
|
||||
} else if (info->thingClassId() == shellyPro3EMThingClassId) {
|
||||
namePattern = QRegExp("^ShellyPro3EM-[0-9A-Z]+$");
|
||||
namePattern = QRegExp("^ShellyPro3EM-[0-9A-Z]+$", Qt::CaseInsensitive);
|
||||
} else if (info->thingClassId() == shellyHTThingClassId) {
|
||||
namePattern = QRegExp("shellyht-[0-9A-Z]+$");
|
||||
} else if (info->thingClassId() == shellyI3ThingClassId) {
|
||||
@ -2044,9 +2044,9 @@ QHostAddress IntegrationPluginShelly::getIP(Thing *thing) const
|
||||
|
||||
bool IntegrationPluginShelly::isGen2(const QString &shellyId) const
|
||||
{
|
||||
return shellyId.contains("Plus")
|
||||
|| shellyId.contains("Pro")
|
||||
|| shellyId.startsWith("ShellyPlug") // Plus plug variants don't have Plus in the name, but are camelcased as opposed to 1st gen plugs
|
||||
return shellyId.contains("Plus", Qt::CaseInsensitive)
|
||||
|| shellyId.contains("Pro", Qt::CaseInsensitive)
|
||||
|| QRegExp("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$", Qt::CaseInsensitive).exactMatch(shellyId) // Plus plug variants need to be matched quite precisely to not also match the v1 Plug
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user