3 #include "list_entities.h" 14 #include <freertos/FreeRTOS.h> 15 #include <freertos/semphr.h> 19 #if USE_WEBSERVER_VERSION >= 2 20 extern const uint8_t ESPHOME_WEBSERVER_INDEX_HTML[]
PROGMEM;
24 #ifdef USE_WEBSERVER_CSS_INCLUDE 25 extern const uint8_t ESPHOME_WEBSERVER_CSS_INCLUDE[]
PROGMEM;
29 #ifdef USE_WEBSERVER_JS_INCLUDE 30 extern const uint8_t ESPHOME_WEBSERVER_JS_INCLUDE[]
PROGMEM;
35 namespace web_server {
64 #if USE_WEBSERVER_VERSION == 1 70 void set_css_url(
const char *css_url);
77 void set_js_url(
const char *js_url);
80 #ifdef USE_WEBSERVER_CSS_INCLUDE 85 void set_css_include(
const char *css_include);
88 #ifdef USE_WEBSERVER_JS_INCLUDE 93 void set_js_include(
const char *js_include);
116 void setup()
override;
117 void loop()
override;
119 void dump_config()
override;
122 float get_setup_priority()
const override;
125 void handle_index_request(AsyncWebServerRequest *request);
128 std::string get_config_json();
130 #ifdef USE_WEBSERVER_CSS_INCLUDE 131 void handle_css_request(AsyncWebServerRequest *request);
135 #ifdef USE_WEBSERVER_JS_INCLUDE 136 void handle_js_request(AsyncWebServerRequest *request);
140 #ifdef USE_WEBSERVER_PRIVATE_NETWORK_ACCESS 142 void handle_pna_cors_request(AsyncWebServerRequest *request);
148 void handle_sensor_request(AsyncWebServerRequest *request,
const UrlMatch &match);
158 void handle_switch_request(AsyncWebServerRequest *request,
const UrlMatch &match);
165 void handle_button_request(AsyncWebServerRequest *request,
const UrlMatch &match);
172 #ifdef USE_BINARY_SENSOR 176 void handle_binary_sensor_request(AsyncWebServerRequest *request,
const UrlMatch &match);
183 void on_fan_update(
fan::Fan *obj)
override;
186 void handle_fan_request(AsyncWebServerRequest *request,
const UrlMatch &match);
196 void handle_light_request(AsyncWebServerRequest *request,
const UrlMatch &match);
202 #ifdef USE_TEXT_SENSOR 206 void handle_text_sensor_request(AsyncWebServerRequest *request,
const UrlMatch &match);
216 void handle_cover_request(AsyncWebServerRequest *request,
const UrlMatch &match);
225 void handle_number_request(AsyncWebServerRequest *request,
const UrlMatch &match);
231 #ifdef USE_DATETIME_DATE 234 void handle_date_request(AsyncWebServerRequest *request,
const UrlMatch &match);
240 #ifdef USE_DATETIME_TIME 243 void handle_time_request(AsyncWebServerRequest *request,
const UrlMatch &match);
249 #ifdef USE_DATETIME_DATETIME 252 void handle_datetime_request(AsyncWebServerRequest *request,
const UrlMatch &match);
259 void on_text_update(
text::Text *obj,
const std::string &state)
override;
261 void handle_text_request(AsyncWebServerRequest *request,
const UrlMatch &match);
268 void on_select_update(
select::Select *obj,
const std::string &state,
size_t index)
override;
270 void handle_select_request(AsyncWebServerRequest *request,
const UrlMatch &match);
279 void handle_climate_request(AsyncWebServerRequest *request,
const UrlMatch &match);
286 void on_lock_update(
lock::Lock *obj)
override;
289 void handle_lock_request(AsyncWebServerRequest *request,
const UrlMatch &match);
299 void handle_valve_request(AsyncWebServerRequest *request,
const UrlMatch &match);
305 #ifdef USE_ALARM_CONTROL_PANEL 309 void handle_alarm_control_panel_request(AsyncWebServerRequest *request,
const UrlMatch &match);
317 void on_event(
event::Event *obj,
const std::string &event_type)
override;
327 void handle_update_request(AsyncWebServerRequest *request,
const UrlMatch &match);
334 bool canHandle(AsyncWebServerRequest *request)
override;
336 void handleRequest(AsyncWebServerRequest *request)
override;
338 bool isRequestHandlerTrivial()
override;
340 void add_entity_to_sorting_list(
EntityBase *entity,
float weight);
343 void schedule_(std::function<
void()> &&f);
346 AsyncEventSource events_{
"/events"};
349 #if USE_WEBSERVER_VERSION == 1 350 const char *css_url_{
nullptr};
351 const char *js_url_{
nullptr};
353 #ifdef USE_WEBSERVER_CSS_INCLUDE 354 const char *css_include_{
nullptr};
356 #ifdef USE_WEBSERVER_JS_INCLUDE 357 const char *js_include_{
nullptr};
359 bool include_internal_{
false};
360 bool allow_ota_{
true};
361 bool expose_log_{
true};
Base class for all switches.
const size_t ESPHOME_WEBSERVER_CSS_INCLUDE_SIZE
This class represents the communication layer between the front-end MQTT layer and the hardware outpu...
Base class for all cover devices.
void set_allow_ota(bool allow_ota)
Set whether or not the webserver should expose the OTA form and handler.
SemaphoreHandle_t to_schedule_lock_
This class allows users to create a web server with their ESP nodes.
std::map< EntityBase *, SortingComponents > sorting_entitys_
void set_include_internal(bool include_internal)
Determine whether internal components should be displayed on the web server.
Base-class for all text inputs.
void set_expose_log(bool expose_log)
Set whether or not the webserver should expose the Log.
const size_t ESPHOME_WEBSERVER_JS_INCLUDE_SIZE
friend ListEntitiesIterator
Internal helper struct that is used to parse incoming URLs.
const size_t ESPHOME_WEBSERVER_INDEX_HTML_SIZE
std::string domain
The domain of the component, for example "sensor".
Base-class for all numbers.
bool valid
Whether this match is valid.
std::string id
The id of the device that's being accessed, for example "living_room_fan".
const uint8_t ESPHOME_WEBSERVER_INDEX_HTML [] PROGMEM
Base-class for all selects.
web_server_base::WebServerBase * base_
Implementation of SPI Controller mode.
Base class for all valve devices.
Base class for all binary_sensor-type classes.
LockState
Enum for all states a lock can be in.
Base-class for all sensors.
ListEntitiesIterator entities_iterator_
std::deque< std::function< void()> > to_schedule_
std::string method
The method that's being called, for example "turn_on".
Base class for all locks.
ClimateDevice - This is the base class for all climate integrations.