Skip to content

Commit

Permalink
Update pl_avail.
Browse files Browse the repository at this point in the history
  • Loading branch information
graham22 committed Oct 28, 2022
1 parent ba0a556 commit f7d7253
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Code/ESP32/PylonToMQTT/src/IOT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion Code/ESP32/PylonToMQTT/src/Pack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f7d7253

Please sign in to comment.