Publish state as number and string

This commit is contained in:
Ollo 2022-08-21 12:05:43 +02:00
parent c444117853
commit 18b927bd59

View File

@ -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());
}
}