From f5b214a1b29a3bb6dcf8ad985dfd70b0dc6238b7 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 27 Jul 2020 18:56:52 +0200 Subject: [PATCH] added data to web ui --- src/devices/mixing.cpp | 15 +++++++++++++++ src/devices/solar.cpp | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/devices/mixing.cpp b/src/devices/mixing.cpp index c4ebe6ced..7fc8e4424 100644 --- a/src/devices/mixing.cpp +++ b/src/devices/mixing.cpp @@ -57,7 +57,22 @@ Mixing::Mixing(uint8_t device_type, uint8_t device_id, uint8_t product_id, const void Mixing::add_context_menu() { } +// output json to web UI void Mixing::device_info(JsonArray & root) { + if (type_ == Type::NONE) { + return; // don't have any values yet + } + + if (type_ == Type::WWC) { + render_value_json(root, "", F("Warm Water Circuit"), hc_, nullptr); + } else { + render_value_json(root, "", F("Heating Circuit"), hc_, nullptr); + } + render_value_json(root, "", F("Current flow temperature"), flowTemp_, F_(degrees), 10); + render_value_json(root, "", F("Setpoint flow temperature"), flowSetTemp_, F_(degrees)); + render_value_json(root, "", F("Current pump modulation"), pumpMod_, F_(percent)); + render_value_json(root, "", F("Current valve status"), status_, nullptr); + } // check to see if values have been updated diff --git a/src/devices/solar.cpp b/src/devices/solar.cpp index d3e9e0c09..2d5c55681 100644 --- a/src/devices/solar.cpp +++ b/src/devices/solar.cpp @@ -58,7 +58,30 @@ Solar::Solar(uint8_t device_type, uint8_t device_id, uint8_t product_id, const s void Solar::add_context_menu() { } +// print to web void Solar::device_info(JsonArray & root) { + render_value_json(root, "", F("Collector temperature (TS1)"), collectorTemp_, F_(degrees), 10); + render_value_json(root, "", F("Bottom temperature (TS2)"), bottomTemp_, F_(degrees), 10); + render_value_json(root, "", F("Bottom temperature (TS5)"), bottomTemp2_, F_(degrees), 10); + render_value_json(root, "", F("Pump modulation"), pumpModulation_, F_(percent)); + render_value_json(root, "", F("Valve (VS2) status"), valveStatus_, nullptr, EMS_VALUE_BOOL); + render_value_json(root, "", F("Pump (PS1) active"), pump_, nullptr, EMS_VALUE_BOOL); + + if (Helpers::hasValue(pumpWorkMin_)) { + JsonObject dataElement; + dataElement = root.createNestedObject(); + dataElement["name"] = F("Pump working time"); + std::string time_str(60, '\0'); + snprintf_P(&time_str[0], time_str.capacity() + 1, PSTR("%d days %d hours %d minutes"), pumpWorkMin_ / 1440, (pumpWorkMin_ % 1440) / 60, pumpWorkMin_ % 60); + dataElement["value"] = time_str; + } + + render_value_json(root, "", F("Tank Heated"), tankHeated_, nullptr, EMS_VALUE_BOOL); + render_value_json(root, "", F("Collector"), collectorOnOff_, nullptr, EMS_VALUE_BOOL); + + render_value_json(root, "", F("Energy last hour"), energyLastHour_, F_(wh), 10); + render_value_json(root, "", F("Energy today"), energyToday_, F_(wh)); + render_value_json(root, "", F("Energy total"), energyTotal_, F_(kwh), 10); } // display all values into the shell console