1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-20 00:35:44 +00:00

mqtt_client: Added MQTTClientComponent::unsubscribe() (#1672)

Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
Anthony Uk
2021-04-08 14:21:42 +02:00
committed by GitHub
parent bf01c22e1f
commit 76a6c39f25
2 changed files with 29 additions and 0 deletions

View File

@@ -159,6 +159,15 @@ class MQTTClientComponent : public Component {
*/
void subscribe_json(const std::string &topic, mqtt_json_callback_t callback, uint8_t qos = 0);
/** Unsubscribe from an MQTT topic.
*
* If multiple existing subscriptions to the same topic exist, all of them will be removed.
*
* @param topic The topic to unsubscribe from.
* Must match the topic in the original subscribe or subscribe_json call exactly.
*/
void unsubscribe(const std::string &topic);
/** Publish a MQTTMessage
*
* @param message The message.