From 013898511221d0ae7509ce5292f1b1fb38490d23 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 2 Sep 2019 14:23:33 +0200 Subject: [PATCH] implement pressed event for tasmota switch --- tasmota/deviceplugintasmota.cpp | 4 ++++ tasmota/deviceplugintasmota.json | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/tasmota/deviceplugintasmota.cpp b/tasmota/deviceplugintasmota.cpp index f2b1444f..53154c59 100644 --- a/tasmota/deviceplugintasmota.cpp +++ b/tasmota/deviceplugintasmota.cpp @@ -299,6 +299,10 @@ void DevicePluginTasmota::onPublishReceived(MqttChannel *channel, const QString if (m_powerStateTypeMap.contains(child->deviceClassId())) { child->setStateValue(m_powerStateTypeMap.value(child->deviceClassId()), payload == "ON"); } + if (child->deviceClassId() == tasmotaSwitchDeviceClassId) { + Event event(tasmotaSwitchPressedEventTypeId, child->id()); + emit emitEvent(event); + } } } if (topic.startsWith(channel->topicPrefix() + "/sonoff/STATE")) { diff --git a/tasmota/deviceplugintasmota.json b/tasmota/deviceplugintasmota.json index 776132f7..5fd77a56 100644 --- a/tasmota/deviceplugintasmota.json +++ b/tasmota/deviceplugintasmota.json @@ -176,6 +176,13 @@ "defaultValue": false, "writable": true } + ], + "eventTypes": [ + { + "id": "1be4d6a1-475e-43bb-a47c-9063e279e78d", + "name": "pressed", + "displayName": "Pressed" + } ] }, {