ESPHome 2025.6.2
|
This class allows users to create a web server with their ESP nodes. More...
#include <web_server.h>
Public Member Functions | |
WebServer (web_server_base::WebServerBase *base) | |
void | set_css_url (const char *css_url) |
Set the URL to the CSS <link> that's sent to each client. | |
void | set_js_url (const char *js_url) |
Set the URL to the script that's embedded in the index page. | |
void | set_css_include (const char *css_include) |
Set local path to the script that's embedded in the index page. | |
void | set_js_include (const char *js_include) |
Set local path to the script that's embedded in the index page. | |
void | set_include_internal (bool include_internal) |
Determine whether internal components should be displayed on the web server. | |
void | set_allow_ota (bool allow_ota) |
Set whether or not the webserver should expose the OTA form and handler. | |
void | set_expose_log (bool expose_log) |
Set whether or not the webserver should expose the Log. | |
void | setup () override |
Setup the internal web server and register handlers. | |
void | loop () override |
void | dump_config () override |
float | get_setup_priority () const override |
MQTT setup priority. | |
void | handle_index_request (AsyncWebServerRequest *request) |
Handle an index request under '/'. | |
std::string | get_config_json () |
Return the webserver configuration as JSON. | |
void | handle_css_request (AsyncWebServerRequest *request) |
Handle included css request under '/0.css'. | |
void | handle_js_request (AsyncWebServerRequest *request) |
Handle included js request under '/0.js'. | |
void | handle_pna_cors_request (AsyncWebServerRequest *request) |
void | on_sensor_update (sensor::Sensor *obj, float state) override |
void | handle_sensor_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a sensor request under '/sensor/<id>'. | |
std::string | sensor_json (sensor::Sensor *obj, float value, JsonDetail start_config) |
Dump the sensor state with its value as a JSON string. | |
void | on_switch_update (switch_::Switch *obj, bool state) override |
void | handle_switch_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a switch request under '/switch/<id>/</turn_on/turn_off/toggle>'. | |
std::string | switch_json (switch_::Switch *obj, bool value, JsonDetail start_config) |
Dump the switch state with its value as a JSON string. | |
void | handle_button_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a button request under '/button/<id>/press'. | |
std::string | button_json (button::Button *obj, JsonDetail start_config) |
Dump the button details with its value as a JSON string. | |
void | on_binary_sensor_update (binary_sensor::BinarySensor *obj, bool state) override |
void | handle_binary_sensor_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a binary sensor request under '/binary_sensor/<id>'. | |
std::string | binary_sensor_json (binary_sensor::BinarySensor *obj, bool value, JsonDetail start_config) |
Dump the binary sensor state with its value as a JSON string. | |
void | on_fan_update (fan::Fan *obj) override |
void | handle_fan_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a fan request under '/fan/<id>/</turn_on/turn_off/toggle>'. | |
std::string | fan_json (fan::Fan *obj, JsonDetail start_config) |
Dump the fan state as a JSON string. | |
void | on_light_update (light::LightState *obj) override |
void | handle_light_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a light request under '/light/<id>/</turn_on/turn_off/toggle>'. | |
std::string | light_json (light::LightState *obj, JsonDetail start_config) |
Dump the light state as a JSON string. | |
void | on_text_sensor_update (text_sensor::TextSensor *obj, const std::string &state) override |
void | handle_text_sensor_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a text sensor request under '/text_sensor/<id>'. | |
std::string | text_sensor_json (text_sensor::TextSensor *obj, const std::string &value, JsonDetail start_config) |
Dump the text sensor state with its value as a JSON string. | |
void | on_cover_update (cover::Cover *obj) override |
void | handle_cover_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a cover request under '/cover/<id>/<open/close/stop/set>'. | |
std::string | cover_json (cover::Cover *obj, JsonDetail start_config) |
Dump the cover state as a JSON string. | |
void | on_number_update (number::Number *obj, float state) override |
void | handle_number_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a number request under '/number/<id>'. | |
std::string | number_json (number::Number *obj, float value, JsonDetail start_config) |
Dump the number state with its value as a JSON string. | |
void | on_date_update (datetime::DateEntity *obj) override |
void | handle_date_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a date request under '/date/<id>'. | |
std::string | date_json (datetime::DateEntity *obj, JsonDetail start_config) |
Dump the date state with its value as a JSON string. | |
void | on_time_update (datetime::TimeEntity *obj) override |
void | handle_time_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a time request under '/time/<id>'. | |
std::string | time_json (datetime::TimeEntity *obj, JsonDetail start_config) |
Dump the time state with its value as a JSON string. | |
void | on_datetime_update (datetime::DateTimeEntity *obj) override |
void | handle_datetime_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a datetime request under '/datetime/<id>'. | |
std::string | datetime_json (datetime::DateTimeEntity *obj, JsonDetail start_config) |
Dump the datetime state with its value as a JSON string. | |
void | on_text_update (text::Text *obj, const std::string &state) override |
void | handle_text_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a text input request under '/text/<id>'. | |
std::string | text_json (text::Text *obj, const std::string &value, JsonDetail start_config) |
Dump the text state with its value as a JSON string. | |
void | on_select_update (select::Select *obj, const std::string &state, size_t index) override |
void | handle_select_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a select request under '/select/<id>'. | |
std::string | select_json (select::Select *obj, const std::string &value, JsonDetail start_config) |
Dump the select state with its value as a JSON string. | |
void | on_climate_update (climate::Climate *obj) override |
void | handle_climate_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a climate request under '/climate/<id>'. | |
std::string | climate_json (climate::Climate *obj, JsonDetail start_config) |
Dump the climate details. | |
void | on_lock_update (lock::Lock *obj) override |
void | handle_lock_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a lock request under '/lock/<id>/</lock/unlock/open>'. | |
std::string | lock_json (lock::Lock *obj, lock::LockState value, JsonDetail start_config) |
Dump the lock state with its value as a JSON string. | |
void | on_valve_update (valve::Valve *obj) override |
void | handle_valve_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a valve request under '/valve/<id>/<open/close/stop/set>'. | |
std::string | valve_json (valve::Valve *obj, JsonDetail start_config) |
Dump the valve state as a JSON string. | |
void | on_alarm_control_panel_update (alarm_control_panel::AlarmControlPanel *obj) override |
void | handle_alarm_control_panel_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a alarm_control_panel request under '/alarm_control_panel/<id>'. | |
std::string | alarm_control_panel_json (alarm_control_panel::AlarmControlPanel *obj, alarm_control_panel::AlarmControlPanelState value, JsonDetail start_config) |
Dump the alarm_control_panel state with its value as a JSON string. | |
void | on_event (event::Event *obj, const std::string &event_type) override |
void | handle_event_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a event request under '/event<id>'. | |
std::string | event_json (event::Event *obj, const std::string &event_type, JsonDetail start_config) |
Dump the event details with its value as a JSON string. | |
void | on_update (update::UpdateEntity *obj) override |
void | handle_update_request (AsyncWebServerRequest *request, const UrlMatch &match) |
Handle a update request under '/update/<id>'. | |
std::string | update_json (update::UpdateEntity *obj, JsonDetail start_config) |
Dump the update state with its value as a JSON string. | |
bool | canHandle (AsyncWebServerRequest *request) override |
Override the web handler's canHandle method. | |
void | handleRequest (AsyncWebServerRequest *request) override |
Override the web handler's handleRequest method. | |
bool | isRequestHandlerTrivial () override |
This web handle is not trivial. | |
void | add_entity_config (EntityBase *entity, float weight, uint64_t group) |
void | add_sorting_group (uint64_t group_id, const std::string &group_name, float weight) |
![]() | |
void | setup_controller (bool include_internal=false) |
virtual void | on_media_player_update (media_player::MediaPlayer *obj) |
![]() | |
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) |
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="unspecified") |
void | status_set_error (const char *message="unspecified") |
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 char *source) |
Set where this component was loaded from for some debug messages. | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. | |
bool | should_warn_of_blocking (uint32_t blocking_time) |
Static Public Member Functions | |
static std::string | sensor_state_json_generator (WebServer *web_server, void *source) |
static std::string | sensor_all_json_generator (WebServer *web_server, void *source) |
static std::string | switch_state_json_generator (WebServer *web_server, void *source) |
static std::string | switch_all_json_generator (WebServer *web_server, void *source) |
static std::string | button_state_json_generator (WebServer *web_server, void *source) |
static std::string | button_all_json_generator (WebServer *web_server, void *source) |
static std::string | binary_sensor_state_json_generator (WebServer *web_server, void *source) |
static std::string | binary_sensor_all_json_generator (WebServer *web_server, void *source) |
static std::string | fan_state_json_generator (WebServer *web_server, void *source) |
static std::string | fan_all_json_generator (WebServer *web_server, void *source) |
static std::string | light_state_json_generator (WebServer *web_server, void *source) |
static std::string | light_all_json_generator (WebServer *web_server, void *source) |
static std::string | text_sensor_state_json_generator (WebServer *web_server, void *source) |
static std::string | text_sensor_all_json_generator (WebServer *web_server, void *source) |
static std::string | cover_state_json_generator (WebServer *web_server, void *source) |
static std::string | cover_all_json_generator (WebServer *web_server, void *source) |
static std::string | number_state_json_generator (WebServer *web_server, void *source) |
static std::string | number_all_json_generator (WebServer *web_server, void *source) |
static std::string | date_state_json_generator (WebServer *web_server, void *source) |
static std::string | date_all_json_generator (WebServer *web_server, void *source) |
static std::string | time_state_json_generator (WebServer *web_server, void *source) |
static std::string | time_all_json_generator (WebServer *web_server, void *source) |
static std::string | datetime_state_json_generator (WebServer *web_server, void *source) |
static std::string | datetime_all_json_generator (WebServer *web_server, void *source) |
static std::string | text_state_json_generator (WebServer *web_server, void *source) |
static std::string | text_all_json_generator (WebServer *web_server, void *source) |
static std::string | select_state_json_generator (WebServer *web_server, void *source) |
static std::string | select_all_json_generator (WebServer *web_server, void *source) |
static std::string | climate_state_json_generator (WebServer *web_server, void *source) |
static std::string | climate_all_json_generator (WebServer *web_server, void *source) |
static std::string | lock_state_json_generator (WebServer *web_server, void *source) |
static std::string | lock_all_json_generator (WebServer *web_server, void *source) |
static std::string | valve_state_json_generator (WebServer *web_server, void *source) |
static std::string | valve_all_json_generator (WebServer *web_server, void *source) |
static std::string | alarm_control_panel_state_json_generator (WebServer *web_server, void *source) |
static std::string | alarm_control_panel_all_json_generator (WebServer *web_server, void *source) |
static std::string | event_state_json_generator (WebServer *web_server, void *source) |
static std::string | event_all_json_generator (WebServer *web_server, void *source) |
static std::string | update_state_json_generator (WebServer *web_server, void *source) |
static std::string | update_all_json_generator (WebServer *web_server, void *source) |
Data Fields | |
std::map< EntityBase *, SortingComponents > | sorting_entitys_ |
std::map< uint64_t, SortingGroup > | sorting_groups_ |
bool | include_internal_ {false} |
Protected Member Functions | |
void | schedule_ (std::function< void()> &&f) |
![]() | |
virtual void | call_loop () |
virtual void | call_setup () |
virtual void | call_dump_config () |
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 (uint32_t interval, std::function< void()> &&f) |
bool | cancel_interval (const std::string &name) |
Cancel an interval function. | |
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 (uint32_t timeout, std::function< void()> &&f) |
bool | cancel_timeout (const std::string &name) |
Cancel a timeout function. | |
void | defer (const std::string &name, std::function< void()> &&f) |
Defer a callback to the next loop() call. | |
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_ |
DeferredUpdateEventSourceList | events_ |
AsyncEventSource | events_ {"/events", this} |
const char * | css_url_ {nullptr} |
const char * | js_url_ {nullptr} |
const char * | css_include_ {nullptr} |
const char * | js_include_ {nullptr} |
bool | allow_ota_ {true} |
bool | expose_log_ {true} |
std::deque< std::function< void()> > | to_schedule_ |
SemaphoreHandle_t | to_schedule_lock_ |
![]() | |
uint8_t | component_state_ {0x00} |
State of this component - each bit has a purpose: Bits 0-1: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED) Bit 2: STATUS_LED_WARNING Bit 3: STATUS_LED_ERROR Bits 4-7: Unused - reserved for future expansion (50% of the bits are free) | |
float | setup_priority_override_ {NAN} |
const char * | component_source_ {nullptr} |
uint16_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS} |
Warn if blocked for this many ms (max 65.5s) | |
std::string | error_message_ {} |
This class allows users to create a web server with their ESP nodes.
Behind the scenes it's using AsyncWebServer to set up the server. It exposes 3 things: an index page under '/' that's used to show a simple web interface (the css/js is hosted by esphome.io by default), an event source under '/events' that automatically sends all state updates in real time + the debug log. Lastly, there's an REST API available under the '/light/...', '/sensor/...', ... URLs. A full documentation for this API can be found under https://esphome.io/web-api/index.html.
Definition at line 149 of file web_server.h.
esphome::web_server::WebServer::WebServer | ( | web_server_base::WebServerBase * | base | ) |
Definition at line 214 of file web_server.cpp.
void esphome::web_server::WebServer::add_entity_config | ( | EntityBase * | entity, |
float | weight, | ||
uint64_t | group ) |
Definition at line 2150 of file web_server.cpp.
void esphome::web_server::WebServer::add_sorting_group | ( | uint64_t | group_id, |
const std::string & | group_name, | ||
float | weight ) |
Definition at line 2154 of file web_server.cpp.
|
static |
Definition at line 1689 of file web_server.cpp.
std::string esphome::web_server::WebServer::alarm_control_panel_json | ( | alarm_control_panel::AlarmControlPanel * | obj, |
alarm_control_panel::AlarmControlPanelState | value, | ||
JsonDetail | start_config ) |
Dump the alarm_control_panel state with its value as a JSON string.
Definition at line 1694 of file web_server.cpp.
|
static |
Definition at line 1684 of file web_server.cpp.
|
static |
Definition at line 584 of file web_server.cpp.
std::string esphome::web_server::WebServer::binary_sensor_json | ( | binary_sensor::BinarySensor * | obj, |
bool | value, | ||
JsonDetail | start_config ) |
Dump the binary sensor state with its value as a JSON string.
Definition at line 588 of file web_server.cpp.
|
static |
Definition at line 580 of file web_server.cpp.
|
static |
Definition at line 539 of file web_server.cpp.
std::string esphome::web_server::WebServer::button_json | ( | button::Button * | obj, |
JsonDetail | start_config ) |
Dump the button details with its value as a JSON string.
Definition at line 542 of file web_server.cpp.
|
static |
Definition at line 536 of file web_server.cpp.
|
override |
Override the web handler's canHandle method.
Definition at line 1840 of file web_server.cpp.
|
static |
Definition at line 1401 of file web_server.cpp.
std::string esphome::web_server::WebServer::climate_json | ( | climate::Climate * | obj, |
JsonDetail | start_config ) |
Dump the climate details.
Definition at line 1404 of file web_server.cpp.
|
static |
Definition at line 1398 of file web_server.cpp.
|
static |
Definition at line 884 of file web_server.cpp.
std::string esphome::web_server::WebServer::cover_json | ( | cover::Cover * | obj, |
JsonDetail | start_config ) |
Dump the cover state as a JSON string.
Definition at line 887 of file web_server.cpp.
|
static |
Definition at line 881 of file web_server.cpp.
|
static |
Definition at line 1036 of file web_server.cpp.
std::string esphome::web_server::WebServer::date_json | ( | datetime::DateEntity * | obj, |
JsonDetail | start_config ) |
Dump the date state with its value as a JSON string.
Definition at line 1039 of file web_server.cpp.
|
static |
Definition at line 1033 of file web_server.cpp.
|
static |
Definition at line 1170 of file web_server.cpp.
std::string esphome::web_server::WebServer::datetime_json | ( | datetime::DateTimeEntity * | obj, |
JsonDetail | start_config ) |
Dump the datetime state with its value as a JSON string.
Definition at line 1173 of file web_server.cpp.
|
static |
Definition at line 1167 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 284 of file web_server.cpp.
|
static |
Definition at line 1741 of file web_server.cpp.
std::string esphome::web_server::WebServer::event_json | ( | event::Event * | obj, |
const std::string & | event_type, | ||
JsonDetail | start_config ) |
Dump the event details with its value as a JSON string.
Definition at line 1744 of file web_server.cpp.
|
static |
Definition at line 1737 of file web_server.cpp.
|
static |
Definition at line 668 of file web_server.cpp.
std::string esphome::web_server::WebServer::fan_json | ( | fan::Fan * | obj, |
JsonDetail | start_config ) |
Dump the fan state as a JSON string.
Definition at line 671 of file web_server.cpp.
|
static |
Definition at line 665 of file web_server.cpp.
std::string esphome::web_server::WebServer::get_config_json | ( | ) |
Return the webserver configuration as JSON.
Definition at line 227 of file web_server.cpp.
|
overridevirtual |
MQTT setup priority.
Reimplemented from esphome::Component.
Definition at line 290 of file web_server.cpp.
void esphome::web_server::WebServer::handle_alarm_control_panel_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a alarm_control_panel request under '/alarm_control_panel/<id>'.
Definition at line 1642 of file web_server.cpp.
void esphome::web_server::WebServer::handle_binary_sensor_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a binary sensor request under '/binary_sensor/<id>'.
Definition at line 563 of file web_server.cpp.
void esphome::web_server::WebServer::handle_button_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a button request under '/button/<id>/press'.
Definition at line 513 of file web_server.cpp.
void esphome::web_server::WebServer::handle_climate_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a climate request under '/climate/<id>'.
Definition at line 1336 of file web_server.cpp.
void esphome::web_server::WebServer::handle_cover_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a cover request under '/cover/<id>/<open/close/stop/set>'.
Definition at line 825 of file web_server.cpp.
void esphome::web_server::WebServer::handle_css_request | ( | AsyncWebServerRequest * | request | ) |
Handle included css request under '/0.css'.
Definition at line 319 of file web_server.cpp.
void esphome::web_server::WebServer::handle_date_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a date request under '/date/<id>'.
Definition at line 995 of file web_server.cpp.
void esphome::web_server::WebServer::handle_datetime_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a datetime request under '/datetime/<id>'.
Definition at line 1130 of file web_server.cpp.
void esphome::web_server::WebServer::handle_event_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a event request under '/event<id>'.
Definition at line 1718 of file web_server.cpp.
void esphome::web_server::WebServer::handle_fan_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a fan request under '/fan/<id>/</turn_on/turn_off/toggle>'.
Definition at line 610 of file web_server.cpp.
void esphome::web_server::WebServer::handle_index_request | ( | AsyncWebServerRequest * | request | ) |
Handle an index request under '/'.
Definition at line 293 of file web_server.cpp.
void esphome::web_server::WebServer::handle_js_request | ( | AsyncWebServerRequest * | request | ) |
Handle included js request under '/0.js'.
Definition at line 328 of file web_server.cpp.
void esphome::web_server::WebServer::handle_light_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a light request under '/light/<id>/</turn_on/turn_off/toggle>'.
Definition at line 700 of file web_server.cpp.
void esphome::web_server::WebServer::handle_lock_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a lock request under '/lock/<id>/</lock/unlock/open>'.
Definition at line 1504 of file web_server.cpp.
void esphome::web_server::WebServer::handle_number_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a number request under '/number/<id>'.
Definition at line 915 of file web_server.cpp.
void esphome::web_server::WebServer::handle_pna_cors_request | ( | AsyncWebServerRequest * | request | ) |
Definition at line 308 of file web_server.cpp.
void esphome::web_server::WebServer::handle_select_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a select request under '/select/<id>'.
Definition at line 1268 of file web_server.cpp.
void esphome::web_server::WebServer::handle_sensor_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a sensor request under '/sensor/<id>'.
Definition at line 360 of file web_server.cpp.
void esphome::web_server::WebServer::handle_switch_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a switch request under '/switch/<id>/</turn_on/turn_off/toggle>'.
Definition at line 461 of file web_server.cpp.
void esphome::web_server::WebServer::handle_text_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a text input request under '/text/<id>'.
Definition at line 1198 of file web_server.cpp.
void esphome::web_server::WebServer::handle_text_sensor_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a text sensor request under '/text_sensor/<id>'.
Definition at line 414 of file web_server.cpp.
void esphome::web_server::WebServer::handle_time_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a time request under '/time/<id>'.
Definition at line 1063 of file web_server.cpp.
void esphome::web_server::WebServer::handle_update_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a update request under '/update/<id>'.
Definition at line 1773 of file web_server.cpp.
void esphome::web_server::WebServer::handle_valve_request | ( | AsyncWebServerRequest * | request, |
const UrlMatch & | match ) |
Handle a valve request under '/valve/<id>/<open/close/stop/set>'.
Definition at line 1561 of file web_server.cpp.
|
override |
Override the web handler's handleRequest method.
Definition at line 1977 of file web_server.cpp.
|
override |
This web handle is not trivial.
Definition at line 2148 of file web_server.cpp.
|
static |
Definition at line 793 of file web_server.cpp.
std::string esphome::web_server::WebServer::light_json | ( | light::LightState * | obj, |
JsonDetail | start_config ) |
Dump the light state as a JSON string.
Definition at line 796 of file web_server.cpp.
|
static |
Definition at line 790 of file web_server.cpp.
|
static |
Definition at line 1536 of file web_server.cpp.
std::string esphome::web_server::WebServer::lock_json | ( | lock::Lock * | obj, |
lock::LockState | value, | ||
JsonDetail | start_config ) |
Dump the lock state with its value as a JSON string.
Definition at line 1539 of file web_server.cpp.
|
static |
Definition at line 1533 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 264 of file web_server.cpp.
|
static |
Definition at line 952 of file web_server.cpp.
std::string esphome::web_server::WebServer::number_json | ( | number::Number * | obj, |
float | value, | ||
JsonDetail | start_config ) |
Dump the number state with its value as a JSON string.
Definition at line 955 of file web_server.cpp.
|
static |
Definition at line 949 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1637 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 558 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1331 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 820 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 990 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1125 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1714 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 605 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 695 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1499 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 910 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1263 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 355 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 456 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 409 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1193 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1058 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1768 of file web_server.cpp.
|
overridevirtual |
Reimplemented from esphome::Controller.
Definition at line 1556 of file web_server.cpp.
|
protected |
Definition at line 2158 of file web_server.cpp.
|
static |
Definition at line 1305 of file web_server.cpp.
std::string esphome::web_server::WebServer::select_json | ( | select::Select * | obj, |
const std::string & | value, | ||
JsonDetail | start_config ) |
Dump the select state with its value as a JSON string.
Definition at line 1308 of file web_server.cpp.
|
static |
Definition at line 1302 of file web_server.cpp.
|
static |
Definition at line 380 of file web_server.cpp.
std::string esphome::web_server::WebServer::sensor_json | ( | sensor::Sensor * | obj, |
float | value, | ||
JsonDetail | start_config ) |
Dump the sensor state with its value as a JSON string.
Definition at line 383 of file web_server.cpp.
|
static |
Definition at line 377 of file web_server.cpp.
|
inline |
Set whether or not the webserver should expose the OTA form and handler.
allow_ota. |
Definition at line 199 of file web_server.h.
void esphome::web_server::WebServer::set_css_include | ( | const char * | css_include | ) |
Set local path to the script that's embedded in the index page.
Defaults to
css_include | Local path to web server script. |
Definition at line 221 of file web_server.cpp.
void esphome::web_server::WebServer::set_css_url | ( | const char * | css_url | ) |
Set the URL to the CSS <link> that's sent to each client.
Defaults to https://esphome.io/_static/webserver-v1.min.css
css_url | The url to the web server stylesheet. |
|
inline |
Set whether or not the webserver should expose the Log.
expose_log. |
Definition at line 204 of file web_server.h.
|
inline |
Determine whether internal components should be displayed on the web server.
Defaults to false.
include_internal | Whether internal components should be displayed. |
Definition at line 194 of file web_server.h.
void esphome::web_server::WebServer::set_js_include | ( | const char * | js_include | ) |
Set local path to the script that's embedded in the index page.
Defaults to
js_include | Local path to web server script. |
Definition at line 224 of file web_server.cpp.
void esphome::web_server::WebServer::set_js_url | ( | const char * | js_url | ) |
Set the URL to the script that's embedded in the index page.
Defaults to https://esphome.io/_static/webserver-v1.min.js
js_url | The url to the web server script. |
|
overridevirtual |
Setup the internal web server and register handlers.
Reimplemented from esphome::Component.
Definition at line 237 of file web_server.cpp.
|
static |
Definition at line 493 of file web_server.cpp.
std::string esphome::web_server::WebServer::switch_json | ( | switch_::Switch * | obj, |
bool | value, | ||
JsonDetail | start_config ) |
Dump the switch state with its value as a JSON string.
Definition at line 496 of file web_server.cpp.
|
static |
Definition at line 490 of file web_server.cpp.
|
static |
Definition at line 1234 of file web_server.cpp.
std::string esphome::web_server::WebServer::text_json | ( | text::Text * | obj, |
const std::string & | value, | ||
JsonDetail | start_config ) |
Dump the text state with its value as a JSON string.
Definition at line 1237 of file web_server.cpp.
|
static |
Definition at line 435 of file web_server.cpp.
std::string esphome::web_server::WebServer::text_sensor_json | ( | text_sensor::TextSensor * | obj, |
const std::string & | value, | ||
JsonDetail | start_config ) |
Dump the text sensor state with its value as a JSON string.
Definition at line 439 of file web_server.cpp.
|
static |
Definition at line 431 of file web_server.cpp.
|
static |
Definition at line 1231 of file web_server.cpp.
|
static |
Definition at line 1103 of file web_server.cpp.
std::string esphome::web_server::WebServer::time_json | ( | datetime::TimeEntity * | obj, |
JsonDetail | start_config ) |
Dump the time state with its value as a JSON string.
Definition at line 1106 of file web_server.cpp.
|
static |
Definition at line 1100 of file web_server.cpp.
|
static |
Definition at line 1803 of file web_server.cpp.
std::string esphome::web_server::WebServer::update_json | ( | update::UpdateEntity * | obj, |
JsonDetail | start_config ) |
Dump the update state with its value as a JSON string.
Definition at line 1806 of file web_server.cpp.
|
static |
Definition at line 1800 of file web_server.cpp.
|
static |
Definition at line 1613 of file web_server.cpp.
std::string esphome::web_server::WebServer::valve_json | ( | valve::Valve * | obj, |
JsonDetail | start_config ) |
Dump the valve state as a JSON string.
Definition at line 1616 of file web_server.cpp.
|
static |
Definition at line 1610 of file web_server.cpp.
|
protected |
Definition at line 504 of file web_server.h.
|
protected |
Definition at line 486 of file web_server.h.
|
protected |
Definition at line 499 of file web_server.h.
|
protected |
Definition at line 495 of file web_server.h.
|
protected |
Definition at line 488 of file web_server.h.
|
protected |
Definition at line 491 of file web_server.h.
|
protected |
Definition at line 505 of file web_server.h.
bool esphome::web_server::WebServer::include_internal_ {false} |
Definition at line 482 of file web_server.h.
|
protected |
Definition at line 502 of file web_server.h.
|
protected |
Definition at line 496 of file web_server.h.
std::map<EntityBase *, SortingComponents> esphome::web_server::WebServer::sorting_entitys_ |
Definition at line 480 of file web_server.h.
std::map<uint64_t, SortingGroup> esphome::web_server::WebServer::sorting_groups_ |
Definition at line 481 of file web_server.h.
|
protected |
Definition at line 507 of file web_server.h.
|
protected |
Definition at line 508 of file web_server.h.