Update the patched UART component to ESPHome 2026.11.0
ESPHome 2026.11's tuya component calls uart.new_uart_component(), which the 2026.10.2 copy didn't have, so the build failed. Copy the UART component from 2026.11.0, reapply the PA13/PA14 patch, regenerate the patch file and point the refs at v1.0.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bcc6b3a42b
commit
1457e25d98
39 files changed
+907
-304
No files matched your search
@@ -1,36 +1,29 @@
|
||||
import esphome.codegen as cg
|
||||
from esphome import automation
|
||||
from esphome.components import button, uart
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_DATA
|
||||
from esphome.core import HexInt
|
||||
from esphome.const import CONF_DATA, CONF_UART_ID
|
||||
from esphome.types import ConfigType
|
||||
|
||||
from .. import uart_ns, validate_raw_data
|
||||
from .. import validate_raw_payload
|
||||
|
||||
CODEOWNERS = ["@ssieb"]
|
||||
|
||||
DEPENDENCIES = ["uart"]
|
||||
|
||||
UARTButton = uart_ns.class_("UARTButton", button.Button, uart.UARTDevice, cg.Component)
|
||||
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
button.button_schema(UARTButton)
|
||||
button.button_schema(button.ApplyButton)
|
||||
.extend(
|
||||
{
|
||||
cv.Required(CONF_DATA): validate_raw_data,
|
||||
cv.Required(CONF_DATA): validate_raw_payload,
|
||||
}
|
||||
)
|
||||
.extend(uart.UART_DEVICE_SCHEMA)
|
||||
.extend(cv.COMPONENT_SCHEMA)
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
var = await button.new_button(config)
|
||||
await cg.register_component(var, config)
|
||||
await uart.register_uart_device(var, config)
|
||||
|
||||
async def to_code(config: ConfigType) -> None:
|
||||
data = config[CONF_DATA]
|
||||
if isinstance(data, bytes):
|
||||
data = [HexInt(x) for x in data]
|
||||
cg.add(var.set_data(cg.ArrayInitializer(*data)))
|
||||
table = automation.progmem_bytes("uart_data", data)
|
||||
await button.sub_buttons(config, parent=config[CONF_UART_ID]).create(
|
||||
config, None, apply=f"write_array_progmem({table}, {len(data)})"
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "uart_button.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
static const char *const TAG = "uart.button";
|
||||
|
||||
void UARTButton::press_action() {
|
||||
ESP_LOGD(TAG, "'%s': Sending data", this->get_name().c_str());
|
||||
this->write_array(this->data_.data(), this->data_.size());
|
||||
}
|
||||
|
||||
void UARTButton::dump_config() { LOG_BUTTON("", "UART Button", this); }
|
||||
|
||||
} // namespace esphome::uart
|
||||
@@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/uart/uart.h"
|
||||
#include "esphome/components/button/button.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace esphome::uart {
|
||||
|
||||
class UARTButton final : public button::Button, public UARTDevice, public Component {
|
||||
public:
|
||||
void set_data(std::vector<uint8_t> &&data) { this->data_ = std::move(data); }
|
||||
void set_data(std::initializer_list<uint8_t> data) { this->data_ = std::vector<uint8_t>(data); }
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
void press_action() override;
|
||||
std::vector<uint8_t> data_;
|
||||
};
|
||||
|
||||
} // namespace esphome::uart
|
||||
Reference in new issue
Block a user