Added version to status topic

This commit is contained in:
2020-08-07 09:42:22 +02:00
parent e6ded7b903
commit 167822852a

View File

@@ -34,6 +34,8 @@ int main(int argc, char* argv[]) {
std::string services_path_str = "/etc/thrawn";
std::string mqttServerURI = "tcp://chimaera:1883";
mqttpp::LastWill last_will {"dev/thrawn/status", "0"};
std::string version_topic = "dev/thrawn/version";
std::string version_topic_value = std::to_string(THRAWN_MAJOR_VERSION) + "." + std::to_string(THRAWN_MINOR_VERSION) + "." + std::to_string(THRAWN_PATCH_VERSION);
std::string lastWillConnected = "1";
@@ -65,6 +67,7 @@ int main(int argc, char* argv[]) {
}
mqtt.publish(last_will.topic, lastWillConnected);
mqtt.publish(version_topic, version_topic_value);
mqtt.subscribe("#", [&] (const char* topic, const std::string& msg) {
LuaEngine::get_instance().cache.set_topic_value(topic, msg);