mirror of
https://github.com/esphome/esphome.git
synced 2025-10-24 20:53:48 +01:00
Add support for time entities (#6399)
* Add time entities * Add tests * Add myself to datetime codeowners * Fix publishing times with 0 values * Log performing TimeCall * Implement `on_time` trigger * Rename var * Fix initial value for time * Add arg name for clarity * Remove useless checks
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
|
||||
#include <vector>
|
||||
#ifdef USE_ESP32
|
||||
#include <deque>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/semphr.h>
|
||||
#include <deque>
|
||||
#endif
|
||||
|
||||
#if USE_WEBSERVER_VERSION >= 2
|
||||
@@ -230,6 +230,15 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
|
||||
std::string date_json(datetime::DateEntity *obj, JsonDetail start_config);
|
||||
#endif
|
||||
|
||||
#ifdef USE_DATETIME_TIME
|
||||
void on_time_update(datetime::TimeEntity *obj) override;
|
||||
/// Handle a time request under '/time/<id>'.
|
||||
void handle_time_request(AsyncWebServerRequest *request, const UrlMatch &match);
|
||||
|
||||
/// Dump the time state with its value as a JSON string.
|
||||
std::string time_json(datetime::TimeEntity *obj, JsonDetail start_config);
|
||||
#endif
|
||||
|
||||
#ifdef USE_TEXT
|
||||
void on_text_update(text::Text *obj, const std::string &state) override;
|
||||
/// Handle a text input request under '/text/<id>'.
|
||||
|
||||
Reference in New Issue
Block a user