mirror of
https://github.com/esphome/esphome.git
synced 2025-08-10 12:27:46 +00:00
reduce upper bound of batch delay as it did not make sense
This commit is contained in:
@@ -110,9 +110,10 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
): ACTIONS_SCHEMA,
|
): ACTIONS_SCHEMA,
|
||||||
cv.Exclusive(CONF_ACTIONS, group_of_exclusion=CONF_ACTIONS): ACTIONS_SCHEMA,
|
cv.Exclusive(CONF_ACTIONS, group_of_exclusion=CONF_ACTIONS): ACTIONS_SCHEMA,
|
||||||
cv.Optional(CONF_ENCRYPTION): _encryption_schema,
|
cv.Optional(CONF_ENCRYPTION): _encryption_schema,
|
||||||
cv.Optional(
|
cv.Optional(CONF_BATCH_DELAY, default="100ms"): cv.All(
|
||||||
CONF_BATCH_DELAY, default="100ms"
|
cv.positive_time_period_milliseconds,
|
||||||
): cv.positive_time_period_milliseconds,
|
cv.Range(max=cv.TimePeriod(milliseconds=65535)),
|
||||||
|
),
|
||||||
cv.Optional(CONF_ON_CLIENT_CONNECTED): automation.validate_automation(
|
cv.Optional(CONF_ON_CLIENT_CONNECTED): automation.validate_automation(
|
||||||
single=True
|
single=True
|
||||||
),
|
),
|
||||||
|
@@ -431,7 +431,7 @@ void APIServer::set_port(uint16_t port) { this->port_ = port; }
|
|||||||
|
|
||||||
void APIServer::set_password(const std::string &password) { this->password_ = password; }
|
void APIServer::set_password(const std::string &password) { this->password_ = password; }
|
||||||
|
|
||||||
void APIServer::set_batch_delay(uint32_t batch_delay) { this->batch_delay_ = batch_delay; }
|
void APIServer::set_batch_delay(uint16_t batch_delay) { this->batch_delay_ = batch_delay; }
|
||||||
|
|
||||||
void APIServer::send_homeassistant_service_call(const HomeassistantServiceResponse &call) {
|
void APIServer::send_homeassistant_service_call(const HomeassistantServiceResponse &call) {
|
||||||
for (auto &client : this->clients_) {
|
for (auto &client : this->clients_) {
|
||||||
|
@@ -40,8 +40,8 @@ class APIServer : public Component, public Controller {
|
|||||||
void set_port(uint16_t port);
|
void set_port(uint16_t port);
|
||||||
void set_password(const std::string &password);
|
void set_password(const std::string &password);
|
||||||
void set_reboot_timeout(uint32_t reboot_timeout);
|
void set_reboot_timeout(uint32_t reboot_timeout);
|
||||||
void set_batch_delay(uint32_t batch_delay);
|
void set_batch_delay(uint16_t batch_delay);
|
||||||
uint32_t get_batch_delay() const { return batch_delay_; }
|
uint16_t get_batch_delay() const { return batch_delay_; }
|
||||||
|
|
||||||
// Get reference to shared buffer for API connections
|
// Get reference to shared buffer for API connections
|
||||||
std::vector<uint8_t> &get_shared_buffer_ref() { return shared_write_buffer_; }
|
std::vector<uint8_t> &get_shared_buffer_ref() { return shared_write_buffer_; }
|
||||||
@@ -150,7 +150,6 @@ class APIServer : public Component, public Controller {
|
|||||||
|
|
||||||
// 4-byte aligned types
|
// 4-byte aligned types
|
||||||
uint32_t reboot_timeout_{300000};
|
uint32_t reboot_timeout_{300000};
|
||||||
uint32_t batch_delay_{100};
|
|
||||||
|
|
||||||
// Vectors and strings (12 bytes each on 32-bit)
|
// Vectors and strings (12 bytes each on 32-bit)
|
||||||
std::vector<std::unique_ptr<APIConnection>> clients_;
|
std::vector<std::unique_ptr<APIConnection>> clients_;
|
||||||
@@ -161,8 +160,9 @@ class APIServer : public Component, public Controller {
|
|||||||
|
|
||||||
// Group smaller types together
|
// Group smaller types together
|
||||||
uint16_t port_{6053};
|
uint16_t port_{6053};
|
||||||
|
uint16_t batch_delay_{100};
|
||||||
bool shutting_down_ = false;
|
bool shutting_down_ = false;
|
||||||
// 3 bytes used, 1 byte padding
|
// 5 bytes used, 3 bytes padding
|
||||||
|
|
||||||
#ifdef USE_API_NOISE
|
#ifdef USE_API_NOISE
|
||||||
std::shared_ptr<APINoiseContext> noise_ctx_ = std::make_shared<APINoiseContext>();
|
std::shared_ptr<APINoiseContext> noise_ctx_ = std::make_shared<APINoiseContext>();
|
||||||
|
Reference in New Issue
Block a user