mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
Trying again
This commit is contained in:
parent
9f03171de4
commit
6fafba694c
@ -840,6 +840,23 @@ void PrometheusHandler::climate_type_(AsyncResponseStream *stream) {
|
|||||||
stream->print(F("#TYPE esphome_climate_failed gauge\n"));
|
stream->print(F("#TYPE esphome_climate_failed gauge\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrometheusHandler::climate_mode_row_(AsyncResponseStream *stream, std::string &category,
|
||||||
|
std::string &climate_value, std::string &area, std::string &node,
|
||||||
|
std::string &friendly_name) {
|
||||||
|
stream->print(F("esphome_climate_value{id=\""));
|
||||||
|
stream->print(relabel_id_(obj).c_str());
|
||||||
|
add_area_label_(stream, area);
|
||||||
|
add_node_label_(stream, node);
|
||||||
|
add_friendly_name_label_(stream, friendly_name);
|
||||||
|
stream->print(F("\",name=\""));
|
||||||
|
stream->print(relabel_name_(obj).c_str());
|
||||||
|
stream->print(F("\",category=\""));
|
||||||
|
stream->print(category.c_str());
|
||||||
|
stream->print(F("\"} "));
|
||||||
|
stream->print(climate_value.c_str());
|
||||||
|
stream->print(F("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Climate *obj, std::string &area,
|
void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Climate *obj, std::string &area,
|
||||||
std::string &node, std::string &friendly_name) {
|
std::string &node, std::string &friendly_name) {
|
||||||
if (obj->is_internal() && !this->include_internal_)
|
if (obj->is_internal() && !this->include_internal_)
|
||||||
@ -867,17 +884,7 @@ void PrometheusHandler::climate_row_(AsyncResponseStream *stream, climate::Clima
|
|||||||
stream->print(F("\n"));
|
stream->print(F("\n"));
|
||||||
// Now see if position is supported
|
// Now see if position is supported
|
||||||
if (obj->get_traits().get_supports_current_temperature()) {
|
if (obj->get_traits().get_supports_current_temperature()) {
|
||||||
stream->print(F("esphome_climate_value{id=\""));
|
climate_mode_row_(stream, "current_temperature", obj->current_temperature, area, node, friendly_name)
|
||||||
stream->print(relabel_id_(obj).c_str());
|
|
||||||
add_area_label_(stream, area);
|
|
||||||
add_node_label_(stream, node);
|
|
||||||
add_friendly_name_label_(stream, friendly_name);
|
|
||||||
stream->print(F("\",name=\""));
|
|
||||||
stream->print(relabel_name_(obj).c_str());
|
|
||||||
stream->print(F("\",category=current_temperature\""));
|
|
||||||
stream->print(F("\"} "));
|
|
||||||
stream->print(obj->current_temperature);
|
|
||||||
stream->print(F("\n"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,6 +175,8 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
|
|||||||
/// Return the climate state as prometheus data point
|
/// Return the climate state as prometheus data point
|
||||||
void climate_row_(AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node,
|
void climate_row_(AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node,
|
||||||
std::string &friendly_name);
|
std::string &friendly_name);
|
||||||
|
void climate_mode_row_(AsyncResponseStream *stream, std::string &category, std::string &climate_value,
|
||||||
|
std::string &area, std::string &node, std::string &friendly_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
web_server_base::WebServerBase *base_;
|
web_server_base::WebServerBase *base_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user