mirror of
https://github.com/esphome/esphome.git
synced 2025-09-26 23:22:21 +01:00
Allow parse_json to return a boolean result (#6884)
* Allow parse_json to return a boolean result * Remove pass variable
This commit is contained in:
@@ -410,7 +410,10 @@ void MQTTClientComponent::subscribe(const std::string &topic, mqtt_callback_t ca
|
||||
|
||||
void MQTTClientComponent::subscribe_json(const std::string &topic, const mqtt_json_callback_t &callback, uint8_t qos) {
|
||||
auto f = [callback](const std::string &topic, const std::string &payload) {
|
||||
json::parse_json(payload, [topic, callback](JsonObject root) { callback(topic, root); });
|
||||
json::parse_json(payload, [topic, callback](JsonObject root) -> bool {
|
||||
callback(topic, root);
|
||||
return true;
|
||||
});
|
||||
};
|
||||
MQTTSubscription subscription{
|
||||
.topic = topic,
|
||||
|
Reference in New Issue
Block a user