mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 05:24:53 +01:00
commit
0262a99274
10 changed files with 53 additions and 11 deletions
|
@ -9,6 +9,10 @@ static const char *const TAG = "gpio.one_wire";
|
|||
|
||||
void GPIOOneWireBus::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up 1-wire bus...");
|
||||
this->t_pin_->setup();
|
||||
// clear bus with 480µs high, otherwise initial reset in search might fail
|
||||
this->t_pin_->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP);
|
||||
delayMicroseconds(480);
|
||||
this->search();
|
||||
}
|
||||
|
||||
|
@ -90,13 +94,15 @@ bool HOT IRAM_ATTR GPIOOneWireBus::read_bit_() {
|
|||
|
||||
// measure from start value directly, to get best accurate timing no matter
|
||||
// how long pin_mode/delayMicroseconds took
|
||||
delayMicroseconds(12 - (micros() - start));
|
||||
uint32_t now = micros();
|
||||
if (now - start < 12)
|
||||
delayMicroseconds(12 - (now - start));
|
||||
|
||||
// sample bus to read bit from peer
|
||||
bool r = pin_.digital_read();
|
||||
|
||||
// read slot is at least 60µs; get as close to 60µs to spend less time with interrupts locked
|
||||
uint32_t now = micros();
|
||||
now = micros();
|
||||
if (now - start < 60)
|
||||
delayMicroseconds(60 - (now - start));
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
|
|||
}
|
||||
response_body.reserve(read_index);
|
||||
response_body.assign((char *) buf, read_index);
|
||||
allocator.deallocate(buf, max_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ std::shared_ptr<HttpContainer> HttpRequestIDF::start(std::string url, std::strin
|
|||
int write_left = body_len;
|
||||
int write_index = 0;
|
||||
const char *buf = body.c_str();
|
||||
while (body_len > 0) {
|
||||
while (write_left > 0) {
|
||||
int written = esp_http_client_write(client, buf + write_index, write_left);
|
||||
if (written < 0) {
|
||||
err = ESP_FAIL;
|
||||
|
|
|
@ -46,7 +46,7 @@ void WatchdogManager::set_timeout_(uint32_t timeout_ms) {
|
|||
};
|
||||
esp_task_wdt_reconfigure(&wdt_config);
|
||||
#else
|
||||
esp_task_wdt_init(timeout_ms, true);
|
||||
esp_task_wdt_init(timeout_ms / 1000, true);
|
||||
#endif // ESP_IDF_VERSION_MAJOR
|
||||
#endif // USE_ESP32
|
||||
|
||||
|
|
|
@ -293,4 +293,4 @@ async def to_code(config):
|
|||
if CONF_HUMIDITY_SETPOINT in config:
|
||||
sens = await sensor.new_sensor(config[CONF_HUMIDITY_SETPOINT])
|
||||
cg.add(var.set_humidity_setpoint_sensor(sens))
|
||||
cg.add_library("dudanov/MideaUART", "1.1.8")
|
||||
cg.add_library("dudanov/MideaUART", "1.1.9")
|
||||
|
|
|
@ -4,11 +4,13 @@ import esphome.config_validation as cv
|
|||
import esphome.codegen as cg
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
CONF_ENTITY_CATEGORY,
|
||||
CONF_ID,
|
||||
CONF_MQTT_ID,
|
||||
CONF_WEB_SERVER_ID,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
DEVICE_CLASS_FIRMWARE,
|
||||
ENTITY_CATEGORY_CONFIG,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
from esphome.cpp_helpers import setup_entity
|
||||
|
@ -41,6 +43,9 @@ UPDATE_SCHEMA = (
|
|||
cv.Optional(CONF_ON_UPDATE_AVAILABLE): automation.validate_automation(
|
||||
single=True
|
||||
),
|
||||
cv.Optional(
|
||||
CONF_ENTITY_CATEGORY, default=ENTITY_CATEGORY_CONFIG
|
||||
): cv.entity_category,
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -64,7 +69,7 @@ async def setup_update_core_(var, config):
|
|||
await mqtt.register_mqtt_component(mqtt_, config)
|
||||
|
||||
if web_server_id_config := config.get(CONF_WEB_SERVER_ID):
|
||||
web_server_ = cg.get_variable(web_server_id_config)
|
||||
web_server_ = await cg.get_variable(web_server_id_config)
|
||||
web_server.add_entity_to_sorting_list(web_server_, var, config)
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,35 @@
|
|||
#include "update_entity.h"
|
||||
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace update {
|
||||
|
||||
static const char *const TAG = "update";
|
||||
|
||||
void UpdateEntity::publish_state() {
|
||||
ESP_LOGD(TAG, "'%s' - Publishing:", this->name_.c_str());
|
||||
ESP_LOGD(TAG, " Current Version: %s", this->update_info_.current_version.c_str());
|
||||
|
||||
if (!this->update_info_.md5.empty()) {
|
||||
ESP_LOGD(TAG, " Latest Version: %s", this->update_info_.latest_version.c_str());
|
||||
}
|
||||
if (!this->update_info_.firmware_url.empty()) {
|
||||
ESP_LOGD(TAG, " Firmware URL: %s", this->update_info_.firmware_url.c_str());
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG, " Title: %s", this->update_info_.title.c_str());
|
||||
if (!this->update_info_.summary.empty()) {
|
||||
ESP_LOGD(TAG, " Summary: %s", this->update_info_.summary.c_str());
|
||||
}
|
||||
if (!this->update_info_.release_url.empty()) {
|
||||
ESP_LOGD(TAG, " Release URL: %s", this->update_info_.release_url.c_str());
|
||||
}
|
||||
|
||||
if (this->update_info_.has_progress) {
|
||||
ESP_LOGD(TAG, " Progress: %.0f%%", this->update_info_.progress);
|
||||
}
|
||||
|
||||
this->has_state_ = true;
|
||||
this->state_callback_.call();
|
||||
}
|
||||
|
|
|
@ -58,17 +58,21 @@ def merge_config(full_old, full_new):
|
|||
ids = {
|
||||
v_id: i
|
||||
for i, v in enumerate(res)
|
||||
if (v_id := v.get(CONF_ID)) and isinstance(v_id, str)
|
||||
if isinstance(v, dict)
|
||||
and (v_id := v.get(CONF_ID))
|
||||
and isinstance(v_id, str)
|
||||
}
|
||||
extend_ids = {
|
||||
v_id.value: i
|
||||
for i, v in enumerate(res)
|
||||
if (v_id := v.get(CONF_ID)) and isinstance(v_id, Extend)
|
||||
if isinstance(v, dict)
|
||||
and (v_id := v.get(CONF_ID))
|
||||
and isinstance(v_id, Extend)
|
||||
}
|
||||
|
||||
ids_to_delete = []
|
||||
for v in new:
|
||||
if new_id := v.get(CONF_ID):
|
||||
if isinstance(v, dict) and (new_id := v.get(CONF_ID)):
|
||||
if isinstance(new_id, Extend):
|
||||
new_id = new_id.value
|
||||
if new_id in ids:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2024.6.1"
|
||||
__version__ = "2024.6.2"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||
|
|
|
@ -64,7 +64,7 @@ lib_deps =
|
|||
freekode/TM1651@1.0.1 ; tm1651
|
||||
glmnet/Dsmr@0.7 ; dsmr
|
||||
rweather/Crypto@0.4.0 ; dsmr
|
||||
dudanov/MideaUART@1.1.8 ; midea
|
||||
dudanov/MideaUART@1.1.9 ; midea
|
||||
tonia/HeatpumpIR@1.0.23 ; heatpumpir
|
||||
build_flags =
|
||||
${common.build_flags}
|
||||
|
|
Loading…
Reference in a new issue