diff --git a/shelly/README.md b/shelly/README.md index 30fd9e3f..557a0ebc 100644 --- a/shelly/README.md +++ b/shelly/README.md @@ -6,6 +6,7 @@ The currently supported devices are: * Shelly 1 * Shelly 1PM * Shelly Plus 1PM +* Shelly Pro 1PM * Shelly 1L * Shelly 2 * Shelly 2.5 diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index 050e2c51..92ee1993 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -91,6 +91,8 @@ void IntegrationPluginShelly::discoverThings(ThingDiscoveryInfo *info) namePattern = QRegExp("^shelly1pm-[0-9A-Z]+$"); } else if (info->thingClassId() == shellyPlus1pmThingClassId) { namePattern = QRegExp("^ShellyPlus1PM-[0-9A-Z]+$", Qt::CaseInsensitive); + } else if (info->thingClassId() == shellyPro1PmThingClassId) { + namePattern = QRegExp("^ShellyPro1PM-[0-9A-Z]+$", Qt::CaseInsensitive); } else if (info->thingClassId() == shelly1lThingClassId) { namePattern = QRegExp("^shelly1l-[0-9A-Z]+$"); } else if (info->thingClassId() == shellyPlugThingClassId) { @@ -1656,7 +1658,7 @@ void IntegrationPluginShelly::setupGen2(ThingSetupInfo *info) qCDebug(dcShelly) << "Init response:" << response; m_rpcClients.insert(info->thing(), client); - if (info->thing()->thingClassId() == shellyPlus1pmThingClassId || info->thing()->thingClassId() == shellyPlus1ThingClassId) { + if (info->thing()->thingClassId() == shellyPlus1pmThingClassId || info->thing()->thingClassId() == shellyPlus1ThingClassId || info->thing()->thingClassId() == shellyPro1PmThingClassId) { info->finish(Thing::ThingErrorNoError); @@ -1664,6 +1666,12 @@ void IntegrationPluginShelly::setupGen2(ThingSetupInfo *info) ThingDescriptor switchChild(shellySwitchThingClassId, info->thing()->name() + " switch", QString(), info->thing()->id()); switchChild.setParams(ParamList() << Param(shellySwitchThingChannelParamTypeId, 1)); emit autoThingsAppeared({switchChild}); + + if (info->thing()->thingClassId() == shellyPro1PmThingClassId) { + ThingDescriptor switchChild2(shellySwitchThingClassId, info->thing()->name() + " switch", QString(), info->thing()->id()); + switchChild2.setParams(ParamList() << Param(shellySwitchThingChannelParamTypeId, 2)); + emit autoThingsAppeared({switchChild2}); + } } return; } @@ -1790,7 +1798,7 @@ void IntegrationPluginShelly::setupGen2(ThingSetupInfo *info) QString id = key.toString(); if (id == "switch:0") { QVariantMap switch0 = notification.value("switch:0").toMap(); - if (switch0.contains("apower") && thing->hasState("currentPower")) { // for shellyplus1pm + if (switch0.contains("apower") && thing->hasState("currentPower")) { // for shelly plus|pro 1pm thing->setStateValue("currentPower", switch0.value("apower").toDouble()); } Thing *parentThing = myThings().filterByParentId(thing->id()).findByParams({Param(shellyPowerMeterChannelThingChannelParamTypeId, 1)}); diff --git a/shelly/integrationpluginshelly.json b/shelly/integrationpluginshelly.json index 0131bd30..81407041 100644 --- a/shelly/integrationpluginshelly.json +++ b/shelly/integrationpluginshelly.json @@ -428,6 +428,105 @@ } ] }, + { + "id": "d21a9182-2f5b-47c1-9a27-6dd8ebd50b5f", + "name": "shellyPro1Pm", + "displayName": "Shelly Pro 1PM", + "createMethods": ["discovery"], + "setupMethod": "enterpin", + "interfaces": [ "gateway", "smartmeterconsumer", "wirelessconnectable", "update" ], + "paramTypes": [ + { + "id": "4dcdd707-9049-4ee9-bfe5-3424e1628df5", + "name":"id", + "displayName": "Shelly ID", + "type": "QString", + "readOnly": true + } + ], + "stateTypes": [ + { + "id": "9942b350-9033-4491-8a99-538c042a9251", + "name": "power", + "displayName": "Powered", + "displayNameAction": "Turn on/off", + "type": "bool", + "defaultValue": false, + "writable": true, + "ioType": "digitalOutput" + }, + { + "id": "4913d3fd-f6b4-4a23-b495-ae83df8473c8", + "name": "connected", + "displayName": "Connected", + "type": "bool", + "defaultValue": false, + "cached": false + }, + { + "id": "903a1744-5551-4298-bacd-13066acc16a9", + "name": "signalStrength", + "displayName": "Signal strength", + "type": "uint", + "unit": "Percentage", + "minValue": 0, + "maxValue": 100, + "defaultValue": 0, + "cached": false + }, + { + "id": "93ab8203-cc26-4ae9-a61e-d8f0182221b0", + "name": "updateStatus", + "displayName": "Update status", + "type": "QString", + "possibleValues": ["idle", "available", "updating"], + "defaultValue": "idle" + }, + { + "id": "1dd09d4c-33e4-4496-8dc9-27b62a4092b0", + "name": "currentVersion", + "displayName": "Firmware version", + "type": "QString", + "defaultValue": "" + }, + { + "id": "07ca990a-96c7-4213-9af6-d69cb946cc46", + "name": "availableVersion", + "displayName": "Available firmware version", + "type": "QString", + "defaultValue": "" + }, + { + "id": "be8ca18d-7417-4e5b-a2b2-2d1c87a5ed34", + "name": "totalEnergyConsumed", + "displayName": "Total energy consumed", + "type": "double", + "unit": "KiloWattHour", + "defaultValue": 0 + }, + { + "id": "d5fd6531-defb-4dac-9025-62a35a20e2c6", + "name": "currentPower", + "displayName": "Current power consumption", + "type": "double", + "unit": "Watt", + "defaultValue": 0, + "cached": false + } + ], + "actionTypes": [ + { + "id": "faae305a-fa7d-46b9-9ef8-6a7f12455380", + "name": "reboot", + "displayName": "Reboot" + }, + { + "id": "89504849-9284-466d-b9d5-498e5f193c50", + "name": "performUpdate", + "displayName": "Update firmware" + } + ] + }, { "id": "20754114-1591-48b5-af2f-8c9966adb7c4", "name": "shelly1l",