1
0
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:
Jesse Hills
2024-06-11 10:40:56 +12:00
committed by GitHub
parent 51a8a7e875
commit 95e45dc12c
3 changed files with 14 additions and 12 deletions

View File

@@ -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,