mirror of
https://github.com/esphome/esphome.git
synced 2025-11-01 15:41:52 +00:00
Compare commits
18 Commits
2024.10.0b
...
2024.10.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfd174e1a5 | ||
|
|
735c04cd69 | ||
|
|
d95b370998 | ||
|
|
3ebdd62c67 | ||
|
|
c26c96b8f4 | ||
|
|
748256b3ee | ||
|
|
10791db82e | ||
|
|
3dd34f6628 | ||
|
|
7004053538 | ||
|
|
d6b96ad51d | ||
|
|
9b4b50a3a6 | ||
|
|
ef87a6657a | ||
|
|
27e1233fc0 | ||
|
|
d24ad2e0e7 | ||
|
|
dda27d9de4 | ||
|
|
f52136338d | ||
|
|
bafb0ad688 | ||
|
|
b617b92758 |
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -315,7 +315,9 @@ jobs:
|
||||
key: platformio-${{ matrix.pio_cache_key }}
|
||||
|
||||
- name: Install clang-tidy
|
||||
run: sudo apt-get install clang-tidy-14
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install clang-tidy-14
|
||||
|
||||
- name: Register problem matchers
|
||||
run: |
|
||||
@@ -397,7 +399,9 @@ jobs:
|
||||
file: ${{ fromJson(needs.list-components.outputs.components) }}
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install libsdl2-dev
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsdl2-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.7
|
||||
@@ -451,7 +455,9 @@ jobs:
|
||||
run: echo ${{ matrix.components }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install libsdl2-dev
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsdl2-dev
|
||||
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v4.1.7
|
||||
|
||||
@@ -45,7 +45,7 @@ CONFIG_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_SERVICE_UUID): esp32_ble_tracker.bt_uuid,
|
||||
cv.Optional(CONF_IBEACON_MAJOR): cv.uint16_t,
|
||||
cv.Optional(CONF_IBEACON_MINOR): cv.uint16_t,
|
||||
cv.Optional(CONF_IBEACON_UUID): cv.uuid,
|
||||
cv.Optional(CONF_IBEACON_UUID): esp32_ble_tracker.bt_uuid,
|
||||
}
|
||||
)
|
||||
.extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
|
||||
@@ -79,7 +79,7 @@ async def to_code(config):
|
||||
cg.add(var.set_service_uuid128(uuid128))
|
||||
|
||||
if ibeacon_uuid := config.get(CONF_IBEACON_UUID):
|
||||
ibeacon_uuid = esp32_ble_tracker.as_hex_array(str(ibeacon_uuid))
|
||||
ibeacon_uuid = esp32_ble_tracker.as_reversed_hex_array(ibeacon_uuid)
|
||||
cg.add(var.set_ibeacon_uuid(ibeacon_uuid))
|
||||
|
||||
if (ibeacon_major := config.get(CONF_IBEACON_MAJOR)) is not None:
|
||||
|
||||
@@ -244,7 +244,7 @@ void CSE7766Component::dump_config() {
|
||||
LOG_SENSOR(" ", "Apparent Power", this->apparent_power_sensor_);
|
||||
LOG_SENSOR(" ", "Reactive Power", this->reactive_power_sensor_);
|
||||
LOG_SENSOR(" ", "Power Factor", this->power_factor_sensor_);
|
||||
this->check_uart_settings(4800);
|
||||
this->check_uart_settings(4800, 1, uart::UART_CONFIG_PARITY_EVEN);
|
||||
}
|
||||
|
||||
} // namespace cse7766
|
||||
|
||||
@@ -395,6 +395,13 @@ ARDUINO_FRAMEWORK_SCHEMA = cv.All(
|
||||
cv.Optional(CONF_VERSION, default="recommended"): cv.string_strict,
|
||||
cv.Optional(CONF_SOURCE): cv.string_strict,
|
||||
cv.Optional(CONF_PLATFORM_VERSION): _parse_platform_version,
|
||||
cv.Optional(CONF_ADVANCED, default={}): cv.Schema(
|
||||
{
|
||||
cv.Optional(
|
||||
CONF_IGNORE_EFUSE_CUSTOM_MAC, default=False
|
||||
): cv.boolean,
|
||||
}
|
||||
),
|
||||
}
|
||||
),
|
||||
_arduino_check_versions,
|
||||
@@ -494,6 +501,9 @@ async def to_code(config):
|
||||
conf = config[CONF_FRAMEWORK]
|
||||
cg.add_platformio_option("platform", conf[CONF_PLATFORM_VERSION])
|
||||
|
||||
if CONF_ADVANCED in conf and conf[CONF_ADVANCED][CONF_IGNORE_EFUSE_CUSTOM_MAC]:
|
||||
cg.add_define("USE_ESP32_IGNORE_EFUSE_CUSTOM_MAC")
|
||||
|
||||
add_extra_script(
|
||||
"post",
|
||||
"post_build.py",
|
||||
@@ -540,8 +550,6 @@ async def to_code(config):
|
||||
for name, value in conf[CONF_SDKCONFIG_OPTIONS].items():
|
||||
add_idf_sdkconfig_option(name, RawSdkconfigValue(value))
|
||||
|
||||
if conf[CONF_ADVANCED][CONF_IGNORE_EFUSE_CUSTOM_MAC]:
|
||||
cg.add_define("USE_ESP32_IGNORE_EFUSE_CUSTOM_MAC")
|
||||
if conf[CONF_ADVANCED].get(CONF_IGNORE_EFUSE_MAC_CRC):
|
||||
add_idf_sdkconfig_option("CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR", True)
|
||||
if (framework_ver.major, framework_ver.minor) >= (4, 4):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from esphome import automation
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import mqtt
|
||||
from esphome.components import mqtt, web_server
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_DEVICE_CLASS,
|
||||
@@ -11,6 +11,7 @@ from esphome.const import (
|
||||
CONF_MQTT_ID,
|
||||
CONF_ON_EVENT,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_WEB_SERVER,
|
||||
DEVICE_CLASS_BUTTON,
|
||||
DEVICE_CLASS_DOORBELL,
|
||||
DEVICE_CLASS_EMPTY,
|
||||
@@ -40,17 +41,21 @@ EventTrigger = event_ns.class_("EventTrigger", automation.Trigger.template())
|
||||
|
||||
validate_device_class = cv.one_of(*DEVICE_CLASSES, lower=True, space="_")
|
||||
|
||||
EVENT_SCHEMA = cv.ENTITY_BASE_SCHEMA.extend(cv.MQTT_COMPONENT_SCHEMA).extend(
|
||||
{
|
||||
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTEventComponent),
|
||||
cv.GenerateID(): cv.declare_id(Event),
|
||||
cv.Optional(CONF_DEVICE_CLASS): validate_device_class,
|
||||
cv.Optional(CONF_ON_EVENT): automation.validate_automation(
|
||||
{
|
||||
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(EventTrigger),
|
||||
}
|
||||
),
|
||||
}
|
||||
EVENT_SCHEMA = (
|
||||
cv.ENTITY_BASE_SCHEMA.extend(web_server.WEBSERVER_SORTING_SCHEMA)
|
||||
.extend(cv.MQTT_COMPONENT_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.OnlyWith(CONF_MQTT_ID, "mqtt"): cv.declare_id(mqtt.MQTTEventComponent),
|
||||
cv.GenerateID(): cv.declare_id(Event),
|
||||
cv.Optional(CONF_DEVICE_CLASS): validate_device_class,
|
||||
cv.Optional(CONF_ON_EVENT): automation.validate_automation(
|
||||
{
|
||||
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(EventTrigger),
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
_UNDEF = object()
|
||||
@@ -97,6 +102,9 @@ async def setup_event_core_(var, config, *, event_types: list[str]):
|
||||
mqtt_ = cg.new_Pvariable(mqtt_id, var)
|
||||
await mqtt.register_mqtt_component(mqtt_, config)
|
||||
|
||||
if web_server_config := config.get(CONF_WEB_SERVER):
|
||||
await web_server.add_entity_config(var, web_server_config)
|
||||
|
||||
|
||||
async def register_event(var, config, *, event_types: list[str]):
|
||||
if not CORE.has_id(config[CONF_ID]):
|
||||
|
||||
@@ -16,7 +16,7 @@ from .const import KEY_HOST
|
||||
from .gpio import host_pin_to_code # noqa
|
||||
|
||||
CODEOWNERS = ["@esphome/core", "@clydebarrow"]
|
||||
AUTO_LOAD = ["network"]
|
||||
AUTO_LOAD = ["network", "preferences"]
|
||||
|
||||
|
||||
def set_core_data(config):
|
||||
|
||||
@@ -46,7 +46,7 @@ from .const import (
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
CODEOWNERS = ["@kuba2k2"]
|
||||
AUTO_LOAD = []
|
||||
AUTO_LOAD = ["preferences"]
|
||||
|
||||
|
||||
def _detect_variant(value):
|
||||
|
||||
@@ -33,7 +33,7 @@ from .schemas import (
|
||||
FLEX_OBJ_SCHEMA,
|
||||
GRID_CELL_SCHEMA,
|
||||
LAYOUT_SCHEMAS,
|
||||
STATE_SCHEMA,
|
||||
STYLE_SCHEMA,
|
||||
WIDGET_TYPES,
|
||||
any_widget_schema,
|
||||
container_schema,
|
||||
@@ -323,7 +323,7 @@ CONFIG_SCHEMA = (
|
||||
),
|
||||
cv.Optional(df.CONF_STYLE_DEFINITIONS): cv.ensure_list(
|
||||
cv.Schema({cv.Required(CONF_ID): cv.declare_id(lv_style_t)})
|
||||
.extend(STATE_SCHEMA)
|
||||
.extend(STYLE_SCHEMA)
|
||||
.extend(
|
||||
{
|
||||
cv.Optional(df.CONF_GRID_CELL_X_ALIGN): grid_alignments,
|
||||
|
||||
@@ -26,7 +26,7 @@ from .gpio import rp2040_pin_to_code # noqa
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
CODEOWNERS = ["@jesserockz"]
|
||||
AUTO_LOAD = []
|
||||
AUTO_LOAD = ["preferences"]
|
||||
|
||||
|
||||
def set_core_data(config):
|
||||
|
||||
@@ -64,46 +64,46 @@ uint16_t shelly_dimmer_checksum(const uint8_t *buf, int len) {
|
||||
return std::accumulate<decltype(buf), uint16_t>(buf, buf + len, 0);
|
||||
}
|
||||
|
||||
bool ShellyDimmer::is_running_configured_version() const {
|
||||
return this->version_major_ == USE_SHD_FIRMWARE_MAJOR_VERSION &&
|
||||
this->version_minor_ == USE_SHD_FIRMWARE_MINOR_VERSION;
|
||||
}
|
||||
|
||||
void ShellyDimmer::handle_firmware() {
|
||||
// Reset the STM32 and check the firmware version.
|
||||
this->reset_normal_boot_();
|
||||
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
||||
ESP_LOGI(TAG, "STM32 current firmware version: %d.%d, desired version: %d.%d", this->version_major_,
|
||||
this->version_minor_, USE_SHD_FIRMWARE_MAJOR_VERSION, USE_SHD_FIRMWARE_MINOR_VERSION);
|
||||
|
||||
if (!is_running_configured_version()) {
|
||||
#ifdef USE_SHD_FIRMWARE_DATA
|
||||
if (!this->upgrade_firmware_()) {
|
||||
ESP_LOGW(TAG, "Failed to upgrade firmware");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
this->reset_normal_boot_();
|
||||
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
||||
if (!is_running_configured_version()) {
|
||||
ESP_LOGE(TAG, "STM32 firmware upgrade already performed, but version is still incorrect");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
ESP_LOGW(TAG, "Firmware version mismatch, put 'update: true' in the yaml to flash an update.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void ShellyDimmer::setup() {
|
||||
this->pin_nrst_->setup();
|
||||
this->pin_boot0_->setup();
|
||||
|
||||
ESP_LOGI(TAG, "Initializing Shelly Dimmer...");
|
||||
|
||||
// Reset the STM32 and check the firmware version.
|
||||
for (int i = 0; i < 2; i++) {
|
||||
this->reset_normal_boot_();
|
||||
this->send_command_(SHELLY_DIMMER_PROTO_CMD_VERSION, nullptr, 0);
|
||||
ESP_LOGI(TAG, "STM32 current firmware version: %d.%d, desired version: %d.%d", this->version_major_,
|
||||
this->version_minor_, USE_SHD_FIRMWARE_MAJOR_VERSION, USE_SHD_FIRMWARE_MINOR_VERSION);
|
||||
if (this->version_major_ != USE_SHD_FIRMWARE_MAJOR_VERSION ||
|
||||
this->version_minor_ != USE_SHD_FIRMWARE_MINOR_VERSION) {
|
||||
#ifdef USE_SHD_FIRMWARE_DATA
|
||||
// Update firmware if needed.
|
||||
ESP_LOGW(TAG, "Unsupported STM32 firmware version, flashing");
|
||||
if (i > 0) {
|
||||
// Upgrade was already performed but the reported version is still not right.
|
||||
ESP_LOGE(TAG, "STM32 firmware upgrade already performed, but version is still incorrect");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->upgrade_firmware_()) {
|
||||
ESP_LOGW(TAG, "Failed to upgrade firmware");
|
||||
this->mark_failed();
|
||||
return;
|
||||
}
|
||||
|
||||
// Firmware upgrade completed, do the checks again.
|
||||
continue;
|
||||
#else
|
||||
ESP_LOGW(TAG, "Firmware version mismatch, put 'update: true' in the yaml to flash an update.");
|
||||
this->mark_failed();
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->handle_firmware();
|
||||
|
||||
this->send_settings_();
|
||||
// Do an immediate poll to refresh current state.
|
||||
|
||||
@@ -20,6 +20,8 @@ class ShellyDimmer : public PollingComponent, public light::LightOutput, public
|
||||
public:
|
||||
float get_setup_priority() const override { return setup_priority::LATE; }
|
||||
|
||||
bool is_running_configured_version() const;
|
||||
void handle_firmware();
|
||||
void setup() override;
|
||||
void update() override;
|
||||
void dump_config() override;
|
||||
|
||||
@@ -18,8 +18,8 @@ void Touchscreen::attach_interrupt_(InternalGPIOPin *irq_pin, esphome::gpio::Int
|
||||
|
||||
void Touchscreen::call_setup() {
|
||||
if (this->display_ != nullptr) {
|
||||
this->display_width_ = this->display_->get_native_width();
|
||||
this->display_height_ = this->display_->get_native_height();
|
||||
this->display_width_ = this->display_->get_width();
|
||||
this->display_height_ = this->display_->get_height();
|
||||
}
|
||||
PollingComponent::call_setup();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ static const size_t SEND_BUFFER_SIZE = INPUT_BUFFER_SIZE * sizeof(int16_t);
|
||||
static const size_t RECEIVE_SIZE = 1024;
|
||||
static const size_t SPEAKER_BUFFER_SIZE = 16 * RECEIVE_SIZE;
|
||||
|
||||
VoiceAssistant::VoiceAssistant() { global_voice_assistant = this; }
|
||||
|
||||
float VoiceAssistant::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; }
|
||||
|
||||
bool VoiceAssistant::start_udp_socket_() {
|
||||
@@ -68,12 +70,6 @@ bool VoiceAssistant::start_udp_socket_() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void VoiceAssistant::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Voice Assistant...");
|
||||
|
||||
global_voice_assistant = this;
|
||||
}
|
||||
|
||||
bool VoiceAssistant::allocate_buffers_() {
|
||||
if (this->send_buffer_ != nullptr) {
|
||||
return true; // Already allocated
|
||||
|
||||
@@ -91,7 +91,8 @@ struct Configuration {
|
||||
|
||||
class VoiceAssistant : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
VoiceAssistant();
|
||||
|
||||
void loop() override;
|
||||
float get_setup_priority() const override;
|
||||
void start_streaming();
|
||||
|
||||
@@ -1443,7 +1443,7 @@ void WebServer::on_event(event::Event *obj, const std::string &event_type) {
|
||||
}
|
||||
|
||||
std::string WebServer::event_json(event::Event *obj, const std::string &event_type, JsonDetail start_config) {
|
||||
return json::build_json([obj, event_type, start_config](JsonObject root) {
|
||||
return json::build_json([this, obj, event_type, start_config](JsonObject root) {
|
||||
set_json_id(root, obj, "event-" + obj->get_object_id(), start_config);
|
||||
if (!event_type.empty()) {
|
||||
root["event_type"] = event_type;
|
||||
@@ -1454,6 +1454,12 @@ std::string WebServer::event_json(event::Event *obj, const std::string &event_ty
|
||||
event_types.add(event_type);
|
||||
}
|
||||
root["device_class"] = obj->get_device_class();
|
||||
if (this->sorting_entitys_.find(obj) != this->sorting_entitys_.end()) {
|
||||
root["sorting_weight"] = this->sorting_entitys_[obj].weight;
|
||||
if (this->sorting_groups_.find(this->sorting_entitys_[obj].group_id) != this->sorting_groups_.end()) {
|
||||
root["sorting_group"] = this->sorting_groups_[this->sorting_entitys_[obj].group_id].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -34,6 +34,11 @@ static esp_netif_t *s_ap_netif = nullptr; // NOLINT(cppcoreguidelines-avoid-non
|
||||
static bool s_sta_connecting = false; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
void WiFiComponent::wifi_pre_setup_() {
|
||||
uint8_t mac[6];
|
||||
if (has_custom_mac_address()) {
|
||||
get_mac_address_raw(mac);
|
||||
set_mac_address(mac);
|
||||
}
|
||||
auto f = std::bind(&WiFiComponent::wifi_event_callback_, this, std::placeholders::_1, std::placeholders::_2);
|
||||
WiFi.onEvent(f);
|
||||
WiFi.persistent(false);
|
||||
|
||||
@@ -782,7 +782,7 @@ def validate_config(
|
||||
from esphome.components import substitutions
|
||||
|
||||
result[CONF_SUBSTITUTIONS] = {
|
||||
**config.get(CONF_SUBSTITUTIONS, {}),
|
||||
**(config.get(CONF_SUBSTITUTIONS) or {}),
|
||||
**command_line_substitutions,
|
||||
}
|
||||
result.add_output_path([CONF_SUBSTITUTIONS], CONF_SUBSTITUTIONS)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Constants used by esphome."""
|
||||
|
||||
__version__ = "2024.10.0b1"
|
||||
__version__ = "2024.10.1"
|
||||
|
||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
VALID_SUBSTITUTIONS_CHARACTERS = (
|
||||
|
||||
@@ -318,6 +318,8 @@ async def add_includes(includes):
|
||||
async def _add_platformio_options(pio_options):
|
||||
# Add includes at the very end, so that they override everything
|
||||
for key, val in pio_options.items():
|
||||
if key == "build_flags" and not isinstance(val, list):
|
||||
val = [val]
|
||||
cg.add_platformio_option(key, val)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user