Decode DP127 as 48 bytes (4 alarms), plus DP128, DP107 and DP126, from Tuya's data model. Add day switches, alarm and sunset controls, a knock sensor on PA18, display schedule, bedtime fade, radio timer and grouped web UI. Pin LibreTiny v1.14.0 for the OTA restart fix. Ship the patched UART as an external component so a server needs only a short YAML. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
729 B
C++
32 lines
729 B
C++
#pragma once
|
|
|
|
#include "esphome/core/component.h"
|
|
#include "esphome/components/event/event.h"
|
|
#include "esphome/components/uart/uart.h"
|
|
#include <vector>
|
|
|
|
namespace esphome::uart {
|
|
|
|
class UARTEvent final : public event::Event, public UARTDevice, public Component {
|
|
public:
|
|
void setup() override;
|
|
void loop() override;
|
|
void dump_config() override;
|
|
|
|
void add_event_matcher(const char *event_name, const uint8_t *match_data, size_t match_data_len);
|
|
|
|
protected:
|
|
struct EventMatcher {
|
|
const char *event_name;
|
|
const uint8_t *data;
|
|
size_t data_len;
|
|
};
|
|
|
|
void read_data_();
|
|
std::vector<EventMatcher> matchers_;
|
|
std::vector<uint8_t> buffer_;
|
|
size_t max_matcher_len_ = 0;
|
|
};
|
|
|
|
} // namespace esphome::uart
|