|
ESPHome 2025.10.3
|
#include <prometheus_handler.h>
Public Member Functions | |
| PrometheusHandler (web_server_base::WebServerBase *base) | |
| void | set_include_internal (bool include_internal) |
| Determine whether internal components should be exported as metrics. | |
| void | add_label_id (EntityBase *obj, const std::string &value) |
| Add the value for an entity's "id" label. | |
| void | add_label_name (EntityBase *obj, const std::string &value) |
| Add the value for an entity's "name" label. | |
| bool | canHandle (AsyncWebServerRequest *request) const override |
| void | handleRequest (AsyncWebServerRequest *req) override |
| void | setup () override |
| float | get_setup_priority () const override |
Public Member Functions inherited from esphome::Component | |
| virtual void | loop () |
| This method will be called repeatedly. | |
| virtual void | dump_config () |
| float | get_actual_setup_priority () const |
| void | set_setup_priority (float priority) |
| virtual float | get_loop_priority () const |
| priority of loop(). | |
| void | call () |
| virtual void | on_shutdown () |
| virtual void | on_safe_shutdown () |
| virtual bool | teardown () |
| Called during teardown to allow component to gracefully finish operations. | |
| virtual void | on_powerdown () |
| Called after teardown is complete to power down hardware. | |
| uint8_t | get_component_state () const |
| void | reset_to_construction_state () |
| Reset this component back to the construction state to allow setup to run again. | |
| bool | is_in_loop_state () const |
| Check if this component has completed setup and is in the loop state. | |
| virtual void | mark_failed () |
| Mark this component as failed. | |
| void | mark_failed (const char *message) |
| void | disable_loop () |
| Disable this component's loop. | |
| void | enable_loop () |
| Enable this component's loop. | |
| void | enable_loop_soon_any_context () |
| Thread and ISR-safe version of enable_loop() that can be called from any context. | |
| bool | is_failed () const |
| bool | is_ready () const |
| virtual bool | can_proceed () |
| bool | status_has_warning () const |
| bool | status_has_error () const |
| void | status_set_warning (const char *message=nullptr) |
| void | status_set_warning (const LogString *message) |
| void | status_set_error (const char *message=nullptr) |
| void | status_clear_warning () |
| void | status_clear_error () |
| void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
| void | status_momentary_error (const std::string &name, uint32_t length=5000) |
| bool | has_overridden_loop () const |
| void | set_component_source (const LogString *source) |
| Set where this component was loaded from for some debug messages. | |
| const LogString * | get_component_log_str () const |
| Get the integration where this component was declared as a LogString for logging. | |
| bool | should_warn_of_blocking (uint32_t blocking_time) |
Protected Member Functions | |
| std::string | relabel_id_ (EntityBase *obj) |
| std::string | relabel_name_ (EntityBase *obj) |
| void | add_area_label_ (AsyncResponseStream *stream, std::string &area) |
| void | add_node_label_ (AsyncResponseStream *stream, std::string &node) |
| void | add_friendly_name_label_ (AsyncResponseStream *stream, std::string &friendly_name) |
| void | sensor_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | sensor_row_ (AsyncResponseStream *stream, sensor::Sensor *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the sensor state as prometheus data point. | |
| void | binary_sensor_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | binary_sensor_row_ (AsyncResponseStream *stream, binary_sensor::BinarySensor *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the binary sensor state as prometheus data point. | |
| void | fan_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | fan_row_ (AsyncResponseStream *stream, fan::Fan *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the fan state as prometheus data point. | |
| void | light_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | light_row_ (AsyncResponseStream *stream, light::LightState *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the light values state as prometheus data point. | |
| void | cover_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | cover_row_ (AsyncResponseStream *stream, cover::Cover *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the cover values state as prometheus data point. | |
| void | switch_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | switch_row_ (AsyncResponseStream *stream, switch_::Switch *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the switch values state as prometheus data point. | |
| void | lock_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | lock_row_ (AsyncResponseStream *stream, lock::Lock *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the lock values state as prometheus data point. | |
| void | text_sensor_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | text_sensor_row_ (AsyncResponseStream *stream, text_sensor::TextSensor *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the text sensor values state as prometheus data point. | |
| void | number_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | number_row_ (AsyncResponseStream *stream, number::Number *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the number state as prometheus data point. | |
| void | select_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | select_row_ (AsyncResponseStream *stream, select::Select *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the select state as prometheus data point. | |
| void | media_player_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | media_player_row_ (AsyncResponseStream *stream, media_player::MediaPlayer *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the media player state as prometheus data point. | |
| void | update_entity_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | update_entity_row_ (AsyncResponseStream *stream, update::UpdateEntity *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the update state and info as prometheus data point. | |
| void | handle_update_state_ (AsyncResponseStream *stream, update::UpdateState state) |
| void | valve_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | valve_row_ (AsyncResponseStream *stream, valve::Valve *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the valve state as prometheus data point. | |
| void | climate_type_ (AsyncResponseStream *stream) |
| Return the type for prometheus. | |
| void | climate_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name) |
| Return the climate state as prometheus data point. | |
| void | climate_failed_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name, std::string &category, bool is_failed_value) |
| void | climate_setting_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name, std::string &setting, const LogString *setting_value) |
| void | climate_value_row_ (AsyncResponseStream *stream, climate::Climate *obj, std::string &area, std::string &node, std::string &friendly_name, std::string &category, std::string &climate_value) |
Protected Member Functions inherited from esphome::Component | |
| virtual void | call_loop () |
| virtual void | call_setup () |
| virtual void | call_dump_config () |
| void | set_component_state_ (uint8_t state) |
| Helper to set component state (clears state bits and sets new state) | |
| void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a unique name. | |
| void | set_interval (const char *name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a const char* name. | |
| void | set_interval (uint32_t interval, std::function< void()> &&f) |
| bool | cancel_interval (const std::string &name) |
| Cancel an interval function. | |
| bool | cancel_interval (const char *name) |
| void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
| Set an retry function with a unique name. | |
| void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
| bool | cancel_retry (const std::string &name) |
| Cancel a retry function. | |
| void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a unique name. | |
| void | set_timeout (const char *name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a const char* name. | |
| void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
| bool | cancel_timeout (const std::string &name) |
| Cancel a timeout function. | |
| bool | cancel_timeout (const char *name) |
| void | defer (const std::string &name, std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| void | defer (const char *name, std::function< void()> &&f) |
| Defer a callback to the next loop() call with a const char* name. | |
| void | defer (std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| bool | cancel_defer (const std::string &name) |
| Cancel a defer callback using the specified name, name must not be empty. | |
Protected Attributes | |
| web_server_base::WebServerBase * | base_ |
| bool | include_internal_ {false} |
| std::map< EntityBase *, std::string > | relabel_map_id_ |
| std::map< EntityBase *, std::string > | relabel_map_name_ |
Protected Attributes inherited from esphome::Component | |
| const LogString * | component_source_ {nullptr} |
| uint16_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS} |
| Warn if blocked for this many ms (max 65.5s) | |
| uint8_t | component_state_ {0x00} |
| State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bits 5-7: Unused - reserved for future expansion. | |
| volatile bool | pending_enable_loop_ {false} |
| ISR-safe flag for enable_loop_soon_any_context. | |
Definition at line 18 of file prometheus_handler.h.
|
inline |
Definition at line 20 of file prometheus_handler.h.
|
protected |
Definition at line 111 of file prometheus_handler.cpp.
|
protected |
Definition at line 125 of file prometheus_handler.cpp.
|
inline |
Add the value for an entity's "id" label.
| obj | The entity for which to set the "id" label |
| value | The value for the "id" label |
Definition at line 34 of file prometheus_handler.h.
|
inline |
Add the value for an entity's "name" label.
| obj | The entity for which to set the "name" label |
| value | The value for the "name" label |
Definition at line 41 of file prometheus_handler.h.
|
protected |
Definition at line 118 of file prometheus_handler.cpp.
|
protected |
Return the binary sensor state as prometheus data point.
Definition at line 185 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 181 of file prometheus_handler.cpp.
|
inlineoverride |
Definition at line 43 of file prometheus_handler.h.
|
protected |
Definition at line 876 of file prometheus_handler.cpp.
|
protected |
Return the climate state as prometheus data point.
Definition at line 897 of file prometheus_handler.cpp.
|
protected |
Definition at line 840 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 834 of file prometheus_handler.cpp.
|
protected |
Definition at line 859 of file prometheus_handler.cpp.
|
protected |
Return the cover values state as prometheus data point.
Definition at line 390 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 386 of file prometheus_handler.cpp.
|
protected |
Return the fan state as prometheus data point.
Definition at line 231 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 225 of file prometheus_handler.cpp.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 58 of file prometheus_handler.h.
|
protected |
Definition at line 707 of file prometheus_handler.cpp.
|
override |
Definition at line 8 of file prometheus_handler.cpp.
|
protected |
Return the light values state as prometheus data point.
Definition at line 289 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 284 of file prometheus_handler.cpp.
|
protected |
Return the lock values state as prometheus data point.
Definition at line 477 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 473 of file prometheus_handler.cpp.
|
protected |
Return the media player state as prometheus data point.
Definition at line 648 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 642 of file prometheus_handler.cpp.
|
protected |
Return the number state as prometheus data point.
Definition at line 556 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 552 of file prometheus_handler.cpp.
|
protected |
Definition at line 101 of file prometheus_handler.cpp.
|
protected |
Definition at line 106 of file prometheus_handler.cpp.
|
protected |
Return the select state as prometheus data point.
Definition at line 600 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 596 of file prometheus_handler.cpp.
|
protected |
Return the sensor state as prometheus data point.
Definition at line 138 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 134 of file prometheus_handler.cpp.
|
inline |
Determine whether internal components should be exported as metrics.
Defaults to false.
| include_internal | Whether internal components should be exported. |
Definition at line 27 of file prometheus_handler.h.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 54 of file prometheus_handler.h.
|
protected |
Return the switch values state as prometheus data point.
Definition at line 446 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 442 of file prometheus_handler.cpp.
|
protected |
Return the text sensor values state as prometheus data point.
Definition at line 509 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 505 of file prometheus_handler.cpp.
|
protected |
Return the update state and info as prometheus data point.
Definition at line 727 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 701 of file prometheus_handler.cpp.
|
protected |
Return the valve state as prometheus data point.
Definition at line 792 of file prometheus_handler.cpp.
|
protected |
Return the type for prometheus.
Definition at line 786 of file prometheus_handler.cpp.
|
protected |
Definition at line 189 of file prometheus_handler.h.
|
protected |
Definition at line 190 of file prometheus_handler.h.
|
protected |
Definition at line 191 of file prometheus_handler.h.
|
protected |
Definition at line 192 of file prometheus_handler.h.