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>
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "esphome/components/binary_sensor/binary_sensor.h"
|
|
#include "esphome/components/uart/uart.h"
|
|
#include "esphome/core/defines.h"
|
|
#include "esphome/core/helpers.h"
|
|
|
|
namespace esphome::uart {
|
|
|
|
// One per bus: reads the bytes once and presses each sensor whose pattern ends the stream
|
|
class UARTBinarySensorHub : public UARTDevice, public Component {
|
|
public:
|
|
void setup() override { this->buffer_.init(this->max_len_); }
|
|
void loop() override;
|
|
void dump_config() override;
|
|
|
|
// The pattern lives in flash; called once per sensor by the generated code
|
|
void add_event_matcher(binary_sensor::BinarySensor *sensor, const uint8_t *data, uint8_t data_len) {
|
|
this->matchers_.push_back({sensor, data, data_len});
|
|
this->max_len_ = std::max(this->max_len_, data_len);
|
|
}
|
|
|
|
protected:
|
|
struct EventMatcher {
|
|
binary_sensor::BinarySensor *sensor;
|
|
const uint8_t *data;
|
|
uint8_t data_len;
|
|
};
|
|
|
|
bool matches_(const EventMatcher &matcher) const;
|
|
|
|
StaticVector<EventMatcher, UART_BINARY_SENSOR_COUNT> matchers_;
|
|
FixedRingBuffer<uint8_t, 255> buffer_;
|
|
uint8_t max_len_{0};
|
|
};
|
|
|
|
} // namespace esphome::uart
|