1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00

Trying yet again

This commit is contained in:
Jordan Zucker 2025-02-13 13:43:14 -08:00
parent 71cc932561
commit bc50b97573

View File

@ -5,6 +5,9 @@
namespace esphome { namespace esphome {
namespace prometheus { namespace prometheus {
// Longest: HORIZONTAL
#define PSTR_LOCAL(mode_s) strncpy_P(buf, (PGM_P) ((mode_s)), 15)
void PrometheusHandler::handleRequest(AsyncWebServerRequest *req) { void PrometheusHandler::handleRequest(AsyncWebServerRequest *req) {
AsyncResponseStream *stream = req->beginResponseStream("text/plain; version=0.0.4; charset=utf-8"); AsyncResponseStream *stream = req->beginResponseStream("text/plain; version=0.0.4; charset=utf-8");
std::string area = App.get_area(); std::string area = App.get_area();
@ -858,7 +861,7 @@ void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Clima
stream->print(F("\",name=\"")); stream->print(F("\",name=\""));
stream->print(relabel_name_(obj).c_str()); stream->print(relabel_name_(obj).c_str());
stream->print(F("\",mode=\"")); stream->print(F("\",mode=\""));
stream->print(climate::climate_mode_to_string(obj->mode)); stream->print(PSTR_LOCAL(climate::climate_mode_to_string(obj->mode)));
stream->print(F("\"} ")); stream->print(F("\"} "));
stream->print(F("1.0")); stream->print(F("1.0"));
stream->print(F("\n")); stream->print(F("\n"));