1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00

Use new ISO format for compilation_time in API DeviceInfo

Change the API's DeviceInfo response to use the new ISO 8601 format
with timezone for compilation_time field by calling get_build_time_string()
instead of get_compilation_time_ref().

Update the placeholder build_info_data.h to match the new format.

Update integration test to expect the new format for compilation_time.
This commit is contained in:
David Woodhouse
2025-12-15 17:44:16 +00:00
parent 93bf1c8452
commit fd32139d89
3 changed files with 6 additions and 3 deletions

View File

@@ -1472,7 +1472,10 @@ bool APIConnection::send_device_info_response(const DeviceInfoRequest &msg) {
resp.set_esphome_version(ESPHOME_VERSION_REF);
resp.set_compilation_time(App.get_compilation_time_ref());
// Stack buffer for build time string
char build_time_str[Application::BUILD_TIME_STR_SIZE];
App.get_build_time_string(build_time_str);
resp.set_compilation_time(StringRef(build_time_str));
// Manufacturer string - define once, handle ESP8266 PROGMEM separately
#if defined(USE_ESP8266) || defined(USE_ESP32)

View File

@@ -7,4 +7,4 @@
#define ESPHOME_CONFIG_HASH 0x12345678U // NOLINT
#define ESPHOME_BUILD_TIME 1700000000 // NOLINT
static const char ESPHOME_BUILD_TIME_STR[] = "Jan 01 2024, 00:00:00";
static const char ESPHOME_BUILD_TIME_STR[] = "2024-01-01 00:00:00 +0000";

View File

@@ -26,7 +26,7 @@ async def test_build_info(
assert device_info.name == "build-info-test"
# Verify compilation_time from device_info is present and parseable
# The format is "Mon DD YYYY, HH:MM:SS" (e.g., "Dec 13 2024, 15:30:00")
# The format is ISO 8601 with timezone: "YYYY-MM-DD HH:MM:SS +ZZZZ"
compilation_time = device_info.compilation_time
assert compilation_time is not None