From c24946ae652c9b0bab383d1f383916e2272dc695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=B3r=C3=A1nt=20Pint=C3=A9r?= Date: Thu, 1 Feb 2024 17:56:18 +0100 Subject: [PATCH] Publish override end --- src/peripherals/valve/ValveComponent.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/peripherals/valve/ValveComponent.hpp b/src/peripherals/valve/ValveComponent.hpp index d983c8ed..869d6b2d 100644 --- a/src/peripherals/valve/ValveComponent.hpp +++ b/src/peripherals/valve/ValveComponent.hpp @@ -221,6 +221,15 @@ class ValveComponent : public Component { void populateTelemetry(JsonObject& telemetry) { telemetry["state"] = this->state; + auto overrideUntil = this->overrideUntil.load(); + if (overrideUntil != time_point()) { + time_t rawtime = system_clock::to_time_t(overrideUntil); + auto timeinfo = gmtime(&rawtime); + char buffer[80]; + strftime(buffer, 80, "%FT%TZ", timeinfo); + telemetry["overrideEnd"] = string(buffer); + telemetry["overrideState"] = this->overrideState.load(); + } } private: