From d0e546571ea233e1ef8d0862a7839b88e74a33f4 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 16 May 2022 21:32:00 -0500 Subject: [PATCH] values: Include firmware build date Home Assistant will display a "Firmware Version" field in the device information panel if the `sw_version` field is populated in the discovery configuration payload. We'll fill this with the build date and time of the firmware as a proxy. --- constants.h | 4 +++- mqtt_discovery.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/constants.h b/constants.h index ee9ecd8..a700516 100644 --- a/constants.h +++ b/constants.h @@ -10,4 +10,6 @@ #define TOPIC_STATE "garden/state" #define SLEEP_MILLIS_EARLY (1000 * 60) -#define SLEEP_MILLIS (1000 * 60 * 60) \ No newline at end of file +#define SLEEP_MILLIS (1000 * 60 * 60) + +#define VERSION __DATE__ " " __TIME__ \ No newline at end of file diff --git a/mqtt_discovery.cpp b/mqtt_discovery.cpp index e962913..dcf5134 100644 --- a/mqtt_discovery.cpp +++ b/mqtt_discovery.cpp @@ -38,6 +38,7 @@ static bool publish_config(PubSubClient* mqtt, const char* topic, device["manufacturer"] = DEVICE_MANUFACTURER; device["name"] = DEVICE_NAME; device["model"] = DEVICE_MODEL; + device["sw_version"] = VERSION; auto ident = device.createNestedArray("identifiers"); ident.add(config->identifier); String msg;