mirror of
https://github.com/esphome/esphome.git
synced 2025-11-03 00:21:56 +00:00
Compare commits
13 Commits
2024.7.0b4
...
2024.7.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
038f24fcea | ||
|
|
ad0118dd4a | ||
|
|
7c24f1ba6d | ||
|
|
6e863305aa | ||
|
|
0ac549d208 | ||
|
|
41813b0a1f | ||
|
|
4690e227b8 | ||
|
|
5bec0a6534 | ||
|
|
626ed815fb | ||
|
|
74aee1d453 | ||
|
|
d187340fc4 | ||
|
|
de0e549187 | ||
|
|
e15d0ee150 |
@@ -695,7 +695,8 @@ def command_rename(args, config):
|
||||
os.remove(new_path)
|
||||
return 1
|
||||
|
||||
os.remove(CORE.config_path)
|
||||
if CORE.config_path != new_path:
|
||||
os.remove(CORE.config_path)
|
||||
|
||||
print(color(Fore.BOLD_GREEN, "SUCCESS"))
|
||||
print()
|
||||
|
||||
@@ -8,6 +8,7 @@ from esphome.const import (
|
||||
CONF_PROTOCOL,
|
||||
CONF_VISUAL,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
|
||||
CODEOWNERS = ["@rob-deutsch"]
|
||||
|
||||
@@ -127,3 +128,5 @@ def to_code(config):
|
||||
cg.add(var.set_min_temperature(config[CONF_MIN_TEMPERATURE]))
|
||||
|
||||
cg.add_library("tonia/HeatpumpIR", "1.0.27")
|
||||
if CORE.is_libretiny:
|
||||
CORE.add_platformio_option("lib_ignore", "IRremoteESP8266")
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import esp32
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
__version__,
|
||||
CONF_ESP8266_DISABLE_SSL_SUPPORT,
|
||||
CONF_ID,
|
||||
CONF_TIMEOUT,
|
||||
CONF_METHOD,
|
||||
CONF_TIMEOUT,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_URL,
|
||||
CONF_ESP8266_DISABLE_SSL_SUPPORT,
|
||||
__version__,
|
||||
)
|
||||
from esphome.core import Lambda, CORE
|
||||
from esphome.components import esp32
|
||||
from esphome.core import CORE, Lambda
|
||||
|
||||
DEPENDENCIES = ["network"]
|
||||
AUTO_LOAD = ["json"]
|
||||
@@ -99,7 +99,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_FOLLOW_REDIRECTS, True): cv.boolean,
|
||||
cv.Optional(CONF_REDIRECT_LIMIT, 3): cv.int_,
|
||||
cv.Optional(
|
||||
CONF_TIMEOUT, default="5s"
|
||||
CONF_TIMEOUT, default="4.5s"
|
||||
): cv.positive_time_period_milliseconds,
|
||||
cv.SplitDefault(CONF_ESP8266_DISABLE_SSL_SUPPORT, esp8266=False): cv.All(
|
||||
cv.only_on_esp8266, cv.boolean
|
||||
|
||||
@@ -80,7 +80,7 @@ class HttpRequestComponent : public Component {
|
||||
const char *useragent_{nullptr};
|
||||
bool follow_redirects_;
|
||||
uint16_t redirect_limit_;
|
||||
uint16_t timeout_{5000};
|
||||
uint16_t timeout_{4500};
|
||||
uint32_t watchdog_timeout_{0};
|
||||
};
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
|
||||
config.timeout_ms = this->timeout_;
|
||||
config.disable_auto_redirect = !this->follow_redirects_;
|
||||
config.max_redirection_count = this->redirect_limit_;
|
||||
config.auth_type = HTTP_AUTH_TYPE_BASIC;
|
||||
#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
|
||||
if (secure) {
|
||||
config.crt_bundle_attach = esp_crt_bundle_attach;
|
||||
@@ -76,7 +77,7 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
|
||||
esp_http_client_set_header(client, header.name, header.value);
|
||||
}
|
||||
|
||||
int body_len = body.length();
|
||||
const int body_len = body.length();
|
||||
|
||||
esp_err_t err = esp_http_client_open(client, body_len);
|
||||
if (err != ESP_OK) {
|
||||
@@ -108,18 +109,62 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
container->content_length = esp_http_client_fetch_headers(client);
|
||||
const auto status_code = esp_http_client_get_status_code(client);
|
||||
container->status_code = status_code;
|
||||
auto is_ok = [](int code) { return code >= HttpStatus_Ok && code < HttpStatus_MultipleChoices; };
|
||||
|
||||
if (status_code < 200 || status_code >= 300) {
|
||||
ESP_LOGE(TAG, "HTTP Request failed; URL: %s; Code: %d", url.c_str(), status_code);
|
||||
this->status_momentary_error("failed", 1000);
|
||||
esp_http_client_cleanup(client);
|
||||
return nullptr;
|
||||
container->content_length = esp_http_client_fetch_headers(client);
|
||||
container->status_code = esp_http_client_get_status_code(client);
|
||||
if (is_ok(container->status_code)) {
|
||||
container->duration_ms = millis() - start;
|
||||
return container;
|
||||
}
|
||||
container->duration_ms = millis() - start;
|
||||
return container;
|
||||
|
||||
if (this->follow_redirects_) {
|
||||
auto is_redirect = [](int code) {
|
||||
return code == HttpStatus_MovedPermanently || code == HttpStatus_Found || code == HttpStatus_SeeOther ||
|
||||
code == HttpStatus_TemporaryRedirect || code == HttpStatus_PermanentRedirect;
|
||||
};
|
||||
auto num_redirects = this->redirect_limit_;
|
||||
while (is_redirect(container->status_code) && num_redirects > 0) {
|
||||
err = esp_http_client_set_redirection(client);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "esp_http_client_set_redirection failed: %s", esp_err_to_name(err));
|
||||
this->status_momentary_error("failed", 1000);
|
||||
esp_http_client_cleanup(client);
|
||||
return nullptr;
|
||||
}
|
||||
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_VERBOSE
|
||||
char url[256]{};
|
||||
if (esp_http_client_get_url(client, url, sizeof(url) - 1) == ESP_OK) {
|
||||
ESP_LOGV(TAG, "redirecting to url: %s", url);
|
||||
}
|
||||
#endif
|
||||
err = esp_http_client_open(client, 0);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "esp_http_client_open failed: %s", esp_err_to_name(err));
|
||||
this->status_momentary_error("failed", 1000);
|
||||
esp_http_client_cleanup(client);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
container->content_length = esp_http_client_fetch_headers(client);
|
||||
container->status_code = esp_http_client_get_status_code(client);
|
||||
if (is_ok(container->status_code)) {
|
||||
container->duration_ms = millis() - start;
|
||||
return container;
|
||||
}
|
||||
|
||||
num_redirects--;
|
||||
}
|
||||
|
||||
if (num_redirects == 0) {
|
||||
ESP_LOGW(TAG, "Reach redirect limit count=%d", this->redirect_limit_);
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGE(TAG, "HTTP Request failed; URL: %s; Code: %d", url.c_str(), container->status_code);
|
||||
this->status_momentary_error("failed", 1000);
|
||||
esp_http_client_cleanup(client);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int HttpContainerIDF::read(uint8_t *buf, size_t max_len) {
|
||||
|
||||
@@ -174,7 +174,8 @@ size_t I2SAudioMicrophone::read(int16_t *buf, size_t len) {
|
||||
size_t samples_read = bytes_read / sizeof(int32_t);
|
||||
samples.resize(samples_read);
|
||||
for (size_t i = 0; i < samples_read; i++) {
|
||||
samples[i] = reinterpret_cast<int32_t *>(buf)[i] >> 16;
|
||||
int32_t temp = reinterpret_cast<int32_t *>(buf)[i] >> 14;
|
||||
samples[i] = clamp<int16_t>(temp, INT16_MIN, INT16_MAX);
|
||||
}
|
||||
memcpy(buf, samples.data(), samples_read * sizeof(int16_t));
|
||||
return samples_read * sizeof(int16_t);
|
||||
|
||||
@@ -27,7 +27,7 @@ bool SmlFile::setup_node(SmlNode *node) {
|
||||
uint8_t parse_length = length;
|
||||
if (has_extended_length) {
|
||||
length = (length << 4) + (this->buffer_[this->pos_ + 1] & 0x0f);
|
||||
parse_length = length - 1;
|
||||
parse_length = length;
|
||||
this->pos_ += 1;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ bool SmlFile::setup_node(SmlNode *node) {
|
||||
node->type = type & 0x07;
|
||||
node->nodes.clear();
|
||||
node->value_bytes.clear();
|
||||
if (this->buffer_[this->pos_] == 0x00) { // end of message
|
||||
|
||||
// if the list is a has_extended_length list with e.g. 16 elements this is a 0x00 byte but not the end of message
|
||||
if (!has_extended_length && this->buffer_[this->pos_] == 0x00) { // end of message
|
||||
this->pos_ += 1;
|
||||
} else if (is_list) { // list
|
||||
this->pos_ += 1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2024.7.0b4"
|
||||
__version__ = "2024.7.2"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||
|
||||
@@ -3,6 +3,13 @@ remote_transmitter:
|
||||
carrier_duty_percent: 50%
|
||||
|
||||
climate:
|
||||
- platform: heatpumpir
|
||||
protocol: mitsubishi_heavy_zm
|
||||
horizontal_default: left
|
||||
vertical_default: up
|
||||
name: HeatpumpIR Climate
|
||||
min_temperature: 18
|
||||
max_temperature: 30
|
||||
- platform: heatpumpir
|
||||
protocol: daikin
|
||||
horizontal_default: mleft
|
||||
|
||||
Reference in New Issue
Block a user