Fit this lamp: 4 alarms, full data model, knock snooze, server use

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>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-05 12:27:54 +01:00
1 parent 3e3358af08
commit a8f6bb3ca5
36 files changed
+5132 -214

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/uart/uart.h"
#include "esphome/components/switch/switch.h"
#include <cinttypes>
#include <vector>
namespace esphome::uart {
class UARTSwitch final : public switch_::Switch, public UARTDevice, public Component {
public:
void loop() override;
void set_data_on(std::vector<uint8_t> &&data) { this->data_on_ = std::move(data); }
void set_data_on(std::initializer_list<uint8_t> data) { this->data_on_ = std::vector<uint8_t>(data); }
void set_data_off(std::vector<uint8_t> &&data) { this->data_off_ = std::move(data); }
void set_data_off(std::initializer_list<uint8_t> data) { this->data_off_ = std::vector<uint8_t>(data); }
void set_send_every(uint32_t send_every) { this->send_every_ = send_every; }
void set_single_state(bool single) { this->single_state_ = single; }
void dump_config() override;
protected:
void write_command_(bool state);
void write_state(bool state) override;
std::vector<uint8_t> data_on_;
std::vector<uint8_t> data_off_;
bool single_state_{false};
uint32_t send_every_;
uint32_t last_transmission_;
};
} // namespace esphome::uart