Added version to status topic
This commit is contained in:
@@ -34,6 +34,8 @@ int main(int argc, char* argv[]) {
|
|||||||
std::string services_path_str = "/etc/thrawn";
|
std::string services_path_str = "/etc/thrawn";
|
||||||
std::string mqttServerURI = "tcp://chimaera:1883";
|
std::string mqttServerURI = "tcp://chimaera:1883";
|
||||||
mqttpp::LastWill last_will {"dev/thrawn/status", "0"};
|
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";
|
std::string lastWillConnected = "1";
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +67,7 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mqtt.publish(last_will.topic, lastWillConnected);
|
mqtt.publish(last_will.topic, lastWillConnected);
|
||||||
|
mqtt.publish(version_topic, version_topic_value);
|
||||||
mqtt.subscribe("#", [&] (const char* topic, const std::string& msg) {
|
mqtt.subscribe("#", [&] (const char* topic, const std::string& msg) {
|
||||||
LuaEngine::get_instance().cache.set_topic_value(topic, msg);
|
LuaEngine::get_instance().cache.set_topic_value(topic, msg);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user