From e9708c3b33b8afdc59b6759615462cc13605c092 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 29 Nov 2021 17:45:07 +0100 Subject: [PATCH] Shelly: Add support for the shelly vintage bulb --- shelly/README.md | 1 + shelly/integrationpluginshelly.cpp | 4 ++-- shelly/integrationpluginshelly.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/shelly/README.md b/shelly/README.md index 4e97801d..85fd8bb7 100644 --- a/shelly/README.md +++ b/shelly/README.md @@ -16,6 +16,7 @@ The currently supported devices are: * Shelly H+T * Shelly i3 * Shelly Motion +* Shelly Vintage ## Requirements Shelly devices communicate with via MQTT. This means, in order to add Shelly devices to nymea, the nymea instance is required diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index 60569ca9..35fee339 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -458,7 +458,7 @@ void IntegrationPluginShelly::discoverThings(ThingDiscoveryInfo *info) } else if (info->thingClassId() == shellyRgbw2ThingClassId) { namePattern = QRegExp("^shellyrgbw2-[0-9A-Z]+$"); } else if (info->thingClassId() == shellyDimmerThingClassId) { - namePattern = QRegExp("^shellydimmer(2)?-[0-9A-Z]+$"); + namePattern = QRegExp("^(shellydimmer(2)?|ShellyVintage)-[0-9A-Z]+$"); } else if (info->thingClassId() == shelly2ThingClassId) { namePattern = QRegExp("^shellyswitch-[0-9A-Z]+$"); } else if (info->thingClassId() == shelly25ThingClassId) { @@ -1302,7 +1302,7 @@ void IntegrationPluginShelly::setupShellyGateway(ThingSetupInfo *info) // Create 2 switches for some that have 2 if (info->thing()->thingClassId() == shelly2ThingClassId || info->thing()->thingClassId() == shelly25ThingClassId - || info->thing()->thingClassId() == shellyDimmerThingClassId + || (info->thing()->thingClassId() == shellyDimmerThingClassId && info->thing()->paramValue(shellyDimmerThingIdParamTypeId).toString().startsWith("shellydimmer")) // Don't create chids for shelly vintage || info->thing()->thingClassId() == shelly1lThingClassId) { ThingDescriptor switchChild(shellySwitchThingClassId, info->thing()->name() + " switch 1", QString(), info->thing()->id()); switchChild.setParams(ParamList() << Param(shellySwitchThingChannelParamTypeId, 1)); diff --git a/shelly/integrationpluginshelly.json b/shelly/integrationpluginshelly.json index 3ee3f01d..87da2f0d 100644 --- a/shelly/integrationpluginshelly.json +++ b/shelly/integrationpluginshelly.json @@ -839,7 +839,7 @@ { "id": "3a1d6fc1-c623-4b45-9c81-1573fcc15f99", "name": "shellyDimmer", - "displayName": "Shelly Dimmer / Dimmer 2", + "displayName": "Shelly Dimmer (2) / Vintage", "createMethods": ["discovery"], "interfaces": ["dimmablelight", "wirelessconnectable", "update"], "paramTypes": [