From a4e36d8224059212ccb127af907b209dc6b27679 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 25 Aug 2021 16:40:03 +0200 Subject: [PATCH] Add command ``Subscribe2 ...`` Add command ``Subscribe2 ...`` to subscribe to a MQTT topic without appended "/#" (#12858) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/xdrv_10_rules.ino | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2efdb2ef2..6317047c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Turn HTTP API (command ``SetOption128 1``) default on for backward compatibility - Support for IEM3155 Wattmeter (#12940) - Berry support for vararg +- Command ``Subscribe2 ...`` to subscribe to a MQTT topic without appended "/#" (#12858) ### Changed - Shelly EM template needs to use GPIO ADE7953_IRQ_2 diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 13c750ec0..73091dd66 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -120,6 +120,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo - Support for CAN bus and Freedom Won Battery Management System by Marius Bezuidenhout [#12651](https://github.com/arendst/Tasmota/issues/12651) - Optional IP filter to command ``TCPStart`` [#12806](https://github.com/arendst/Tasmota/issues/12806) - Inital support for Wi-Fi extender [#12784](https://github.com/arendst/Tasmota/issues/12784) +- Command ``Subscribe2 ...`` to subscribe to a MQTT topic without appended "/#" [#12858](https://github.com/arendst/Tasmota/issues/12858) - Support for IEM3155 Wattmeter [#12940](https://github.com/arendst/Tasmota/issues/12940) ### Changed diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index a4d454040..9e2652d06 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -1171,7 +1171,11 @@ void CmndSubscribe(void) subscription_item.Key = key; subscriptions.add(subscription_item); + if (2 == XdrvMailbox.index) { + topic = subscription_item.Topic; // Do not append "/#"" + } MqttSubscribe(topic.c_str()); + events.concat(event_name + "," + topic + (key.length()>0 ? "," : "") + key);