diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 3bf9c4e1f6..5703d39be1 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -7,11 +7,16 @@
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
+- [ ] Code quality improvements to existing code or addition of tests
- [ ] Other
-**Related issue or feature (if applicable):** fixes
+**Related issue or feature (if applicable):**
-**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs#
+- fixes
+
+**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):**
+
+- esphome/esphome-docs#
## Test Environment
@@ -23,12 +28,6 @@
- [ ] RTL87xx
## Example entry for `config.yaml`:
-
```yaml
# Example config.yaml
diff --git a/.github/actions/restore-python/action.yml b/.github/actions/restore-python/action.yml
index 1f5812691e..c6978f68c5 100644
--- a/.github/actions/restore-python/action.yml
+++ b/.github/actions/restore-python/action.yml
@@ -22,7 +22,7 @@ runs:
python-version: ${{ inputs.python-version }}
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache/restore@v4.1.1
+ uses: actions/cache/restore@v4.1.2
with:
path: venv
# yamllint disable-line rule:line-length
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7f5b291299..93be2ff2cc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -46,7 +46,7 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore Python virtual environment
id: cache-venv
- uses: actions/cache@v4.1.1
+ uses: actions/cache@v4.1.2
with:
path: venv
# yamllint disable-line rule:line-length
@@ -306,14 +306,14 @@ jobs:
- name: Cache platformio
if: github.ref == 'refs/heads/dev'
- uses: actions/cache@v4.1.1
+ uses: actions/cache@v4.1.2
with:
path: ~/.platformio
key: platformio-${{ matrix.pio_cache_key }}
- name: Cache platformio
if: github.ref != 'refs/heads/dev'
- uses: actions/cache/restore@v4.1.1
+ uses: actions/cache/restore@v4.1.2
with:
path: ~/.platformio
key: platformio-${{ matrix.pio_cache_key }}
diff --git a/CODEOWNERS b/CODEOWNERS
index 0a998c03a5..dda62a9a69 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -198,10 +198,11 @@ esphome/components/htu31d/* @betterengineering
esphome/components/hydreon_rgxx/* @functionpointer
esphome/components/hyt271/* @Philippe12
esphome/components/i2c/* @esphome/core
+esphome/components/i2c_device/* @gabest11
esphome/components/i2s_audio/* @jesserockz
esphome/components/i2s_audio/media_player/* @jesserockz
esphome/components/i2s_audio/microphone/* @jesserockz
-esphome/components/i2s_audio/speaker/* @jesserockz
+esphome/components/i2s_audio/speaker/* @jesserockz @kahrendt
esphome/components/iaqcore/* @yozik04
esphome/components/ili9xxx/* @clydebarrow @nielsnl68
esphome/components/improv_base/* @esphome/core
@@ -377,7 +378,7 @@ esphome/components/smt100/* @piechade
esphome/components/sn74hc165/* @jesserockz
esphome/components/socket/* @esphome/core
esphome/components/sonoff_d1/* @anatoly-savchenkov
-esphome/components/speaker/* @jesserockz
+esphome/components/speaker/* @jesserockz @kahrendt
esphome/components/spi/* @clydebarrow @esphome/core
esphome/components/spi_device/* @clydebarrow
esphome/components/spi_led_strip/* @clydebarrow
diff --git a/esphome/components/ble_rssi/sensor.py b/esphome/components/ble_rssi/sensor.py
index e3ba1abfd7..c4e767aa21 100644
--- a/esphome/components/ble_rssi/sensor.py
+++ b/esphome/components/ble_rssi/sensor.py
@@ -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:
diff --git a/esphome/components/bme68x_bsec2/__init__.py b/esphome/components/bme68x_bsec2/__init__.py
index 1930c7c9e3..d6dbb52f18 100644
--- a/esphome/components/bme68x_bsec2/__init__.py
+++ b/esphome/components/bme68x_bsec2/__init__.py
@@ -16,7 +16,7 @@ CODEOWNERS = ["@neffs", "@kbx81"]
DOMAIN = "bme68x_bsec2"
-BSEC2_LIBRARY_VERSION = "v1.7.2502"
+BSEC2_LIBRARY_VERSION = "v1.8.2610"
CONF_ALGORITHM_OUTPUT = "algorithm_output"
CONF_BME68X_BSEC2_ID = "bme68x_bsec2_id"
diff --git a/esphome/components/esp32/__init__.py b/esphome/components/esp32/__init__.py
index 8a73f2020d..61fbb53e3a 100644
--- a/esphome/components/esp32/__init__.py
+++ b/esphome/components/esp32/__init__.py
@@ -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):
diff --git a/esphome/components/esp32/boards.py b/esphome/components/esp32/boards.py
index 60abcd447c..02744ecb6f 100644
--- a/esphome/components/esp32/boards.py
+++ b/esphome/components/esp32/boards.py
@@ -103,6 +103,173 @@ ESP32_BOARD_PINS = {
"LED": 13,
"LED_BUILTIN": 13,
},
+ "adafruit_feather_esp32s3": {
+ "BUTTON": 0,
+ "A0": 18,
+ "A1": 17,
+ "A2": 16,
+ "A3": 15,
+ "A4": 14,
+ "A5": 8,
+ "SCK": 36,
+ "MOSI": 35,
+ "MISO": 37,
+ "RX": 38,
+ "TX": 39,
+ "SCL": 4,
+ "SDA": 3,
+ "NEOPIXEL": 33,
+ "PIN_NEOPIXEL": 33,
+ "NEOPIXEL_POWER": 21,
+ "I2C_POWER": 7,
+ "LED": 13,
+ "LED_BUILTIN": 13,
+ },
+ "adafruit_feather_esp32s3_nopsram": {
+ "BUTTON": 0,
+ "A0": 18,
+ "A1": 17,
+ "A2": 16,
+ "A3": 15,
+ "A4": 14,
+ "A5": 8,
+ "SCK": 36,
+ "MOSI": 35,
+ "MISO": 37,
+ "RX": 38,
+ "TX": 39,
+ "SCL": 4,
+ "SDA": 3,
+ "NEOPIXEL": 33,
+ "PIN_NEOPIXEL": 33,
+ "NEOPIXEL_POWER": 21,
+ "I2C_POWER": 7,
+ "LED": 13,
+ "LED_BUILTIN": 13,
+ },
+ "adafruit_feather_esp32s3_tft": {
+ "BUTTON": 0,
+ "A0": 18,
+ "A1": 17,
+ "A2": 16,
+ "A3": 15,
+ "A4": 14,
+ "A5": 8,
+ "SCK": 36,
+ "MOSI": 35,
+ "MISO": 37,
+ "RX": 2,
+ "TX": 1,
+ "SCL": 41,
+ "SDA": 42,
+ "NEOPIXEL": 33,
+ "PIN_NEOPIXEL": 33,
+ "NEOPIXEL_POWER": 34,
+ "TFT_I2C_POWER": 21,
+ "TFT_CS": 7,
+ "TFT_DC": 39,
+ "TFT_RESET": 40,
+ "TFT_BACKLIGHT": 45,
+ "LED": 13,
+ "LED_BUILTIN": 13,
+ },
+ "adafruit_funhouse_esp32s2": {
+ "BUTTON_UP": 5,
+ "BUTTON_DOWN": 3,
+ "BUTTON_SELECT": 4,
+ "DOTSTAR_DATA": 14,
+ "DOTSTAR_CLOCK": 15,
+ "PIR_SENSE": 16,
+ "A0": 17,
+ "A1": 2,
+ "A2": 1,
+ "CAP6": 6,
+ "CAP7": 7,
+ "CAP8": 8,
+ "CAP9": 9,
+ "CAP10": 10,
+ "CAP11": 11,
+ "CAP12": 12,
+ "CAP13": 13,
+ "SPEAKER": 42,
+ "LED": 37,
+ "LIGHT": 18,
+ "TFT_MOSI": 35,
+ "TFT_SCK": 36,
+ "TFT_CS": 40,
+ "TFT_DC": 39,
+ "TFT_RESET": 41,
+ "TFT_BACKLIGHT": 21,
+ "RED_LED": 31,
+ "BUTTON": 0,
+ },
+ "adafruit_itsybitsy_esp32": {
+ "A0": 25,
+ "A1": 26,
+ "A2": 4,
+ "A3": 38,
+ "A4": 37,
+ "A5": 36,
+ "SCK": 19,
+ "MOSI": 21,
+ "MISO": 22,
+ "SCL": 27,
+ "SDA": 15,
+ "TX": 20,
+ "RX": 8,
+ "NEOPIXEL": 0,
+ "PIN_NEOPIXEL": 0,
+ "NEOPIXEL_POWER": 2,
+ "BUTTON": 35,
+ },
+ "adafruit_magtag29_esp32s2": {
+ "A1": 18,
+ "BUTTON_A": 15,
+ "BUTTON_B": 14,
+ "BUTTON_C": 12,
+ "BUTTON_D": 11,
+ "SDA": 33,
+ "SCL": 34,
+ "SPEAKER": 17,
+ "SPEAKER_ENABLE": 16,
+ "VOLTAGE_MONITOR": 4,
+ "ACCELEROMETER_INT": 9,
+ "ACCELEROMETER_INTERRUPT": 9,
+ "LIGHT": 3,
+ "NEOPIXEL": 1,
+ "PIN_NEOPIXEL": 1,
+ "NEOPIXEL_POWER": 21,
+ "EPD_BUSY": 5,
+ "EPD_RESET": 6,
+ "EPD_DC": 7,
+ "EPD_CS": 8,
+ "EPD_MOSI": 35,
+ "EPD_SCK": 36,
+ "EPD_MISO": 37,
+ "BUTTON": 0,
+ "LED": 13,
+ "LED_BUILTIN": 13,
+ },
+ "adafruit_metro_esp32s2": {
+ "A0": 17,
+ "A1": 18,
+ "A2": 1,
+ "A3": 2,
+ "A4": 3,
+ "A5": 4,
+ "RX": 38,
+ "TX": 37,
+ "SCL": 34,
+ "SDA": 33,
+ "MISO": 37,
+ "SCK": 36,
+ "MOSI": 35,
+ "NEOPIXEL": 45,
+ "PIN_NEOPIXEL": 45,
+ "LED": 42,
+ "LED_BUILTIN": 42,
+ "BUTTON": 0,
+ },
"adafruit_qtpy_esp32c3": {
"A0": 4,
"A1": 3,
@@ -141,6 +308,26 @@ ESP32_BOARD_PINS = {
"BUTTON": 0,
"SWITCH": 0,
},
+ "adafruit_qtpy_esp32s3_nopsram": {
+ "A0": 18,
+ "A1": 17,
+ "A2": 9,
+ "A3": 8,
+ "SDA": 7,
+ "SCL": 6,
+ "MOSI": 35,
+ "MISO": 37,
+ "SCK": 36,
+ "RX": 16,
+ "TX": 5,
+ "SDA1": 41,
+ "SCL1": 40,
+ "NEOPIXEL": 39,
+ "PIN_NEOPIXEL": 39,
+ "NEOPIXEL_POWER": 38,
+ "BUTTON": 0,
+ "SWITCH": 0,
+ },
"adafruit_qtpy_esp32": {
"A0": 26,
"A1": 25,
@@ -1068,7 +1255,18 @@ ESP32_BOARD_PINS = {
"_VBAT": 35,
},
"wemosbat": {"LED": 16},
- "wesp32": {"MISO": 32, "SCL": 4, "SDA": 15},
+ "wesp32": {
+ "MISO": 32,
+ "MOSI": 23,
+ "SCK": 18,
+ "SCL": 4,
+ "SDA": 15,
+ "MISO1": 12,
+ "MOSI1": 13,
+ "SCK1": 14,
+ "SCL1": 5,
+ "SDA1": 33,
+ },
"widora-air": {
"A1": 39,
"A2": 35,
diff --git a/esphome/components/host/__init__.py b/esphome/components/host/__init__.py
index e83bf2dba8..eb8cfbd984 100644
--- a/esphome/components/host/__init__.py
+++ b/esphome/components/host/__init__.py
@@ -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):
diff --git a/esphome/components/i2c_device/__init__.py b/esphome/components/i2c_device/__init__.py
new file mode 100644
index 0000000000..e145ba56f8
--- /dev/null
+++ b/esphome/components/i2c_device/__init__.py
@@ -0,0 +1,26 @@
+import esphome.codegen as cg
+import esphome.config_validation as cv
+from esphome.components import i2c
+from esphome.const import CONF_ID
+
+DEPENDENCIES = ["i2c"]
+CODEOWNERS = ["@gabest11"]
+MULTI_CONF = True
+
+i2c_device_ns = cg.esphome_ns.namespace("i2c_device")
+
+I2CDeviceComponent = i2c_device_ns.class_(
+ "I2CDeviceComponent", cg.Component, i2c.I2CDevice
+)
+
+CONFIG_SCHEMA = cv.Schema(
+ {
+ cv.GenerateID(CONF_ID): cv.declare_id(I2CDeviceComponent),
+ }
+).extend(i2c.i2c_device_schema(None))
+
+
+async def to_code(config):
+ var = cg.new_Pvariable(config[CONF_ID])
+ await cg.register_component(var, config)
+ await i2c.register_i2c_device(var, config)
diff --git a/esphome/components/i2c_device/i2c_device.cpp b/esphome/components/i2c_device/i2c_device.cpp
new file mode 100644
index 0000000000..455c68fbed
--- /dev/null
+++ b/esphome/components/i2c_device/i2c_device.cpp
@@ -0,0 +1,17 @@
+#include "i2c_device.h"
+#include "esphome/core/log.h"
+#include "esphome/core/hal.h"
+#include
+
+namespace esphome {
+namespace i2c_device {
+
+static const char *const TAG = "i2c_device";
+
+void I2CDeviceComponent::dump_config() {
+ ESP_LOGCONFIG(TAG, "I2CDevice");
+ LOG_I2C_DEVICE(this);
+}
+
+} // namespace i2c_device
+} // namespace esphome
diff --git a/esphome/components/i2c_device/i2c_device.h b/esphome/components/i2c_device/i2c_device.h
new file mode 100644
index 0000000000..ab118e3e89
--- /dev/null
+++ b/esphome/components/i2c_device/i2c_device.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "esphome/core/component.h"
+#include "esphome/components/i2c/i2c.h"
+
+namespace esphome {
+namespace i2c_device {
+
+class I2CDeviceComponent : public Component, public i2c::I2CDevice {
+ public:
+ void dump_config() override;
+ float get_setup_priority() const override { return setup_priority::DATA; }
+
+ protected:
+};
+
+} // namespace i2c_device
+} // namespace esphome
diff --git a/esphome/components/i2s_audio/speaker/__init__.py b/esphome/components/i2s_audio/speaker/__init__.py
index 9fdaced64c..dd43d6cb39 100644
--- a/esphome/components/i2s_audio/speaker/__init__.py
+++ b/esphome/components/i2s_audio/speaker/__init__.py
@@ -17,7 +17,7 @@ from .. import (
)
AUTO_LOAD = ["audio"]
-CODEOWNERS = ["@jesserockz"]
+CODEOWNERS = ["@jesserockz", "@kahrendt"]
DEPENDENCIES = ["i2s_audio"]
I2SAudioSpeaker = i2s_audio_ns.class_(
diff --git a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp
index 4fc489d0a3..cf6c3bbbba 100644
--- a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp
+++ b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp
@@ -32,6 +32,7 @@ enum SpeakerEventGroupBits : uint32_t {
STATE_RUNNING = (1 << 11),
STATE_STOPPING = (1 << 12),
STATE_STOPPED = (1 << 13),
+ ERR_INVALID_FORMAT = (1 << 14),
ERR_TASK_FAILED_TO_START = (1 << 15),
ERR_ESP_INVALID_STATE = (1 << 16),
ERR_ESP_INVALID_ARG = (1 << 17),
@@ -104,16 +105,6 @@ void I2SAudioSpeaker::setup() {
void I2SAudioSpeaker::loop() {
uint32_t event_group_bits = xEventGroupGetBits(this->event_group_);
- if (event_group_bits & SpeakerEventGroupBits::ERR_TASK_FAILED_TO_START) {
- this->status_set_error("Failed to start speaker task");
- }
-
- if (event_group_bits & SpeakerEventGroupBits::ALL_ERR_ESP_BITS) {
- uint32_t error_bits = event_group_bits & SpeakerEventGroupBits::ALL_ERR_ESP_BITS;
- ESP_LOGW(TAG, "Error writing to I2S: %s", esp_err_to_name(err_bit_to_esp_err(error_bits)));
- this->status_set_warning();
- }
-
if (event_group_bits & SpeakerEventGroupBits::STATE_STARTING) {
ESP_LOGD(TAG, "Starting Speaker");
this->state_ = speaker::STATE_STARTING;
@@ -139,12 +130,64 @@ void I2SAudioSpeaker::loop() {
this->speaker_task_handle_ = nullptr;
}
}
+
+ if (event_group_bits & SpeakerEventGroupBits::ERR_TASK_FAILED_TO_START) {
+ this->status_set_error("Failed to start speaker task");
+ xEventGroupClearBits(this->event_group_, SpeakerEventGroupBits::ERR_TASK_FAILED_TO_START);
+ }
+
+ if (event_group_bits & SpeakerEventGroupBits::ERR_INVALID_FORMAT) {
+ this->status_set_error("Failed to adjust I2S bus to match the incoming audio");
+ ESP_LOGE(TAG,
+ "Incompatible audio format: sample rate = %" PRIu32 ", channels = %" PRIu8 ", bits per sample = %" PRIu8,
+ this->audio_stream_info_.sample_rate, this->audio_stream_info_.channels,
+ this->audio_stream_info_.bits_per_sample);
+ }
+
+ if (event_group_bits & SpeakerEventGroupBits::ALL_ERR_ESP_BITS) {
+ uint32_t error_bits = event_group_bits & SpeakerEventGroupBits::ALL_ERR_ESP_BITS;
+ ESP_LOGW(TAG, "Error writing to I2S: %s", esp_err_to_name(err_bit_to_esp_err(error_bits)));
+ this->status_set_warning();
+ }
}
void I2SAudioSpeaker::set_volume(float volume) {
this->volume_ = volume;
- ssize_t decibel_index = remap(volume, 0.0f, 1.0f, 0, Q15_VOLUME_SCALING_FACTORS.size() - 1);
- this->q15_volume_factor_ = Q15_VOLUME_SCALING_FACTORS[decibel_index];
+#ifdef USE_AUDIO_DAC
+ if (this->audio_dac_ != nullptr) {
+ if (volume > 0.0) {
+ this->audio_dac_->set_mute_off();
+ }
+ this->audio_dac_->set_volume(volume);
+ } else
+#endif
+ {
+ // Fallback to software volume control by using a Q15 fixed point scaling factor
+ ssize_t decibel_index = remap(volume, 0.0f, 1.0f, 0, Q15_VOLUME_SCALING_FACTORS.size() - 1);
+ this->q15_volume_factor_ = Q15_VOLUME_SCALING_FACTORS[decibel_index];
+ }
+}
+
+void I2SAudioSpeaker::set_mute_state(bool mute_state) {
+ this->mute_state_ = mute_state;
+#ifdef USE_AUDIO_DAC
+ if (this->audio_dac_) {
+ if (mute_state) {
+ this->audio_dac_->set_mute_on();
+ } else {
+ this->audio_dac_->set_mute_off();
+ }
+ } else
+#endif
+ {
+ if (mute_state) {
+ // Fallback to software volume control and scale by 0
+ this->q15_volume_factor_ = 0;
+ } else {
+ // Revert to previous volume when unmuting
+ this->set_volume(this->volume_);
+ }
+ }
}
size_t I2SAudioSpeaker::play(const uint8_t *data, size_t length, TickType_t ticks_to_wait) {
@@ -275,6 +318,9 @@ void I2SAudioSpeaker::speaker_task(void *params) {
i2s_zero_dma_buffer(this_speaker->parent_->get_port());
}
}
+ } else {
+ // Couldn't configure the I2S port to be compatible with the incoming audio
+ xEventGroupSetBits(this_speaker->event_group_, SpeakerEventGroupBits::ERR_INVALID_FORMAT);
}
i2s_zero_dma_buffer(this_speaker->parent_->get_port());
@@ -288,7 +334,7 @@ void I2SAudioSpeaker::speaker_task(void *params) {
}
void I2SAudioSpeaker::start() {
- if (this->is_failed())
+ if (this->is_failed() || this->status_has_error())
return;
if ((this->state_ == speaker::STATE_STARTING) || (this->state_ == speaker::STATE_RUNNING))
return;
diff --git a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h
index 245f97d1e7..3c512d4d4d 100644
--- a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h
+++ b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.h
@@ -49,11 +49,17 @@ class I2SAudioSpeaker : public I2SAudioOut, public speaker::Speaker, public Comp
bool has_buffered_data() const override;
- /// @brief Sets the volume of the speaker. It is implemented as a software volume control.
- /// Overrides the default setter to convert the floating point volume to a Q15 fixed-point factor.
- /// @param volume
+ /// @brief Sets the volume of the speaker. Uses the speaker's configured audio dac component. If unavailble, it is
+ /// implemented as a software volume control. Overrides the default setter to convert the floating point volume to a
+ /// Q15 fixed-point factor.
+ /// @param volume between 0.0 and 1.0
void set_volume(float volume) override;
- float get_volume() override { return this->volume_; }
+
+ /// @brief Mutes or unmute the speaker. Uses the speaker's configured audio dac component. If unavailble, it is
+ /// implemented as a software volume control. Overrides the default setter to convert the floating point volume to a
+ /// Q15 fixed-point factor.
+ /// @param mute_state true for muting, false for unmuting
+ void set_mute_state(bool mute_state) override;
protected:
/// @brief Function for the FreeRTOS task handling audio output.
diff --git a/esphome/components/image/image.h b/esphome/components/image/image.h
index ae5a7a814d..a8a8aab2c2 100644
--- a/esphome/components/image/image.h
+++ b/esphome/components/image/image.h
@@ -3,12 +3,7 @@
#include "esphome/components/display/display.h"
#ifdef USE_LVGL
-// required for clang-tidy
-#ifndef LV_CONF_H
-#define LV_CONF_SKIP 1 // NOLINT
-#endif // LV_CONF_H
-
-#include
+#include "esphome/components/lvgl/lvgl_proxy.h"
#endif // USE_LVGL
namespace esphome {
diff --git a/esphome/components/libretiny/__init__.py b/esphome/components/libretiny/__init__.py
index cc7fae7e70..b29d2e309c 100644
--- a/esphome/components/libretiny/__init__.py
+++ b/esphome/components/libretiny/__init__.py
@@ -46,7 +46,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
CODEOWNERS = ["@kuba2k2"]
-AUTO_LOAD = []
+AUTO_LOAD = ["preferences"]
def _detect_variant(value):
diff --git a/esphome/components/lvgl/__init__.py b/esphome/components/lvgl/__init__.py
index beaf279a9a..215fdecdb5 100644
--- a/esphome/components/lvgl/__init__.py
+++ b/esphome/components/lvgl/__init__.py
@@ -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,
@@ -342,7 +342,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,
diff --git a/esphome/components/lvgl/light/__init__.py b/esphome/components/lvgl/light/__init__.py
index a0eeded349..8031ae8221 100644
--- a/esphome/components/lvgl/light/__init__.py
+++ b/esphome/components/lvgl/light/__init__.py
@@ -2,9 +2,9 @@ import esphome.codegen as cg
from esphome.components import light
from esphome.components.light import LightOutput
import esphome.config_validation as cv
-from esphome.const import CONF_GAMMA_CORRECT, CONF_LED, CONF_OUTPUT_ID
+from esphome.const import CONF_GAMMA_CORRECT, CONF_OUTPUT_ID
-from ..defines import CONF_LVGL_ID
+from ..defines import CONF_LVGL_ID, CONF_WIDGET
from ..lvcode import LvContext
from ..schemas import LVGL_SCHEMA
from ..types import LvType, lvgl_ns
@@ -15,7 +15,7 @@ LVLight = lvgl_ns.class_("LVLight", LightOutput)
CONFIG_SCHEMA = light.RGB_LIGHT_SCHEMA.extend(
{
cv.Optional(CONF_GAMMA_CORRECT, default=0.0): cv.positive_float,
- cv.Required(CONF_LED): cv.use_id(lv_led_t),
+ cv.Required(CONF_WIDGET): cv.use_id(lv_led_t),
cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(LVLight),
}
).extend(LVGL_SCHEMA)
@@ -26,7 +26,7 @@ async def to_code(config):
await light.register_light(var, config)
paren = await cg.get_variable(config[CONF_LVGL_ID])
- widget = await get_widgets(config, CONF_LED)
+ widget = await get_widgets(config, CONF_WIDGET)
widget = widget[0]
await wait_for_widgets()
async with LvContext(paren) as ctx:
diff --git a/esphome/components/lvgl/lv_validation.py b/esphome/components/lvgl/lv_validation.py
index fd840cc417..b91b0905df 100644
--- a/esphome/components/lvgl/lv_validation.py
+++ b/esphome/components/lvgl/lv_validation.py
@@ -267,6 +267,9 @@ def angle(value):
return int(cv.float_range(0.0, 360.0)(cv.angle(value)) * 10)
+lv_angle = LValidator(angle, uint32)
+
+
@schema_extractor("one_of")
def size_validator(value):
"""A size in one axis - one of "size_content", a number (pixels) or a percentage"""
@@ -274,10 +277,8 @@ def size_validator(value):
return ["SIZE_CONTENT", "number of pixels", "percentage"]
if isinstance(value, str) and value.lower().endswith("px"):
value = cv.int_(value[:-2])
- if isinstance(value, str) and not value.endswith("%"):
- if value.upper() == "SIZE_CONTENT":
- return "LV_SIZE_CONTENT"
- raise cv.Invalid("must be 'size_content', a percentage or an integer (pixels)")
+ if isinstance(value, str) and value.upper() == "SIZE_CONTENT":
+ return "LV_SIZE_CONTENT"
return pixels_or_percent_validator(value)
@@ -403,6 +404,7 @@ class TextValidator(LValidator):
lv_text = TextValidator()
lv_float = LValidator(cv.float_, cg.float_)
lv_int = LValidator(cv.int_, cg.int_)
+lv_positive_int = LValidator(cv.positive_int, cg.int_)
lv_brightness = LValidator(cv.percentage, cg.float_, retmapper=lambda x: int(x * 255))
diff --git a/esphome/components/lvgl/lvgl_esphome.cpp b/esphome/components/lvgl/lvgl_esphome.cpp
index 413b039af0..70cfb859de 100644
--- a/esphome/components/lvgl/lvgl_esphome.cpp
+++ b/esphome/components/lvgl/lvgl_esphome.cpp
@@ -84,6 +84,7 @@ lv_event_code_t lv_api_event; // NOLINT
lv_event_code_t lv_update_event; // NOLINT
void LvglComponent::dump_config() {
ESP_LOGCONFIG(TAG, "LVGL:");
+ ESP_LOGCONFIG(TAG, " Display width/height: %d x %d", this->disp_drv_.hor_res, this->disp_drv_.ver_res);
ESP_LOGCONFIG(TAG, " Rotation: %d", this->rotation);
ESP_LOGCONFIG(TAG, " Draw rounding: %d", (int) this->draw_rounding);
}
@@ -145,7 +146,7 @@ void LvglComponent::draw_buffer_(const lv_area_t *area, lv_color_t *ptr) {
lv_color_t *dst = this->rotate_buf_;
switch (this->rotation) {
case display::DISPLAY_ROTATION_90_DEGREES:
- for (lv_coord_t x = height - 1; x-- != 0;) {
+ for (lv_coord_t x = height; x-- != 0;) {
for (lv_coord_t y = 0; y != width; y++) {
dst[y * height + x] = *ptr++;
}
@@ -426,19 +427,8 @@ LvglComponent::LvglComponent(std::vector displays, float buf
this->disp_drv_.full_refresh = this->full_refresh_;
this->disp_drv_.flush_cb = static_flush_cb;
this->disp_drv_.rounder_cb = rounder_cb;
- // reset the display rotation since we will handle all rotations
- display->set_rotation(display::DISPLAY_ROTATION_0_DEGREES);
- switch (this->rotation) {
- default:
- this->disp_drv_.hor_res = (lv_coord_t) display->get_width();
- this->disp_drv_.ver_res = (lv_coord_t) display->get_height();
- break;
- case display::DISPLAY_ROTATION_90_DEGREES:
- case display::DISPLAY_ROTATION_270_DEGREES:
- this->disp_drv_.ver_res = (lv_coord_t) display->get_width();
- this->disp_drv_.hor_res = (lv_coord_t) display->get_height();
- break;
- }
+ this->disp_drv_.hor_res = (lv_coord_t) display->get_width();
+ this->disp_drv_.ver_res = (lv_coord_t) display->get_height();
this->disp_ = lv_disp_drv_register(&this->disp_drv_);
}
@@ -459,6 +449,9 @@ void LvglComponent::setup() {
esp_log_printf_(LVGL_LOG_LEVEL, TAG, 0, "%.*s", (int) strlen(buf) - 1, buf);
});
#endif
+ // Rotation will be handled by our drawing function, so reset the display rotation.
+ for (auto *display : this->displays_)
+ display->set_rotation(display::DISPLAY_ROTATION_0_DEGREES);
this->show_page(0, LV_SCR_LOAD_ANIM_NONE, 0);
lv_disp_trig_activity(this->disp_);
ESP_LOGCONFIG(TAG, "LVGL Setup complete");
diff --git a/esphome/components/lvgl/lvgl_esphome.h b/esphome/components/lvgl/lvgl_esphome.h
index b8c0f5738e..f357c4950c 100644
--- a/esphome/components/lvgl/lvgl_esphome.h
+++ b/esphome/components/lvgl/lvgl_esphome.h
@@ -4,6 +4,9 @@
#ifdef USE_BINARY_SENSOR
#include "esphome/components/binary_sensor/binary_sensor.h"
#endif // USE_BINARY_SENSOR
+#ifdef USE_LVGL_IMAGE
+#include "esphome/components/image/image.h"
+#endif // USE_LVGL_IMAGE
#ifdef USE_LVGL_ROTARY_ENCODER
#include "esphome/components/rotary_encoder/rotary_encoder.h"
#endif // USE_LVGL_ROTARY_ENCODER
@@ -47,6 +50,14 @@ static const display::ColorBitness LV_BITNESS = display::ColorBitness::COLOR_BIT
static const display::ColorBitness LV_BITNESS = display::ColorBitness::COLOR_BITNESS_332;
#endif // LV_COLOR_DEPTH
+#ifdef USE_LVGL_IMAGE
+// Shortcut / overload, so that the source of an image can easily be updated
+// from within a lambda.
+inline void lv_img_set_src(lv_obj_t *obj, esphome::image::Image *image) {
+ lv_img_set_src(obj, image->get_lv_img_dsc());
+}
+#endif // USE_LVGL_IMAGE
+
// Parent class for things that wrap an LVGL object
class LvCompound {
public:
diff --git a/esphome/components/lvgl/lvgl_proxy.h b/esphome/components/lvgl/lvgl_proxy.h
new file mode 100644
index 0000000000..0ccd80e541
--- /dev/null
+++ b/esphome/components/lvgl/lvgl_proxy.h
@@ -0,0 +1,17 @@
+#pragma once
+/**
+* This header is for use in components that might or might not use LVGL. There is a platformio bug where
+the mere mention of a header file, even if ifdefed, causes the build to fail. This is a workaround, since if this
+file is included in the build, LVGL is always included.
+*/
+#ifdef USE_LVGL
+// required for clang-tidy
+#ifndef LV_CONF_H
+#define LV_CONF_SKIP 1 // NOLINT
+#endif // LV_CONF_H
+
+#include
+namespace esphome {
+namespace lvgl {} // namespace lvgl
+} // namespace esphome
+#endif // USE_LVGL
diff --git a/esphome/components/lvgl/schemas.py b/esphome/components/lvgl/schemas.py
index 7599d64416..bb14c11ddd 100644
--- a/esphome/components/lvgl/schemas.py
+++ b/esphome/components/lvgl/schemas.py
@@ -91,7 +91,7 @@ STYLE_PROPS = {
"arc_opa": lvalid.opacity,
"arc_color": lvalid.lv_color,
"arc_rounded": lvalid.lv_bool,
- "arc_width": cv.positive_int,
+ "arc_width": lvalid.lv_positive_int,
"anim_time": lvalid.lv_milliseconds,
"bg_color": lvalid.lv_color,
"bg_grad": lv_gradient,
@@ -111,7 +111,7 @@ STYLE_PROPS = {
"border_side": df.LvConstant(
"LV_BORDER_SIDE_", "NONE", "TOP", "BOTTOM", "LEFT", "RIGHT", "INTERNAL"
).several_of,
- "border_width": cv.positive_int,
+ "border_width": lvalid.lv_positive_int,
"clip_corner": lvalid.lv_bool,
"color_filter_opa": lvalid.opacity,
"height": lvalid.size,
@@ -134,11 +134,11 @@ STYLE_PROPS = {
"pad_right": lvalid.pixels,
"pad_top": lvalid.pixels,
"shadow_color": lvalid.lv_color,
- "shadow_ofs_x": cv.int_,
- "shadow_ofs_y": cv.int_,
+ "shadow_ofs_x": lvalid.lv_int,
+ "shadow_ofs_y": lvalid.lv_int,
"shadow_opa": lvalid.opacity,
- "shadow_spread": cv.int_,
- "shadow_width": cv.positive_int,
+ "shadow_spread": lvalid.lv_int,
+ "shadow_width": lvalid.lv_positive_int,
"text_align": df.LvConstant(
"LV_TEXT_ALIGN_", "LEFT", "CENTER", "RIGHT", "AUTO"
).one_of,
@@ -150,7 +150,7 @@ STYLE_PROPS = {
"text_letter_space": cv.positive_int,
"text_line_space": cv.positive_int,
"text_opa": lvalid.opacity,
- "transform_angle": lvalid.angle,
+ "transform_angle": lvalid.lv_angle,
"transform_height": lvalid.pixels_or_percent,
"transform_pivot_x": lvalid.pixels_or_percent,
"transform_pivot_y": lvalid.pixels_or_percent,
diff --git a/esphome/components/mqtt/__init__.py b/esphome/components/mqtt/__init__.py
index 336d928f71..8851581ea0 100644
--- a/esphome/components/mqtt/__init__.py
+++ b/esphome/components/mqtt/__init__.py
@@ -41,6 +41,7 @@ from esphome.const import (
CONF_SHUTDOWN_MESSAGE,
CONF_SSL_FINGERPRINTS,
CONF_STATE_TOPIC,
+ CONF_SUBSCRIBE_QOS,
CONF_TOPIC,
CONF_TOPIC_PREFIX,
CONF_TRIGGER_ID,
@@ -518,6 +519,8 @@ async def register_mqtt_component(var, config):
cg.add(var.set_qos(config[CONF_QOS]))
if CONF_RETAIN in config:
cg.add(var.set_retain(config[CONF_RETAIN]))
+ if CONF_SUBSCRIBE_QOS in config:
+ cg.add(var.set_subscribe_qos(config[CONF_SUBSCRIBE_QOS]))
if not config.get(CONF_DISCOVERY, True):
cg.add(var.disable_discovery())
if CONF_STATE_TOPIC in config:
diff --git a/esphome/components/mqtt/mqtt_component.cpp b/esphome/components/mqtt/mqtt_component.cpp
index 295fbba5e5..3b9d367a7b 100644
--- a/esphome/components/mqtt/mqtt_component.cpp
+++ b/esphome/components/mqtt/mqtt_component.cpp
@@ -16,6 +16,8 @@ static const char *const TAG = "mqtt.component";
void MQTTComponent::set_qos(uint8_t qos) { this->qos_ = qos; }
+void MQTTComponent::set_subscribe_qos(uint8_t qos) { this->subscribe_qos_ = qos; }
+
void MQTTComponent::set_retain(bool retain) { this->retain_ = retain; }
std::string MQTTComponent::get_discovery_topic_(const MQTTDiscoveryInfo &discovery_info) const {
@@ -76,6 +78,10 @@ bool MQTTComponent::send_discovery_() {
config.command_topic = true;
this->send_discovery(root, config);
+ // Set subscription QoS (default is 0)
+ if (this->subscribe_qos_ != 0) {
+ root[MQTT_QOS] = this->subscribe_qos_;
+ }
// Fields from EntityBase
if (this->get_entity()->has_own_name()) {
diff --git a/esphome/components/mqtt/mqtt_component.h b/esphome/components/mqtt/mqtt_component.h
index 147840d11f..01ba98ad40 100644
--- a/esphome/components/mqtt/mqtt_component.h
+++ b/esphome/components/mqtt/mqtt_component.h
@@ -89,6 +89,9 @@ class MQTTComponent : public Component {
void disable_discovery();
bool is_discovery_enabled() const;
+ /// Set the QOS for subscribe messages (used in discovery).
+ void set_subscribe_qos(uint8_t qos);
+
/// Override this method to return the component type (e.g. "light", "sensor", ...)
virtual std::string component_type() const = 0;
@@ -204,6 +207,7 @@ class MQTTComponent : public Component {
bool command_retain_{false};
bool retain_{true};
uint8_t qos_{0};
+ uint8_t subscribe_qos_{0};
bool discovery_enabled_{true};
bool resend_state_{false};
};
diff --git a/esphome/components/mqtt/mqtt_const.h b/esphome/components/mqtt/mqtt_const.h
index 71f169fbe8..c1c40c4b6d 100644
--- a/esphome/components/mqtt/mqtt_const.h
+++ b/esphome/components/mqtt/mqtt_const.h
@@ -180,6 +180,7 @@ constexpr const char *const MQTT_PRESET_MODE_COMMAND_TOPIC = "pr_mode_cmd_t";
constexpr const char *const MQTT_PRESET_MODE_STATE_TOPIC = "pr_mode_stat_t";
constexpr const char *const MQTT_PRESET_MODE_VALUE_TEMPLATE = "pr_mode_val_tpl";
constexpr const char *const MQTT_PRESET_MODES = "pr_modes";
+constexpr const char *const MQTT_QOS = "qos";
constexpr const char *const MQTT_RED_TEMPLATE = "r_tpl";
constexpr const char *const MQTT_RETAIN = "ret";
constexpr const char *const MQTT_RGB_COMMAND_TEMPLATE = "rgb_cmd_tpl";
@@ -441,6 +442,7 @@ constexpr const char *const MQTT_PRESET_MODE_COMMAND_TOPIC = "preset_mode_comman
constexpr const char *const MQTT_PRESET_MODE_STATE_TOPIC = "preset_mode_state_topic";
constexpr const char *const MQTT_PRESET_MODE_VALUE_TEMPLATE = "preset_mode_value_template";
constexpr const char *const MQTT_PRESET_MODES = "preset_modes";
+constexpr const char *const MQTT_QOS = "qos";
constexpr const char *const MQTT_RED_TEMPLATE = "red_template";
constexpr const char *const MQTT_RETAIN = "retain";
constexpr const char *const MQTT_RGB_COMMAND_TEMPLATE = "rgb_command_template";
diff --git a/esphome/components/rp2040/__init__.py b/esphome/components/rp2040/__init__.py
index 925acb629d..d612631a4c 100644
--- a/esphome/components/rp2040/__init__.py
+++ b/esphome/components/rp2040/__init__.py
@@ -17,7 +17,7 @@ from esphome.const import (
PLATFORM_RP2040,
)
from esphome.core import CORE, EsphomeError, coroutine_with_priority
-from esphome.helpers import copy_file_if_changed, mkdir_p, write_file
+from esphome.helpers import copy_file_if_changed, mkdir_p, write_file, read_file
from .const import KEY_BOARD, KEY_PIO_FILES, KEY_RP2040, rp2040_ns
@@ -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):
@@ -230,11 +230,14 @@ def generate_pio_files() -> bool:
# Called by writer.py
-def copy_files() -> bool:
+def copy_files():
dir = os.path.dirname(__file__)
post_build_file = os.path.join(dir, "post_build.py.script")
copy_file_if_changed(
post_build_file,
CORE.relative_build_path("post_build.py"),
)
- return generate_pio_files()
+ if generate_pio_files():
+ path = CORE.relative_src_path("esphome.h")
+ content = read_file(path).rstrip("\n")
+ write_file(path, content + '\n#include "pio_includes.h"\n')
diff --git a/esphome/components/rtttl/rtttl.cpp b/esphome/components/rtttl/rtttl.cpp
index 495b5c1c8a..db4cc731e4 100644
--- a/esphome/components/rtttl/rtttl.cpp
+++ b/esphome/components/rtttl/rtttl.cpp
@@ -26,7 +26,10 @@ inline double deg2rad(double degrees) {
return degrees * PI_ON_180;
}
-void Rtttl::dump_config() { ESP_LOGCONFIG(TAG, "Rtttl"); }
+void Rtttl::dump_config() {
+ ESP_LOGCONFIG(TAG, "Rtttl:");
+ ESP_LOGCONFIG(TAG, " Gain: %f", gain_);
+}
void Rtttl::play(std::string rtttl) {
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {
diff --git a/esphome/components/rtttl/rtttl.h b/esphome/components/rtttl/rtttl.h
index 3cb6e3f5fb..10c290c5fb 100644
--- a/esphome/components/rtttl/rtttl.h
+++ b/esphome/components/rtttl/rtttl.h
@@ -39,6 +39,7 @@ class Rtttl : public Component {
#ifdef USE_SPEAKER
void set_speaker(speaker::Speaker *speaker) { this->speaker_ = speaker; }
#endif
+ float get_gain() { return gain_; }
void set_gain(float gain) {
if (gain < 0.1f)
gain = 0.1f;
diff --git a/esphome/components/speaker/__init__.py b/esphome/components/speaker/__init__.py
index 1bbc0b02ef..7a668dc2f3 100644
--- a/esphome/components/speaker/__init__.py
+++ b/esphome/components/speaker/__init__.py
@@ -1,15 +1,18 @@
from esphome import automation
from esphome.automation import maybe_simple_id
import esphome.codegen as cg
+from esphome.components import audio_dac
import esphome.config_validation as cv
from esphome.const import CONF_DATA, CONF_ID, CONF_VOLUME
from esphome.core import CORE
from esphome.coroutine import coroutine_with_priority
-CODEOWNERS = ["@jesserockz"]
+CODEOWNERS = ["@jesserockz", "@kahrendt"]
IS_PLATFORM_COMPONENT = True
+CONF_AUDIO_DAC = "audio_dac"
+
speaker_ns = cg.esphome_ns.namespace("speaker")
Speaker = speaker_ns.class_("Speaker")
@@ -26,6 +29,12 @@ FinishAction = speaker_ns.class_(
VolumeSetAction = speaker_ns.class_(
"VolumeSetAction", automation.Action, cg.Parented.template(Speaker)
)
+MuteOnAction = speaker_ns.class_(
+ "MuteOnAction", automation.Action, cg.Parented.template(Speaker)
+)
+MuteOffAction = speaker_ns.class_(
+ "MuteOffAction", automation.Action, cg.Parented.template(Speaker)
+)
IsPlayingCondition = speaker_ns.class_("IsPlayingCondition", automation.Condition)
@@ -33,7 +42,9 @@ IsStoppedCondition = speaker_ns.class_("IsStoppedCondition", automation.Conditio
async def setup_speaker_core_(var, config):
- pass
+ if audio_dac_config := config.get(CONF_AUDIO_DAC):
+ aud_dac = await cg.get_variable(audio_dac_config)
+ cg.add(var.set_audio_dac(aud_dac))
async def register_speaker(var, config):
@@ -42,8 +53,11 @@ async def register_speaker(var, config):
await setup_speaker_core_(var, config)
-SPEAKER_SCHEMA = cv.Schema({})
-
+SPEAKER_SCHEMA = cv.Schema(
+ {
+ cv.Optional(CONF_AUDIO_DAC): cv.use_id(audio_dac.AudioDac),
+ }
+)
SPEAKER_AUTOMATION_SCHEMA = maybe_simple_id({cv.GenerateID(): cv.use_id(Speaker)})
@@ -113,6 +127,15 @@ async def speaker_volume_set_action(config, action_id, template_arg, args):
return var
+@automation.register_action(
+ "speaker.mute_off", MuteOffAction, SPEAKER_AUTOMATION_SCHEMA
+)
+@automation.register_action("speaker.mute_on", MuteOnAction, SPEAKER_AUTOMATION_SCHEMA)
+async def speaker_mute_action_to_code(config, action_id, template_arg, args):
+ paren = await cg.get_variable(config[CONF_ID])
+ return cg.new_Pvariable(action_id, template_arg, paren)
+
+
@coroutine_with_priority(100.0)
async def to_code(config):
cg.add_global(speaker_ns.using)
diff --git a/esphome/components/speaker/automation.h b/esphome/components/speaker/automation.h
index 9efda011f2..c083796eea 100644
--- a/esphome/components/speaker/automation.h
+++ b/esphome/components/speaker/automation.h
@@ -39,6 +39,26 @@ template class VolumeSetAction : public Action, public Pa
void play(Ts... x) override { this->parent_->set_volume(this->volume_.value(x...)); }
};
+template class MuteOnAction : public Action {
+ public:
+ explicit MuteOnAction(Speaker *speaker) : speaker_(speaker) {}
+
+ void play(Ts... x) override { this->speaker_->set_mute_state(true); }
+
+ protected:
+ Speaker *speaker_;
+};
+
+template class MuteOffAction : public Action {
+ public:
+ explicit MuteOffAction(Speaker *speaker) : speaker_(speaker) {}
+
+ void play(Ts... x) override { this->speaker_->set_mute_state(false); }
+
+ protected:
+ Speaker *speaker_;
+};
+
template class StopAction : public Action, public Parented {
public:
void play(Ts... x) override { this->parent_->stop(); }
diff --git a/esphome/components/speaker/speaker.h b/esphome/components/speaker/speaker.h
index 9390e4edb7..96843e2d5a 100644
--- a/esphome/components/speaker/speaker.h
+++ b/esphome/components/speaker/speaker.h
@@ -8,7 +8,12 @@
#include
#endif
+#include "esphome/core/defines.h"
+
#include "esphome/components/audio/audio.h"
+#ifdef USE_AUDIO_DAC
+#include "esphome/components/audio_dac/audio_dac.h"
+#endif
namespace esphome {
namespace speaker {
@@ -56,9 +61,35 @@ class Speaker {
bool is_running() const { return this->state_ == STATE_RUNNING; }
bool is_stopped() const { return this->state_ == STATE_STOPPED; }
- // Volume control must be implemented by each speaker component, otherwise it will have no effect.
- virtual void set_volume(float volume) { this->volume_ = volume; };
- virtual float get_volume() { return this->volume_; }
+ // Volume control is handled by a configured audio dac component. Individual speaker components can
+ // override and implement in software if an audio dac isn't available.
+ virtual void set_volume(float volume) {
+ this->volume_ = volume;
+#ifdef USE_AUDIO_DAC
+ if (this->audio_dac_ != nullptr) {
+ this->audio_dac_->set_volume(volume);
+ }
+#endif
+ };
+ float get_volume() { return this->volume_; }
+
+ virtual void set_mute_state(bool mute_state) {
+ this->mute_state_ = mute_state;
+#ifdef USE_AUDIO_DAC
+ if (this->audio_dac_) {
+ if (mute_state) {
+ this->audio_dac_->set_mute_on();
+ } else {
+ this->audio_dac_->set_mute_off();
+ }
+ }
+#endif
+ }
+ bool get_mute_state() { return this->mute_state_; }
+
+#ifdef USE_AUDIO_DAC
+ void set_audio_dac(audio_dac::AudioDac *audio_dac) { this->audio_dac_ = audio_dac; }
+#endif
void set_audio_stream_info(const audio::AudioStreamInfo &audio_stream_info) {
this->audio_stream_info_ = audio_stream_info;
@@ -68,6 +99,11 @@ class Speaker {
State state_{STATE_STOPPED};
audio::AudioStreamInfo audio_stream_info_;
float volume_{1.0f};
+ bool mute_state_{false};
+
+#ifdef USE_AUDIO_DAC
+ audio_dac::AudioDac *audio_dac_{nullptr};
+#endif
};
} // namespace speaker
diff --git a/esphome/components/voice_assistant/voice_assistant.cpp b/esphome/components/voice_assistant/voice_assistant.cpp
index a2210f188d..6f164f69d3 100644
--- a/esphome/components/voice_assistant/voice_assistant.cpp
+++ b/esphome/components/voice_assistant/voice_assistant.cpp
@@ -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
@@ -437,16 +433,18 @@ void VoiceAssistant::loop() {
#ifdef USE_SPEAKER
void VoiceAssistant::write_speaker_() {
- if (this->speaker_buffer_size_ > 0) {
- size_t write_chunk = std::min(this->speaker_buffer_size_, 4 * 1024);
- size_t written = this->speaker_->play(this->speaker_buffer_, write_chunk);
- if (written > 0) {
- memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written);
- this->speaker_buffer_size_ -= written;
- this->speaker_buffer_index_ -= written;
- this->set_timeout("speaker-timeout", 5000, [this]() { this->speaker_->stop(); });
- } else {
- ESP_LOGV(TAG, "Speaker buffer full, trying again next loop");
+ if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) {
+ if (this->speaker_buffer_size_ > 0) {
+ size_t write_chunk = std::min(this->speaker_buffer_size_, 4 * 1024);
+ size_t written = this->speaker_->play(this->speaker_buffer_, write_chunk);
+ if (written > 0) {
+ memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written);
+ this->speaker_buffer_size_ -= written;
+ this->speaker_buffer_index_ -= written;
+ this->set_timeout("speaker-timeout", 5000, [this]() { this->speaker_->stop(); });
+ } else {
+ ESP_LOGV(TAG, "Speaker buffer full, trying again next loop");
+ }
}
}
}
@@ -776,16 +774,20 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
}
case api::enums::VOICE_ASSISTANT_TTS_STREAM_START: {
#ifdef USE_SPEAKER
- this->wait_for_stream_end_ = true;
- ESP_LOGD(TAG, "TTS stream start");
- this->defer([this] { this->tts_stream_start_trigger_->trigger(); });
+ if (this->speaker_ != nullptr) {
+ this->wait_for_stream_end_ = true;
+ ESP_LOGD(TAG, "TTS stream start");
+ this->defer([this] { this->tts_stream_start_trigger_->trigger(); });
+ }
#endif
break;
}
case api::enums::VOICE_ASSISTANT_TTS_STREAM_END: {
#ifdef USE_SPEAKER
- this->stream_ended_ = true;
- ESP_LOGD(TAG, "TTS stream end");
+ if (this->speaker_ != nullptr) {
+ this->stream_ended_ = true;
+ ESP_LOGD(TAG, "TTS stream end");
+ }
#endif
break;
}
@@ -806,14 +808,16 @@ void VoiceAssistant::on_event(const api::VoiceAssistantEventResponse &msg) {
void VoiceAssistant::on_audio(const api::VoiceAssistantAudio &msg) {
#ifdef USE_SPEAKER // We should never get to this function if there is no speaker anyway
- if (this->speaker_buffer_index_ + msg.data.length() < SPEAKER_BUFFER_SIZE) {
- memcpy(this->speaker_buffer_ + this->speaker_buffer_index_, msg.data.data(), msg.data.length());
- this->speaker_buffer_index_ += msg.data.length();
- this->speaker_buffer_size_ += msg.data.length();
- this->speaker_bytes_received_ += msg.data.length();
- ESP_LOGV(TAG, "Received audio: %u bytes from API", msg.data.length());
- } else {
- ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
+ if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) {
+ if (this->speaker_buffer_index_ + msg.data.length() < SPEAKER_BUFFER_SIZE) {
+ memcpy(this->speaker_buffer_ + this->speaker_buffer_index_, msg.data.data(), msg.data.length());
+ this->speaker_buffer_index_ += msg.data.length();
+ this->speaker_buffer_size_ += msg.data.length();
+ this->speaker_bytes_received_ += msg.data.length();
+ ESP_LOGV(TAG, "Received audio: %u bytes from API", msg.data.length());
+ } else {
+ ESP_LOGE(TAG, "Cannot receive audio, buffer is full");
+ }
}
#endif
}
diff --git a/esphome/components/voice_assistant/voice_assistant.h b/esphome/components/voice_assistant/voice_assistant.h
index 56ada0e75a..0016d3157c 100644
--- a/esphome/components/voice_assistant/voice_assistant.h
+++ b/esphome/components/voice_assistant/voice_assistant.h
@@ -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();
@@ -249,7 +250,7 @@ class VoiceAssistant : public Component {
#ifdef USE_SPEAKER
void write_speaker_();
speaker::Speaker *speaker_{nullptr};
- uint8_t *speaker_buffer_;
+ uint8_t *speaker_buffer_{nullptr};
size_t speaker_buffer_index_{0};
size_t speaker_buffer_size_{0};
size_t speaker_bytes_received_{0};
@@ -281,8 +282,8 @@ class VoiceAssistant : public Component {
float volume_multiplier_;
uint32_t conversation_timeout_;
- uint8_t *send_buffer_;
- int16_t *input_buffer_;
+ uint8_t *send_buffer_{nullptr};
+ int16_t *input_buffer_{nullptr};
bool continuous_{false};
bool silence_detection_;
diff --git a/esphome/components/wifi/wifi_component_esp32_arduino.cpp b/esphome/components/wifi/wifi_component_esp32_arduino.cpp
index b8724838c8..ef4308b28c 100644
--- a/esphome/components/wifi/wifi_component_esp32_arduino.cpp
+++ b/esphome/components/wifi/wifi_component_esp32_arduino.cpp
@@ -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);
diff --git a/esphome/config_validation.py b/esphome/config_validation.py
index 6cfc596565..82394f91e3 100644
--- a/esphome/config_validation.py
+++ b/esphome/config_validation.py
@@ -40,6 +40,7 @@ from esphome.const import (
CONF_SECOND,
CONF_SETUP_PRIORITY,
CONF_STATE_TOPIC,
+ CONF_SUBSCRIBE_QOS,
CONF_TOPIC,
CONF_TYPE,
CONF_TYPE_ID,
@@ -1900,9 +1901,10 @@ MQTT_COMPONENT_AVAILABILITY_SCHEMA = Schema(
MQTT_COMPONENT_SCHEMA = Schema(
{
- Optional(CONF_QOS): All(requires_component("mqtt"), int_range(min=0, max=2)),
+ Optional(CONF_QOS): All(requires_component("mqtt"), mqtt_qos),
Optional(CONF_RETAIN): All(requires_component("mqtt"), boolean),
Optional(CONF_DISCOVERY): All(requires_component("mqtt"), boolean),
+ Optional(CONF_SUBSCRIBE_QOS): All(requires_component("mqtt"), mqtt_qos),
Optional(CONF_STATE_TOPIC): All(requires_component("mqtt"), publish_topic),
Optional(CONF_AVAILABILITY): All(
requires_component("mqtt"), Any(None, MQTT_COMPONENT_AVAILABILITY_SCHEMA)
diff --git a/esphome/const.py b/esphome/const.py
index 17005fed75..62c9ead9d9 100644
--- a/esphome/const.py
+++ b/esphome/const.py
@@ -821,6 +821,7 @@ CONF_STOP = "stop"
CONF_STOP_ACTION = "stop_action"
CONF_STORE_BASELINE = "store_baseline"
CONF_SUBNET = "subnet"
+CONF_SUBSCRIBE_QOS = "subscribe_qos"
CONF_SUBSTITUTIONS = "substitutions"
CONF_SUM = "sum"
CONF_SUPPLEMENTAL_COOLING_ACTION = "supplemental_cooling_action"
diff --git a/esphome/core/config.py b/esphome/core/config.py
index f4253bee87..8c130eb6db 100644
--- a/esphome/core/config.py
+++ b/esphome/core/config.py
@@ -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)
diff --git a/esphome/mqtt.py b/esphome/mqtt.py
index c1c45799cc..d55fb0202d 100644
--- a/esphome/mqtt.py
+++ b/esphome/mqtt.py
@@ -209,6 +209,12 @@ def show_logs(config, topic=None, username=None, password=None, client_id=None):
elif CONF_MQTT in config:
conf = config[CONF_MQTT]
if CONF_LOG_TOPIC in conf:
+ if config[CONF_MQTT][CONF_LOG_TOPIC] is None:
+ _LOGGER.error("MQTT log topic set to null, can't start MQTT logs")
+ return 1
+ if CONF_TOPIC not in config[CONF_MQTT][CONF_LOG_TOPIC]:
+ _LOGGER.error("MQTT log topic not available, can't start MQTT logs")
+ return 1
topic = config[CONF_MQTT][CONF_LOG_TOPIC][CONF_TOPIC]
elif CONF_TOPIC_PREFIX in config[CONF_MQTT]:
topic = f"{config[CONF_MQTT][CONF_TOPIC_PREFIX]}/debug"
diff --git a/esphome/writer.py b/esphome/writer.py
index 6c6b8c02e6..90446ae4b1 100644
--- a/esphome/writer.py
+++ b/esphome/writer.py
@@ -1,3 +1,4 @@
+import importlib
import logging
import os
from pathlib import Path
@@ -299,29 +300,13 @@ def copy_src_tree():
CORE.relative_src_path("esphome", "core", "version.h"), generate_version_h()
)
- if CORE.is_esp32:
- from esphome.components.esp32 import copy_files
-
- copy_files()
-
- elif CORE.is_esp8266:
- from esphome.components.esp8266 import copy_files
-
- copy_files()
-
- elif CORE.is_rp2040:
- from esphome.components.rp2040 import copy_files
-
- (pio) = copy_files()
- if pio:
- write_file_if_changed(
- CORE.relative_src_path("esphome.h"),
- ESPHOME_H_FORMAT.format(include_s + '\n#include "pio_includes.h"'),
- )
- elif CORE.using_zephyr:
- from esphome.components.zephyr import copy_files
-
+ platform = "esphome.components." + CORE.target_platform
+ try:
+ module = importlib.import_module(platform)
+ copy_files = getattr(module, "copy_files")
copy_files()
+ except AttributeError:
+ pass
def generate_defines_h():
diff --git a/tests/components/i2c_device/test.esp32-ard.yaml b/tests/components/i2c_device/test.esp32-ard.yaml
new file mode 100644
index 0000000000..6169d113f8
--- /dev/null
+++ b/tests/components/i2c_device/test.esp32-ard.yaml
@@ -0,0 +1,8 @@
+i2c:
+ - id: i2c_i2c
+ scl: 16
+ sda: 17
+
+i2c_device:
+ id: i2cdev
+ address: 0x2C
diff --git a/tests/components/i2c_device/test.esp32-c3-ard.yaml b/tests/components/i2c_device/test.esp32-c3-ard.yaml
new file mode 100644
index 0000000000..5d53d12208
--- /dev/null
+++ b/tests/components/i2c_device/test.esp32-c3-ard.yaml
@@ -0,0 +1,8 @@
+i2c:
+ - id: i2c_i2c
+ scl: 5
+ sda: 4
+
+i2c_device:
+ id: i2cdev
+ address: 0x2C
diff --git a/tests/components/i2c_device/test.esp32-c3-idf.yaml b/tests/components/i2c_device/test.esp32-c3-idf.yaml
new file mode 100644
index 0000000000..5d53d12208
--- /dev/null
+++ b/tests/components/i2c_device/test.esp32-c3-idf.yaml
@@ -0,0 +1,8 @@
+i2c:
+ - id: i2c_i2c
+ scl: 5
+ sda: 4
+
+i2c_device:
+ id: i2cdev
+ address: 0x2C
diff --git a/tests/components/i2c_device/test.esp32-idf.yaml b/tests/components/i2c_device/test.esp32-idf.yaml
new file mode 100644
index 0000000000..6169d113f8
--- /dev/null
+++ b/tests/components/i2c_device/test.esp32-idf.yaml
@@ -0,0 +1,8 @@
+i2c:
+ - id: i2c_i2c
+ scl: 16
+ sda: 17
+
+i2c_device:
+ id: i2cdev
+ address: 0x2C
diff --git a/tests/components/i2c_device/test.esp8266-ard.yaml b/tests/components/i2c_device/test.esp8266-ard.yaml
new file mode 100644
index 0000000000..5d53d12208
--- /dev/null
+++ b/tests/components/i2c_device/test.esp8266-ard.yaml
@@ -0,0 +1,8 @@
+i2c:
+ - id: i2c_i2c
+ scl: 5
+ sda: 4
+
+i2c_device:
+ id: i2cdev
+ address: 0x2C
diff --git a/tests/components/i2c_device/test.rp2040-ard.yaml b/tests/components/i2c_device/test.rp2040-ard.yaml
new file mode 100644
index 0000000000..5d53d12208
--- /dev/null
+++ b/tests/components/i2c_device/test.rp2040-ard.yaml
@@ -0,0 +1,8 @@
+i2c:
+ - id: i2c_i2c
+ scl: 5
+ sda: 4
+
+i2c_device:
+ id: i2cdev
+ address: 0x2C
diff --git a/tests/components/lvgl/common.yaml b/tests/components/lvgl/common.yaml
index ad935ae563..cebc3caaa7 100644
--- a/tests/components/lvgl/common.yaml
+++ b/tests/components/lvgl/common.yaml
@@ -93,7 +93,7 @@ light:
- platform: lvgl
name: LVGL LED
id: lv_light
- led: lv_led
+ widget: lv_led
binary_sensor:
- platform: lvgl
@@ -127,6 +127,11 @@ binary_sensor:
- platform: lvgl
name: LVGL checkbox
widget: checkbox_id
+ on_state:
+ then:
+ - lvgl.image.update:
+ id: lv_image
+ src: !lambda if (x) return id(cat_image); else return id(dog_image);
wifi:
ssid: SSID
diff --git a/tests/components/lvgl/lvgl-package.yaml b/tests/components/lvgl/lvgl-package.yaml
index 8d515280c9..4962a71596 100644
--- a/tests/components/lvgl/lvgl-package.yaml
+++ b/tests/components/lvgl/lvgl-package.yaml
@@ -323,6 +323,13 @@ lvgl:
id: button_button
width: 20%
height: 10%
+ transform_angle: !lambda return 180*100;
+ arc_width: !lambda return 4;
+ border_width: !lambda return 6;
+ shadow_ofs_x: !lambda return 6;
+ shadow_ofs_y: !lambda return 6;
+ shadow_spread: !lambda return 6;
+ shadow_width: !lambda return 6;
pressed:
bg_color: light_blue
checkable: true
@@ -419,9 +426,10 @@ lvgl:
spin_time: 2s
align: left_mid
- image:
+ id: lv_image
src: cat_image
align: top_left
- y: 50
+ y: "50"
- tileview:
id: tileview_id
scrollbar_mode: active
@@ -460,7 +468,7 @@ lvgl:
bg_opa: transp
knob:
radius: 1
- width: 4
+ width: "4"
height: 10%
bg_color: 0x000000
width: 100%
diff --git a/tests/components/mqtt/common.yaml b/tests/components/mqtt/common.yaml
index f7a727ab2f..5ed6335d65 100644
--- a/tests/components/mqtt/common.yaml
+++ b/tests/components/mqtt/common.yaml
@@ -227,6 +227,7 @@ datetime:
type: date
state_topic: some/topic/date
qos: 2
+ subscribe_qos: 2
set_action:
- logger.log: "set_value"
on_value:
diff --git a/tests/components/speaker/test.esp32-ard.yaml b/tests/components/speaker/test.esp32-ard.yaml
index 9a24d00f68..396b4d95ea 100644
--- a/tests/components/speaker/test.esp32-ard.yaml
+++ b/tests/components/speaker/test.esp32-ard.yaml
@@ -1,6 +1,8 @@
esphome:
on_boot:
then:
+ - speaker.mute_on:
+ - speaker.mute_off:
- if:
condition: speaker.is_stopped
then:
diff --git a/tests/components/speaker/test.esp32-c3-ard.yaml b/tests/components/speaker/test.esp32-c3-ard.yaml
index f28014337c..636aeba766 100644
--- a/tests/components/speaker/test.esp32-c3-ard.yaml
+++ b/tests/components/speaker/test.esp32-c3-ard.yaml
@@ -1,6 +1,8 @@
esphome:
on_boot:
then:
+ - speaker.mute_on:
+ - speaker.mute_off:
- if:
condition: speaker.is_stopped
then:
diff --git a/tests/components/speaker/test.esp32-c3-idf.yaml b/tests/components/speaker/test.esp32-c3-idf.yaml
index f28014337c..636aeba766 100644
--- a/tests/components/speaker/test.esp32-c3-idf.yaml
+++ b/tests/components/speaker/test.esp32-c3-idf.yaml
@@ -1,6 +1,8 @@
esphome:
on_boot:
then:
+ - speaker.mute_on:
+ - speaker.mute_off:
- if:
condition: speaker.is_stopped
then:
diff --git a/tests/components/speaker/test.esp32-idf.yaml b/tests/components/speaker/test.esp32-idf.yaml
index 9a24d00f68..b69440b133 100644
--- a/tests/components/speaker/test.esp32-idf.yaml
+++ b/tests/components/speaker/test.esp32-idf.yaml
@@ -1,6 +1,8 @@
esphome:
on_boot:
then:
+ - speaker.mute_on:
+ - speaker.mute_off:
- if:
condition: speaker.is_stopped
then:
@@ -17,8 +19,17 @@ i2s_audio:
i2s_bclk_pin: 17
i2s_mclk_pin: 15
+i2c:
+ scl: 12
+ sda: 10
+
+audio_dac:
+ - platform: aic3204
+ id: internal_dac
+
speaker:
- platform: i2s_audio
- id: speaker_id
+ id: speaker_with_audio_dac_id
+ audio_dac: internal_dac
dac_type: external
- i2s_dout_pin: 13
+ i2s_dout_pin: 14