mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 11:47:30 +01:00
commit
0262a99274
@ -9,6 +9,10 @@ static const char *const TAG = "gpio.one_wire";
|
|||||||
|
|
||||||
void GPIOOneWireBus::setup() {
|
void GPIOOneWireBus::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up 1-wire bus...");
|
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();
|
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
|
// measure from start value directly, to get best accurate timing no matter
|
||||||
// how long pin_mode/delayMicroseconds took
|
// 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
|
// sample bus to read bit from peer
|
||||||
bool r = pin_.digital_read();
|
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
|
// 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)
|
if (now - start < 60)
|
||||||
delayMicroseconds(60 - (now - start));
|
delayMicroseconds(60 - (now - start));
|
||||||
|
|
||||||
|
@ -149,6 +149,7 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
|
|||||||
}
|
}
|
||||||
response_body.reserve(read_index);
|
response_body.reserve(read_index);
|
||||||
response_body.assign((char *) buf, 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_left = body_len;
|
||||||
int write_index = 0;
|
int write_index = 0;
|
||||||
const char *buf = body.c_str();
|
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);
|
int written = esp_http_client_write(client, buf + write_index, write_left);
|
||||||
if (written < 0) {
|
if (written < 0) {
|
||||||
err = ESP_FAIL;
|
err = ESP_FAIL;
|
||||||
|
@ -46,7 +46,7 @@ void WatchdogManager::set_timeout_(uint32_t timeout_ms) {
|
|||||||
};
|
};
|
||||||
esp_task_wdt_reconfigure(&wdt_config);
|
esp_task_wdt_reconfigure(&wdt_config);
|
||||||
#else
|
#else
|
||||||
esp_task_wdt_init(timeout_ms, true);
|
esp_task_wdt_init(timeout_ms / 1000, true);
|
||||||
#endif // ESP_IDF_VERSION_MAJOR
|
#endif // ESP_IDF_VERSION_MAJOR
|
||||||
#endif // USE_ESP32
|
#endif // USE_ESP32
|
||||||
|
|
||||||
|
@ -293,4 +293,4 @@ async def to_code(config):
|
|||||||
if CONF_HUMIDITY_SETPOINT in config:
|
if CONF_HUMIDITY_SETPOINT in config:
|
||||||
sens = await sensor.new_sensor(config[CONF_HUMIDITY_SETPOINT])
|
sens = await sensor.new_sensor(config[CONF_HUMIDITY_SETPOINT])
|
||||||
cg.add(var.set_humidity_setpoint_sensor(sens))
|
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
|
import esphome.codegen as cg
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
|
CONF_ENTITY_CATEGORY,
|
||||||
CONF_ID,
|
CONF_ID,
|
||||||
CONF_MQTT_ID,
|
CONF_MQTT_ID,
|
||||||
CONF_WEB_SERVER_ID,
|
CONF_WEB_SERVER_ID,
|
||||||
DEVICE_CLASS_EMPTY,
|
DEVICE_CLASS_EMPTY,
|
||||||
DEVICE_CLASS_FIRMWARE,
|
DEVICE_CLASS_FIRMWARE,
|
||||||
|
ENTITY_CATEGORY_CONFIG,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.cpp_helpers import setup_entity
|
from esphome.cpp_helpers import setup_entity
|
||||||
@ -41,6 +43,9 @@ UPDATE_SCHEMA = (
|
|||||||
cv.Optional(CONF_ON_UPDATE_AVAILABLE): automation.validate_automation(
|
cv.Optional(CONF_ON_UPDATE_AVAILABLE): automation.validate_automation(
|
||||||
single=True
|
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)
|
await mqtt.register_mqtt_component(mqtt_, config)
|
||||||
|
|
||||||
if web_server_id_config := config.get(CONF_WEB_SERVER_ID):
|
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)
|
web_server.add_entity_to_sorting_list(web_server_, var, config)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,35 @@
|
|||||||
#include "update_entity.h"
|
#include "update_entity.h"
|
||||||
|
|
||||||
|
#include "esphome/core/log.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace update {
|
namespace update {
|
||||||
|
|
||||||
|
static const char *const TAG = "update";
|
||||||
|
|
||||||
void UpdateEntity::publish_state() {
|
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->has_state_ = true;
|
||||||
this->state_callback_.call();
|
this->state_callback_.call();
|
||||||
}
|
}
|
||||||
|
@ -58,17 +58,21 @@ def merge_config(full_old, full_new):
|
|||||||
ids = {
|
ids = {
|
||||||
v_id: i
|
v_id: i
|
||||||
for i, v in enumerate(res)
|
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 = {
|
extend_ids = {
|
||||||
v_id.value: i
|
v_id.value: i
|
||||||
for i, v in enumerate(res)
|
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 = []
|
ids_to_delete = []
|
||||||
for v in new:
|
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):
|
if isinstance(new_id, Extend):
|
||||||
new_id = new_id.value
|
new_id = new_id.value
|
||||||
if new_id in ids:
|
if new_id in ids:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2024.6.1"
|
__version__ = "2024.6.2"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||||
|
@ -64,7 +64,7 @@ lib_deps =
|
|||||||
freekode/TM1651@1.0.1 ; tm1651
|
freekode/TM1651@1.0.1 ; tm1651
|
||||||
glmnet/Dsmr@0.7 ; dsmr
|
glmnet/Dsmr@0.7 ; dsmr
|
||||||
rweather/Crypto@0.4.0 ; 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
|
tonia/HeatpumpIR@1.0.23 ; heatpumpir
|
||||||
build_flags =
|
build_flags =
|
||||||
${common.build_flags}
|
${common.build_flags}
|
||||||
|
Loading…
Reference in New Issue
Block a user