Skip to content

Commit

Permalink
Publish override end
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Feb 1, 2024
1 parent 6c868ac commit c24946a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/peripherals/valve/ValveComponent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<system_clock>()) {
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:
Expand Down

0 comments on commit c24946a

Please sign in to comment.