From f7d725312bee6f61879b1de9e5b989d35b103269 Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 27 Oct 2022 21:20:17 -0400 Subject: [PATCH] Update pl_avail. --- Code/ESP32/PylonToMQTT/src/IOT.cpp | 4 ++-- Code/ESP32/PylonToMQTT/src/Pack.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Code/ESP32/PylonToMQTT/src/IOT.cpp b/Code/ESP32/PylonToMQTT/src/IOT.cpp index 525057c..d8ec126 100644 --- a/Code/ESP32/PylonToMQTT/src/IOT.cpp +++ b/Code/ESP32/PylonToMQTT/src/IOT.cpp @@ -33,7 +33,7 @@ void onMqttConnect(bool sessionPresent) char buf[64]; sprintf(buf, "%s/cmnd/#", _rootTopicPrefix); _mqttClient.subscribe(buf, 0); - _mqttClient.publish(_willTopic, 0, true, "online", 6); + _mqttClient.publish(_willTopic, 0, true, "Online", 6); logi("Subscribed to [%s], qos: 0", buf); } @@ -62,7 +62,7 @@ void connectToMqtt() strcat(_rootTopicPrefix, _bankName); sprintf(_willTopic, "%s/tele/LWT", _rootTopicPrefix); - _mqttClient.setWill(_willTopic, 0, true, "offline"); + _mqttClient.setWill(_willTopic, 0, true, "Offline"); _mqttClient.connect(); logd("rootTopicPrefix: %s", _rootTopicPrefix); } diff --git a/Code/ESP32/PylonToMQTT/src/Pack.cpp b/Code/ESP32/PylonToMQTT/src/Pack.cpp index 9f33af4..174bc39 100644 --- a/Code/ESP32/PylonToMQTT/src/Pack.cpp +++ b/Code/ESP32/PylonToMQTT/src/Pack.cpp @@ -66,7 +66,8 @@ void Pack::PublishDiscoverySub(const char *component, const char *entity, const sprintf(buffer, "%s/tele/LWT", _pcb->getRootTopicPrefix().c_str()); doc["availability_topic"] = buffer; - + doc["pl_avail"] = "Online"; + doc["pl_not_avail"] = "Offline"; JsonObject device = doc.createNestedObject("device"); device["name"] = Name(); device["via_device"] = _pcb->getThingName();