mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
Merge remote-tracking branch 'upstream/custom-mqtt-device-std-bind-to-lambda' into integration
This commit is contained in:
@@ -191,8 +191,7 @@ void CustomMQTTDevice::subscribe(const std::string &topic,
|
||||
void (T::*callback)(const std::string &, const std::string &), uint8_t qos) {
|
||||
auto *obj = static_cast<T *>(this);
|
||||
global_mqtt_client->subscribe(
|
||||
topic,
|
||||
[obj, callback](const std::string &topic, const std::string &payload) { (obj->*callback)(topic, payload); }, qos);
|
||||
topic, [obj, callback](const std::string &t, const std::string &payload) { (obj->*callback)(t, payload); }, qos);
|
||||
}
|
||||
template<typename T>
|
||||
void CustomMQTTDevice::subscribe(const std::string &topic, void (T::*callback)(const std::string &), uint8_t qos) {
|
||||
@@ -210,7 +209,7 @@ void CustomMQTTDevice::subscribe_json(const std::string &topic, void (T::*callba
|
||||
uint8_t qos) {
|
||||
auto *obj = static_cast<T *>(this);
|
||||
global_mqtt_client->subscribe_json(
|
||||
topic, [obj, callback](const std::string &topic, JsonObject root) { (obj->*callback)(topic, root); }, qos);
|
||||
topic, [obj, callback](const std::string &t, JsonObject root) { (obj->*callback)(t, root); }, qos);
|
||||
}
|
||||
template<typename T>
|
||||
void CustomMQTTDevice::subscribe_json(const std::string &topic, void (T::*callback)(JsonObject), uint8_t qos) {
|
||||
|
||||
Reference in New Issue
Block a user