From 18b927bd59bd3b08336bd45222142e2e496ce077 Mon Sep 17 00:00:00 2001 From: Ollo Date: Sun, 21 Aug 2022 12:05:43 +0200 Subject: [PATCH] Publish state as number and string --- esp32/src/PlantCtrl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/esp32/src/PlantCtrl.cpp b/esp32/src/PlantCtrl.cpp index ca68bfa..0030fb0 100644 --- a/esp32/src/PlantCtrl.cpp +++ b/esp32/src/PlantCtrl.cpp @@ -211,9 +211,14 @@ void Plant::deactivatePump(void) void Plant::publishState(int stateNumber, String stateString) { + String buffer; + StaticJsonDocument<200> doc; if (this->mConnected) { - this->mPlant->setProperty("state").send(stateString); + doc["number"] = stateNumber; + doc["message"] = stateString; + serializeJson(doc, buffer); + this->mPlant->setProperty("state").send(buffer.c_str()); } }