mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
commit
61b8004536
7 changed files with 25 additions and 13 deletions
|
@ -18,7 +18,7 @@ _ESP_SDIO_PINS = {
|
||||||
11: "Flash Command",
|
11: "Flash Command",
|
||||||
}
|
}
|
||||||
|
|
||||||
_ESP32_STRAPPING_PINS = {0, 2, 4, 12, 15}
|
_ESP32_STRAPPING_PINS = {0, 2, 5, 12, 15}
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@ CONFIG_SCHEMA = cv.Schema(
|
||||||
cv.Optional(
|
cv.Optional(
|
||||||
CONF_AUTHORIZED_DURATION, default="1min"
|
CONF_AUTHORIZED_DURATION, default="1min"
|
||||||
): cv.positive_time_period_milliseconds,
|
): cv.positive_time_period_milliseconds,
|
||||||
|
cv.Optional(
|
||||||
|
CONF_WIFI_TIMEOUT, default="1min"
|
||||||
|
): cv.positive_time_period_milliseconds,
|
||||||
}
|
}
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
@ -53,6 +56,8 @@ async def to_code(config):
|
||||||
cg.add(var.set_identify_duration(config[CONF_IDENTIFY_DURATION]))
|
cg.add(var.set_identify_duration(config[CONF_IDENTIFY_DURATION]))
|
||||||
cg.add(var.set_authorized_duration(config[CONF_AUTHORIZED_DURATION]))
|
cg.add(var.set_authorized_duration(config[CONF_AUTHORIZED_DURATION]))
|
||||||
|
|
||||||
|
cg.add(var.set_wifi_timeout(config[CONF_WIFI_TIMEOUT]))
|
||||||
|
|
||||||
if CONF_AUTHORIZER in config and config[CONF_AUTHORIZER] is not None:
|
if CONF_AUTHORIZER in config and config[CONF_AUTHORIZER] is not None:
|
||||||
activator = await cg.get_variable(config[CONF_AUTHORIZER])
|
activator = await cg.get_variable(config[CONF_AUTHORIZER])
|
||||||
cg.add(var.set_authorizer(activator))
|
cg.add(var.set_authorizer(activator))
|
||||||
|
|
|
@ -51,6 +51,9 @@ class ESP32ImprovComponent : public Component, public BLEServiceComponent {
|
||||||
void set_identify_duration(uint32_t identify_duration) { this->identify_duration_ = identify_duration; }
|
void set_identify_duration(uint32_t identify_duration) { this->identify_duration_ = identify_duration; }
|
||||||
void set_authorized_duration(uint32_t authorized_duration) { this->authorized_duration_ = authorized_duration; }
|
void set_authorized_duration(uint32_t authorized_duration) { this->authorized_duration_ = authorized_duration; }
|
||||||
|
|
||||||
|
void set_wifi_timeout(uint32_t wifi_timeout) { this->wifi_timeout_ = wifi_timeout; }
|
||||||
|
uint32_t get_wifi_timeout() const { return this->wifi_timeout_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool should_start_{false};
|
bool should_start_{false};
|
||||||
bool setup_complete_{false};
|
bool setup_complete_{false};
|
||||||
|
@ -60,6 +63,8 @@ class ESP32ImprovComponent : public Component, public BLEServiceComponent {
|
||||||
uint32_t authorized_start_{0};
|
uint32_t authorized_start_{0};
|
||||||
uint32_t authorized_duration_;
|
uint32_t authorized_duration_;
|
||||||
|
|
||||||
|
uint32_t wifi_timeout_{};
|
||||||
|
|
||||||
std::vector<uint8_t> incoming_data_;
|
std::vector<uint8_t> incoming_data_;
|
||||||
wifi::WiFiAP connecting_sta_;
|
wifi::WiFiAP connecting_sta_;
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace socket {
|
||||||
Socket::~Socket() {}
|
Socket::~Socket() {}
|
||||||
|
|
||||||
std::unique_ptr<Socket> socket_ip(int type, int protocol) {
|
std::unique_ptr<Socket> socket_ip(int type, int protocol) {
|
||||||
#if LWIP_IPV6
|
#if ENABLE_IPV6
|
||||||
return socket(AF_INET6, type, protocol);
|
return socket(AF_INET6, type, protocol);
|
||||||
#else
|
#else
|
||||||
return socket(AF_INET, type, protocol);
|
return socket(AF_INET, type, protocol);
|
||||||
|
@ -18,7 +18,7 @@ std::unique_ptr<Socket> socket_ip(int type, int protocol) {
|
||||||
}
|
}
|
||||||
|
|
||||||
socklen_t set_sockaddr(struct sockaddr *addr, socklen_t addrlen, const std::string &ip_address, uint16_t port) {
|
socklen_t set_sockaddr(struct sockaddr *addr, socklen_t addrlen, const std::string &ip_address, uint16_t port) {
|
||||||
#if LWIP_IPV6
|
#if ENABLE_IPV6
|
||||||
if (addrlen < sizeof(sockaddr_in6)) {
|
if (addrlen < sizeof(sockaddr_in6)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -51,7 +51,7 @@ socklen_t set_sockaddr(struct sockaddr *addr, socklen_t addrlen, const std::stri
|
||||||
}
|
}
|
||||||
|
|
||||||
socklen_t set_sockaddr_any(struct sockaddr *addr, socklen_t addrlen, uint16_t port) {
|
socklen_t set_sockaddr_any(struct sockaddr *addr, socklen_t addrlen, uint16_t port) {
|
||||||
#if LWIP_IPV6
|
#if ENABLE_IPV6
|
||||||
if (addrlen < sizeof(sockaddr_in6)) {
|
if (addrlen < sizeof(sockaddr_in6)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -316,8 +316,8 @@ void VoiceAssistant::loop() {
|
||||||
this->speaker_buffer_index_ = 0;
|
this->speaker_buffer_index_ = 0;
|
||||||
memset(this->speaker_buffer_, 0, SPEAKER_BUFFER_SIZE);
|
memset(this->speaker_buffer_, 0, SPEAKER_BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
this->wait_for_stream_end_ = false;
|
this->wait_for_stream_end_ = false;
|
||||||
|
#endif
|
||||||
this->set_state_(State::IDLE, State::IDLE);
|
this->set_state_(State::IDLE, State::IDLE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -586,7 +586,9 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case api::enums::VOICE_ASSISTANT_TTS_STREAM_START: {
|
case api::enums::VOICE_ASSISTANT_TTS_STREAM_START: {
|
||||||
|
#ifdef USE_SPEAKER
|
||||||
this->wait_for_stream_end_ = true;
|
this->wait_for_stream_end_ = true;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case api::enums::VOICE_ASSISTANT_TTS_STREAM_END: {
|
case api::enums::VOICE_ASSISTANT_TTS_STREAM_END: {
|
||||||
|
|
|
@ -8,16 +8,16 @@
|
||||||
#include <user_interface.h>
|
#include <user_interface.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "lwip/err.h"
|
#include <utility>
|
||||||
#include "lwip/dns.h"
|
#include "lwip/dns.h"
|
||||||
|
#include "lwip/err.h"
|
||||||
|
|
||||||
|
#include "esphome/core/application.h"
|
||||||
|
#include "esphome/core/hal.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/hal.h"
|
|
||||||
#include "esphome/core/util.h"
|
#include "esphome/core/util.h"
|
||||||
#include "esphome/core/application.h"
|
|
||||||
|
|
||||||
#ifdef USE_CAPTIVE_PORTAL
|
#ifdef USE_CAPTIVE_PORTAL
|
||||||
#include "esphome/components/captive_portal/captive_portal.h"
|
#include "esphome/components/captive_portal/captive_portal.h"
|
||||||
|
@ -96,7 +96,7 @@ void WiFiComponent::start() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef USE_IMPROV
|
#ifdef USE_IMPROV
|
||||||
if (esp32_improv::global_improv_component != nullptr) {
|
if (!this->has_sta() && esp32_improv::global_improv_component != nullptr) {
|
||||||
if (this->wifi_mode_(true, {}))
|
if (this->wifi_mode_(true, {}))
|
||||||
esp32_improv::global_improv_component->start();
|
esp32_improv::global_improv_component->start();
|
||||||
}
|
}
|
||||||
|
@ -163,8 +163,8 @@ void WiFiComponent::loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_IMPROV
|
#ifdef USE_IMPROV
|
||||||
if (esp32_improv::global_improv_component != nullptr) {
|
if (esp32_improv::global_improv_component != nullptr && !esp32_improv::global_improv_component->is_active()) {
|
||||||
if (!this->is_connected()) {
|
if (now - this->last_connected_ > esp32_improv::global_improv_component->get_wifi_timeout()) {
|
||||||
if (this->wifi_mode_(true, {}))
|
if (this->wifi_mode_(true, {}))
|
||||||
esp32_improv::global_improv_component->start();
|
esp32_improv::global_improv_component->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2023.10.0"
|
__version__ = "2023.10.1"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
|
Loading…
Reference in a new issue