From 2836eb4cc443dacd59e3779508f214fb30b6d102 Mon Sep 17 00:00:00 2001 From: loosrob <79396812+loosrob@users.noreply.github.com> Date: Mon, 7 Feb 2022 21:34:53 +0100 Subject: [PATCH] rebase on correct master --- shelly/integrationpluginshelly.cpp | 159 +++++++++++++++++++--------- shelly/integrationpluginshelly.json | 121 +++++++++++++-------- 2 files changed, 187 insertions(+), 93 deletions(-) diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index a4eb978b..5749cea9 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -337,6 +337,8 @@ static QHash powerActionTypesMap = { {shellySocketPMPowerActionTypeId, shellySocketPMThingClassId}, {shellyEmPowerActionTypeId, shellyEmThingClassId}, {shellyEm3PowerActionTypeId, shellyEm3ThingClassId}, + {shelly25Channel1ActionTypeId, shelly25ThingClassId}, + {shelly25Channel2ActionTypeId, shelly25ThingClassId} }; static QHash powerActionParamTypesMap = { @@ -352,6 +354,8 @@ static QHash powerActionParamTypesMap = { {shellySocketPMPowerActionTypeId, shellySocketPMPowerActionPowerParamTypeId}, {shellyEmPowerActionTypeId, shellyEmPowerActionPowerParamTypeId}, {shellyEm3PowerActionTypeId, shellyEm3PowerActionPowerParamTypeId}, + {shelly25Channel1ActionTypeId, shelly25Channel1ActionChannel1ParamTypeId}, + {shelly25Channel2ActionTypeId, shelly25Channel2ActionChannel2ParamTypeId} }; static QHash colorPowerActionTypesMap = { @@ -431,6 +435,18 @@ static QHash updateActionTypesMap = { {shellyMotionPerformUpdateActionTypeId, shellyMotionThingClassId} }; +// Settings +static QHash longpushMinDurationSettingIds = { + {shellyI3ThingClassId, shellyI3SettingsLongpushMinDurationParamTypeId} +}; +static QHash longpushMaxDurationSettingIds = { + {shellyButton1ThingClassId, shellyButton1SettingsLongpushMaxDurationParamTypeId}, + {shellyI3ThingClassId, shellyI3SettingsLongpushMaxDurationParamTypeId} +}; +static QHash multipushTimeBetweenPushesSettingIds = { + {shellyButton1ThingClassId, shellyButton1SettingsMultipushTimeBetweenPushesParamTypeId}, + {shellyI3ThingClassId, shellyI3SettingsMultipushTimeBetweenPushesParamTypeId} +}; IntegrationPluginShelly::IntegrationPluginShelly() { @@ -461,7 +477,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) { @@ -569,8 +585,14 @@ void IntegrationPluginShelly::executeAction(ThingActionInfo *info) MqttChannel *channel = m_mqttChannels.value(parentDevice); QString shellyId = parentDevice->paramValue(idParamTypeMap.value(parentDevice->thingClassId())).toString(); int relay = 1; + QHash actionChannelMap = { + {shelly25Channel1ActionTypeId, 1}, + {shelly25Channel2ActionTypeId, 2} + }; if (channelParamTypeMap.contains(thing->thingClassId())) { relay = thing->paramValue(channelParamTypeMap.value(thing->thingClassId())).toInt(); + } else if (actionChannelMap.contains(action.actionTypeId())) { + relay = actionChannelMap.value(action.actionTypeId()); } ParamTypeId powerParamTypeId = powerActionParamTypesMap.value(action.actionTypeId()); bool on = action.param(powerParamTypeId).value().toBool(); @@ -761,7 +783,7 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr return; } - qCDebug(dcShelly()) << "Publish received from" << thing->name() << topic; + qCDebug(dcShelly()) << "Publish received from" << thing->name() << topic << payload; QString shellyId = thing->paramValue(idParamTypeMap.value(thing->thingClassId())).toString(); if (topic == "shellies/" + shellyId + "/info") { @@ -772,7 +794,6 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr qCWarning(dcShelly()) << qUtf8Printable(payload); return; } - // qCDebug(dcShelly()) << "Payload:" << qUtf8Printable(jsonDoc.toJson()); QVariantMap data = jsonDoc.toVariant().toMap(); // Wifi signal strength @@ -792,6 +813,36 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr thing->setStateValue(currentVersionStateTypesMap.value(thing->thingClassId()), data.value("update").toMap().value("old_version").toString()); thing->setStateValue(availableVersionStateTypesMap.value(thing->thingClassId()), data.value("update").toMap().value("new_version").toString()); + if (data.contains("longpush_duration_ms")) { + if (longpushMinDurationSettingIds.contains(thing->thingClassId())) { + thing->setSettingValue(longpushMinDurationSettingIds.value(thing->thingClassId()), data.value("longpush_duration_ms").toMap().value("min").toUInt()); + } + foreach (Thing *child, myThings().filterByParentId(thing->id())) { + if (longpushMinDurationSettingIds.contains(child->thingClassId())) { + thing->setSettingValue(longpushMinDurationSettingIds.value(thing->thingClassId()), data.value("longpush_duration_ms").toMap().value("min").toUInt()); + } + } + if (longpushMaxDurationSettingIds.contains(thing->thingClassId())) { + thing->setSettingValue(longpushMaxDurationSettingIds.value(thing->thingClassId()), data.value("longpush_duration_ms").toMap().value("max").toUInt()); + } + foreach (Thing *child, myThings().filterByParentId(thing->id())) { + if (longpushMaxDurationSettingIds.contains(child->thingClassId())) { + thing->setSettingValue(longpushMaxDurationSettingIds.value(thing->thingClassId()), data.value("longpush_duration_ms").toMap().value("max").toUInt()); + } + } + } + if (data.contains("multipush_time_between_pushes_ms")) { + if (multipushTimeBetweenPushesSettingIds.contains(thing->thingClassId())) { + thing->setSettingValue(multipushTimeBetweenPushesSettingIds.value(thing->thingClassId()), data.value("multipush_time_between_pushes_ms").toMap().value("max").toUInt()); + } + foreach (Thing *child, myThings().filterByParentId(thing->id())) { + if (multipushTimeBetweenPushesSettingIds.contains(child->thingClassId())) { + thing->setSettingValue(multipushTimeBetweenPushesSettingIds.value(thing->thingClassId()), data.value("multipush_time_between_pushes_ms").toMap().value("max").toUInt()); + } + } + } + + // While we normally use the specific topics instead of the "info" object, the Shell H&T posts it very rarely // and in combination with its power safe mode let's use this one to get temp/humidity if (thing->thingClassId() == shellyHTThingClassId) { @@ -806,27 +857,17 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr if (topic.startsWith("shellies/" + shellyId + "/input/")) { - // qCDebug(dcShelly()) << "Payload:" << payload; int channel = topic.split("/").last().toInt(); // "1" or "0" // Emit event button pressed bool on = payload == "1"; if (thing->thingClassId() == shellyI3ThingClassId) { if (channel == 0) { - if (thing->stateValue(shellyI3Input1StateTypeId).toBool() != on) { - thing->setStateValue(shellyI3Input1StateTypeId, on); - emit emitEvent(Event(shellyI3Input1EventTypeId, thing->id())); - } + thing->setStateValue(shellyI3Input1StateTypeId, on); } else if (channel == 1) { - if (thing->stateValue(shellyI3Input2StateTypeId).toBool() != on) { - thing->setStateValue(shellyI3Input2StateTypeId, on); - emit emitEvent(Event(shellyI3Input2EventTypeId, thing->id())); - } + thing->setStateValue(shellyI3Input2StateTypeId, on); } else { - if (thing->stateValue(shellyI3Input3StateTypeId).toBool() != on) { - thing->setStateValue(shellyI3Input3StateTypeId, on); - emit emitEvent(Event(shellyI3Input3EventTypeId, thing->id())); - } + thing->setStateValue(shellyI3Input3StateTypeId, on); } return; } @@ -842,7 +883,6 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr QRegExp topicMatcher = QRegExp("shellies/" + shellyId + "/relay/[0-1]"); if (topicMatcher.exactMatch(topic)) { - // qCDebug(dcShelly()) << "Payload:" << payload; QStringList parts = topic.split("/"); int channel = parts.at(3).toInt(); bool on = payload == "on"; @@ -851,6 +891,15 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr if (powerStateTypeMap.contains(thing->thingClassId())) { thing->setStateValue(powerStateTypeMap.value(thing->thingClassId()), on); } + // If the shelly main thing has multiple channels (e.g. Shelly 2.5) + if (thing->thingClassId() == shelly25ThingClassId) { + QHash powerChannelStateTypesMap = { + {0, shelly25Channel1StateTypeId}, + {1, shelly25Channel2StateTypeId} + }; + thing->setStateValue(powerChannelStateTypesMap.value(channel), on); + } + // And switch all childs of this shelly too foreach (Thing *child, myThings().filterByParentId(thing->id())) { if (powerStateTypeMap.contains(child->thingClassId())) { @@ -860,11 +909,11 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr } } } + } topicMatcher = QRegExp("shellies/" + shellyId + "/(relay|roller)/[0-1]/power"); if (topicMatcher.exactMatch(topic)) { - // qCDebug(dcShelly()) << "Payload:" << payload; QStringList parts = topic.split("/"); int channel = parts.at(3).toInt(); double power = payload.toDouble(); @@ -883,7 +932,6 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr topicMatcher = QRegExp("shellies/" + shellyId + "/(relay|roller)/[0-1]/energy"); if (topicMatcher.exactMatch(topic)) { - // qCDebug(dcShelly()) << "Payload:" << payload; QStringList parts = topic.split("/"); int channel = parts.at(3).toInt(); // W/min => kW/h @@ -902,7 +950,6 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr } if (topic == "shellies/" + shellyId + "/color/0") { - // qCDebug(dcShelly()) << "Payload:" << payload; bool on = payload == "on"; if (powerStateTypeMap.contains(thing->thingClassId())) { thing->setStateValue(powerStateTypeMap.value(thing->thingClassId()), on); @@ -910,7 +957,6 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr } if (topic == "shellies/" + shellyId + "/color/0/status") { - // qCDebug(dcShelly()) << "Payload:" << payload; QJsonParseError error; QJsonDocument jsonDoc = QJsonDocument::fromJson(payload, &error); if (error.error != QJsonParseError::NoError) { @@ -933,7 +979,6 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr } if (topic == "shellies/" + shellyId + "/light/0") { - // qCDebug(dcShelly()) << "Payload:" << payload; bool on = payload == "on"; if (powerStateTypeMap.contains(thing->thingClassId())) { thing->setStateValue(powerStateTypeMap.value(thing->thingClassId()), on); @@ -988,6 +1033,7 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr } if (topic.startsWith("shellies/" + shellyId + "/input_event/")) { + qCDebug(dcShelly()) << "Payload:" << payload; if (thing->thingClassId() == shellyButton1ThingClassId) { // it can be only at channel 0 QJsonParseError error; QJsonDocument jsonDoc = QJsonDocument::fromJson(payload, &error); @@ -1012,28 +1058,26 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr qCWarning(dcShelly()) << "Failed to parse JSON from shelly:" << error.errorString() << qUtf8Printable(payload); return; } + + QString buttonName = QString::number(channel + 1); QString event = jsonDoc.toVariant().toMap().value("event").toString(); - if (event.isEmpty()) { - return; - } - QString param = ""; - EventTypeId eventTypeId = shellyI3LongPressedEventTypeId; - ParamTypeId paramTypeId = shellyI3LongPressedEventButtonNameParamTypeId; - ParamTypeId param2TypeId = shellyI3LongPressedEventOriginParamTypeId; - if (event == "L") { - param = "1"; + if (event == "S") { + thing->emitEvent(shellyI3PressedEventTypeId, ParamList() << Param(shellyI3PressedEventButtonNameParamTypeId, buttonName) << Param(shellyI3PressedEventCountParamTypeId, 1)); + } else if (event == "L") { + thing->emitEvent(shellyI3LongPressedEventTypeId, ParamList() << Param(shellyI3LongPressedEventButtonNameParamTypeId, buttonName)); + } else if (event == "SS") { + thing->emitEvent(shellyI3PressedEventTypeId, ParamList() << Param(shellyI3PressedEventButtonNameParamTypeId, buttonName) << Param(shellyI3PressedEventCountParamTypeId, 2)); + } else if (event == "SSS") { + thing->emitEvent(shellyI3PressedEventTypeId, ParamList() << Param(shellyI3PressedEventButtonNameParamTypeId, buttonName) << Param(shellyI3PressedEventCountParamTypeId, 3)); } else if (event == "SL") { - param = "2"; + thing->emitEvent(shellyI3PressedEventTypeId, ParamList() << Param(shellyI3PressedEventButtonNameParamTypeId, buttonName) << Param(shellyI3PressedEventCountParamTypeId, 1)); + thing->emitEvent(shellyI3LongPressedEventTypeId, ParamList() << Param(shellyI3LongPressedEventButtonNameParamTypeId, buttonName)); } else if (event == "LS") { - param = "3"; - } else { // short press - param = QString::number(event.length()); - eventTypeId = shellyI3PressedEventTypeId; - paramTypeId = shellyI3PressedEventButtonNameParamTypeId; - param2TypeId = shellyI3PressedEventOriginParamTypeId; + thing->emitEvent(shellyI3LongPressedEventTypeId, ParamList() << Param(shellyI3LongPressedEventButtonNameParamTypeId, buttonName)); + thing->emitEvent(shellyI3PressedEventTypeId, ParamList() << Param(shellyI3PressedEventButtonNameParamTypeId, buttonName) << Param(shellyI3PressedEventCountParamTypeId, 1)); + } else { + qCDebug(dcShelly()) << "Invalid button code from shelly I3:" << event; } - QString usedSwitch = QString::number(channel + 1); - thing->emitEvent(eventTypeId, ParamList() << Param(paramTypeId, param) << Param(param2TypeId, usedSwitch)); } } @@ -1140,7 +1184,7 @@ void IntegrationPluginShelly::onPublishReceived(MqttChannel *channel, const QStr } double power = child->stateValue(shellyEmChannelCurrentPowerPhaseAStateTypeId).toDouble(); double reactivePower = child->stateValue(shellyEmChannelReactivePowerPhaseAStateTypeId).toDouble(); - double root = qsqrt(power*power + reactivePower*reactivePower); + double root = qSqrt(power*power + reactivePower*reactivePower); if (qFuzzyCompare(root, 0) == false) { double calcPf = power/root; child->setStateValue(shellyEmChannelPowerFactorPhaseAStateTypeId, calcPf); @@ -1248,12 +1292,13 @@ void IntegrationPluginShelly::setupShellyGateway(ThingSetupInfo *info) } MqttChannel *channel = hardwareManager()->mqttProvider()->createChannel(shellyId, QHostAddress(address), {"shellies"}); - m_mqttChannels.insert(info->thing(), channel); if (!channel) { qCWarning(dcShelly()) << "Failed to create MQTT channel."; return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Error creating MQTT channel. Please check MQTT server settings.")); } + + m_mqttChannels.insert(info->thing(), channel); connect(channel, &MqttChannel::clientConnected, this, &IntegrationPluginShelly::onClientConnected); connect(channel, &MqttChannel::clientDisconnected, this, &IntegrationPluginShelly::onClientDisconnected); connect(channel, &MqttChannel::publishReceived, this, &IntegrationPluginShelly::onPublishReceived); @@ -1327,7 +1372,11 @@ void IntegrationPluginShelly::setupShellyGateway(ThingSetupInfo *info) info->thing()->setSettingValue(shellyButton1SettingsRemainAwakeParamTypeId, settingsMap.value("remain_awake").toInt()); info->thing()->setSettingValue(shellyButton1SettingsStatusLedEnabledParamTypeId, !settingsMap.value("led_status_disable").toBool()); info->thing()->setSettingValue(shellyButton1SettingsLongpushMaxDurationParamTypeId, settingsMap.value("longpush_duration_ms").toMap().value("max").toUInt()); - info->thing()->setSettingValue(shellyButton1SettingsMultipressIntervalParamTypeId, settingsMap.value("multipush_time_between_pushes_ms").toMap().value("max").toUInt()); + info->thing()->setSettingValue(shellyButton1SettingsMultipushTimeBetweenPushesParamTypeId, settingsMap.value("multipush_time_between_pushes_ms").toMap().value("max").toUInt()); + } else if (info->thing()->thingClassId() == shellyI3ThingClassId) { + info->thing()->setSettingValue(shellyI3SettingsLongpushMinDurationParamTypeId, settingsMap.value("longpush_duration_ms").toMap().value("min").toUInt()); + info->thing()->setSettingValue(shellyI3SettingsLongpushMaxDurationParamTypeId, settingsMap.value("longpush_duration_ms").toMap().value("max").toUInt()); + info->thing()->setSettingValue(shellyI3SettingsMultipushTimeBetweenPushesParamTypeId, settingsMap.value("multipush_time_between_pushes_ms").toMap().value("max").toUInt()); } ThingDescriptors autoChilds; @@ -1336,17 +1385,17 @@ void IntegrationPluginShelly::setupShellyGateway(ThingSetupInfo *info) if (myThings().filterByParentId(info->thing()->id()).isEmpty()) { // Always create the switch thing if we don't have one yet for shellies with input (1, 1pm etc) if (info->thing()->thingClassId() == shelly1ThingClassId - || info->thing()->thingClassId() == shelly1pmThingClassId - || info->thing()->thingClassId() == shelly1lThingClassId) { + || info->thing()->thingClassId() == shelly1pmThingClassId) { ThingDescriptor switchChild(shellySwitchThingClassId, info->thing()->name() + " switch", QString(), info->thing()->id()); switchChild.setParams(ParamList() << Param(shellySwitchThingChannelParamTypeId, 1)); autoChilds.append(switchChild); } - // Create 2 switches for shelly 2.5 + // 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)); autoChilds.append(switchChild); @@ -1491,7 +1540,8 @@ void IntegrationPluginShelly::setupShellyGateway(ThingSetupInfo *info) // Handle thing settings of gateway devices if (info->thing()->thingClassId() == shellyPlugThingClassId || - info->thing()->thingClassId() == shellyButton1ThingClassId) { + info->thing()->thingClassId() == shellyButton1ThingClassId || + info->thing()->thingClassId() == shellyI3ThingClassId) { connect(info->thing(), &Thing::settingChanged, this, [this, thing, shellyId](const ParamTypeId &settingTypeId, const QVariant &value) { pluginStorage()->beginGroup(thing->id().toString()); @@ -1515,14 +1565,23 @@ void IntegrationPluginShelly::setupShellyGateway(ThingSetupInfo *info) } else if (settingTypeId == shellyButton1SettingsStatusLedEnabledParamTypeId) { url.setPath("/settings"); query.addQueryItem("led_status_disable", value.toBool() ? "false" : "true"); - } else if (settingTypeId == shellyButton1SettingsLongpushMaxDurationParamTypeId) { + } else if (settingTypeId == shellyI3SettingsLongpushMinDurationParamTypeId) { + url.setPath("/settings"); + query.addQueryItem("longpush_duration_ms_min", value.toString()); + } else if (settingTypeId == shellyButton1SettingsLongpushMaxDurationParamTypeId + || settingTypeId == shellyI3SettingsLongpushMaxDurationParamTypeId) { url.setPath("/settings"); query.addQueryItem("longpush_duration_ms_max", value.toString()); + } else if (settingTypeId == shellyButton1SettingsMultipushTimeBetweenPushesParamTypeId + || settingTypeId == shellyI3SettingsMultipushTimeBetweenPushesParamTypeId) { + url.setPath("/settings"); + query.addQueryItem("multipush_time_between_pushes_ms_max", value.toString()); } url.setQuery(query); QNetworkReply *reply = hardwareManager()->networkManager()->get(QNetworkRequest(url)); + qCDebug(dcShelly()) << "Setting configuration:" << url.toString(); connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater); }); } @@ -1562,7 +1621,7 @@ void IntegrationPluginShelly::setupShellyChild(ThingSetupInfo *info) url.setScheme("http"); url.setHost(address); url.setPort(80); - url.setPath("/settings/relay/0"); + url.setPath(QString("/settings/relay/%1").arg(thing->paramValue(channelParamTypeMap.value(thing->thingClassId())).toInt() + 1)); url.setUserName(parentDevice->paramValue(usernameParamTypeMap.value(parentDevice->thingClassId())).toString()); url.setPassword(parentDevice->paramValue(passwordParamTypeMap.value(parentDevice->thingClassId())).toString()); diff --git a/shelly/integrationpluginshelly.json b/shelly/integrationpluginshelly.json index 07fa9f41..b5b5cec6 100644 --- a/shelly/integrationpluginshelly.json +++ b/shelly/integrationpluginshelly.json @@ -206,8 +206,7 @@ "displayNameEvent": "Current power consumption changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 } ], "actionTypes": [ @@ -323,8 +322,7 @@ "displayNameEvent": "Current power consumption changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 } ], "actionTypes": [ @@ -531,6 +529,28 @@ "displayNameEvent": "Available firmware version changed", "type": "QString", "defaultValue": "" + }, + { + "id": "118d572c-cc12-4037-82d8-7d8f6fb4a364", + "name": "channel1", + "displayName": "Power channel 1", + "displayNameEvent": "Channel 1 turned on or off", + "displayNameAction": "Turn channel 1 on or off", + "type": "bool", + "defaultValue": false, + "writable": true, + "ioType": "digitalOutput" + }, + { + "id": "7952aec0-cd27-4ef9-87a6-c499564bc1d4", + "name": "channel2", + "displayName": "Power channel 2", + "displayNameEvent": "Channel 2 turned on or off", + "displayNameAction": "Turn channel 2 on or off", + "type": "bool", + "defaultValue": false, + "writable": true, + "ioType": "digitalOutput" } ], "actionTypes": [ @@ -631,8 +651,7 @@ "displayNameEvent": "Power consumption changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 }, { "id": "ccec3806-cc48-42cf-94d7-811ff569d407", @@ -772,8 +791,7 @@ "displayNameEvent": "Current power consumption changed", "type": "double", "defaultValue": 0, - "unit": "Watt", - "filter": "adaptive" + "unit": "Watt" }, { "id": "3d22110c-db53-4420-8e0f-314555484926", @@ -817,7 +835,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": [ @@ -892,8 +910,7 @@ "displayNameEvent": "Current power consumption changed", "type": "double", "defaultValue": 0, - "unit": "Watt", - "filter": "adaptive" + "unit": "Watt" }, { "id": "8d3b3d63-86f1-46cb-92ef-d27c0d9d0a4e", @@ -991,9 +1008,10 @@ }, { "id": "b1f5a911-76ec-42e5-ac64-17f85d82b875", - "name": "multipressInterval", + "name": "multipushTimeBetweenPushes", "displayName": "Max time between multiple presses", "type": "uint", + "unit": "MilliSeconds", "minValue": 200, "maxValue": 2000, "defaultValue": 500 @@ -1130,6 +1148,38 @@ "type": "QString" } ], + "settingsTypes": [ + { + "id": "a04fda4b-f187-477c-b7a8-b56613bf9264", + "name": "longpushMinDuration", + "displayName": "Minimum longpress duration", + "type": "uint", + "unit": "MilliSeconds", + "minValue": 100, + "maxValue": 2900, + "defaultValue": 100 + }, + { + "id": "6485685e-0097-48db-958b-43126c6fb5a6", + "name": "longpushMaxDuration", + "displayName": "Maximum longpress duration", + "type": "uint", + "unit": "MilliSeconds", + "minValue": 200, + "maxValue": 6000, + "defaultValue": 3000 + }, + { + "id": "52699a1b-3526-4f60-83ec-f35faa863597", + "name": "multipushTimeBetweenPushes", + "displayName": "Max time between multiple presses", + "type": "uint", + "unit": "MilliSeconds", + "minValue": 100, + "maxValue": 500, + "defaultValue": 500 + } + ], "stateTypes": [ { "id": "9b17b10d-07ee-4a3d-813f-ef37e79e7241", @@ -1213,16 +1263,17 @@ { "id": "146313a1-cfb6-4732-a1be-86ec575bcbdb", "name": "buttonName", - "displayName": "Count", + "displayName": "Button name", "type": "QString", "allowedValues": ["1", "2", "3"] }, { "id": "0ed31339-7457-443c-b6e3-3b8ce3fc2bd8", - "name": "origin", - "displayName": "Switch", - "type": "QString", - "allowedValues": ["1", "2", "3"] + "name": "count", + "displayName": "Press count", + "type": "uint", + "minValue": 1, + "maxValue": 3 } ] }, @@ -1234,14 +1285,7 @@ { "id": "99683cf9-930e-4f10-94f2-73bb32092639", "name": "buttonName", - "displayName": "Count", - "type": "QString", - "allowedValues": ["1", "2", "3"] - }, - { - "id": "866d6db6-e989-4b19-93c3-cc4aa7453c9e", - "name": "origin", - "displayName": "Switch", + "displayName": "Button name", "type": "QString", "allowedValues": ["1", "2", "3"] } @@ -1525,8 +1569,7 @@ "displayNameEvent": "Current power changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 }, { "id": "432ba180-936d-4700-907e-766264bfdd35", @@ -1535,8 +1578,7 @@ "displayNameEvent": "Power usage (Phase A) changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 }, { "id": "50be490b-ba5d-4b1f-806c-9e15b915c1eb", @@ -1553,8 +1595,7 @@ "displayNameEvent": "Current (Phase A) changed", "type": "double", "unit": "Ampere", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 }, { "id": "5977ffab-cdcf-409c-940b-aa0a59de84a5", @@ -1590,8 +1631,7 @@ "displayNameEvent": "Power usage (Phase B) changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 }, { "id": "f56504bb-0c6c-4425-831c-771b23aadf19", @@ -1644,8 +1684,7 @@ "displayNameEvent": "Power usage (Phase C) changed", "type": "double", "unit": "Watt", - "defaultValue": 0, - "filter": "adaptive" + "defaultValue": 0 }, { "id": "2e2c622f-1575-4d0b-a0c0-78bc03748c1e", @@ -2251,8 +2290,7 @@ "displayNameEvent": "Power consumption changed", "type": "double", "defaultValue": 0, - "unit": "Watt", - "filter": "adaptive" + "unit": "Watt" } ] }, @@ -2386,8 +2424,7 @@ "displayNameEvent": "Power consumption changed", "type": "double", "defaultValue": 0, - "unit": "Watt", - "filter": "adaptive" + "unit": "Watt" } ] }, @@ -2521,8 +2558,7 @@ "displayNameEvent": "Power consumption changed", "type": "double", "defaultValue": 0, - "unit": "Watt", - "filter": "adaptive" + "unit": "Watt" } ] }, @@ -2578,8 +2614,7 @@ "displayNameEvent": "Power consumption changed", "type": "double", "defaultValue": 0, - "unit": "Watt", - "filter": "adaptive" + "unit": "Watt" }, { "id": "2729d4e0-c38c-47b8-a0e8-26959090fe74",