From a6f3bc3f712851f1c45943f597394d164fe90dde Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Tue, 23 Aug 2022 19:49:19 +0200 Subject: [PATCH] Added version to system json --- src/mqtt/HomeAssistantMqttHandler.cpp | 3 ++- src/mqtt/JsonMqttHandler.cpp | 4 +++- web/jsonsys.json | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mqtt/HomeAssistantMqttHandler.cpp b/src/mqtt/HomeAssistantMqttHandler.cpp index 85ad96d1..f8678796 100644 --- a/src/mqtt/HomeAssistantMqttHandler.cpp +++ b/src/mqtt/HomeAssistantMqttHandler.cpp @@ -203,7 +203,8 @@ bool HomeAssistantMqttHandler::publishSystem(HwTools* hw) { (uint32_t) (millis64()/1000), hw->getVcc(), hw->getWifiRssi(), - hw->getTemperature() + hw->getTemperature(), + VERSION ); mqtt->publish(topic + "/state", json); } diff --git a/src/mqtt/JsonMqttHandler.cpp b/src/mqtt/JsonMqttHandler.cpp index 82847182..132d8e32 100644 --- a/src/mqtt/JsonMqttHandler.cpp +++ b/src/mqtt/JsonMqttHandler.cpp @@ -1,4 +1,5 @@ #include "JsonMqttHandler.h" +#include "version.h" #include "hexutils.h" #include "Uptime.h" #include "web/root/json1_json.h" @@ -280,7 +281,8 @@ bool JsonMqttHandler::publishSystem(HwTools* hw) { (uint32_t) (millis64()/1000), hw->getVcc(), hw->getWifiRssi(), - hw->getTemperature() + hw->getTemperature(), + VERSION ); init = mqtt->publish(topic, json); return init; diff --git a/web/jsonsys.json b/web/jsonsys.json index 9c1bdccb..55d0b443 100644 --- a/web/jsonsys.json +++ b/web/jsonsys.json @@ -4,5 +4,6 @@ "up" : %d, "vcc" : %.3f, "rssi": %d, - "temp": %.2f + "temp": %.2f, + "version": "%s" }