Publish state as number and string
This commit is contained in:
parent
c444117853
commit
18b927bd59
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user