Add Home Assistant screen manager and runtime tile configuration

This commit is contained in:
Max Gramser
2026-09-12 12:09:58 +02:00
parent 427e4049ab
commit d271a63241
43 changed files with 13991 additions and 388 deletions
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include "runtime_tiles.h"
#include "chunk_transport.h"
#include "esphome/components/text/text.h"
#include "esphome/core/component.h"
namespace esphome::smart_display {
// Command transport, not a stored JSON state. HA states stay well below 255 chars.
class DashboardInbox : public text::Text, public Component {
public:
void setup() override { this->publish_state("Klaar voor tegelconfiguratie"); }
protected:
runtime_tiles::Chunks chunks_;
void control(const std::string &value) override {
if (!chunks_.accept(value, millis())) { this->publish_state("Fout: onvolledig bericht"); return; }
if (!chunks_.complete) return;
std::string decoded(chunks_.data.size() * 3 / 4 + 1, '\0');
size_t length = base64_decode(chunks_.data, reinterpret_cast<uint8_t *>(decoded.data()), decoded.size());
chunks_.reset();
if (length == 0 || length > 4096) { this->publish_state("Fout: ongeldige codering"); return; }
decoded.resize(length);
this->publish_state(runtime_tiles::receive(decoded));
}
};
}