Hey,
I am trying to implement an external component for text output and I don’t seem to get the crucial step for getting an entity.
Background: I have 20 characters of “splitflap” display that I can control by esp32 and I want to send text there. Displaying the text involves driving some Shift Registers via SPI and so on … so this has to be custom code.
What I’ve done so far is easily summed up:
test.yaml
:
esphome:
name: abc
esp32:
board: esp32doit-devkit-v1
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "**"
ota:
- platform: esphome
password: "**"
wifi:
ssid: "MySSID"
password: "**"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "ABC Fallback Hotspot"
password: "**"
captive_portal:
external_components:
- source:
type: local
path: components
components: ["fallblatt_abc"]
text:
- platform: fallblatt_abc
mode: "text"
name: "Fallblatt ABC"
In the directory components/fallblatt_abc
next to test.yaml
you find:
text.py
:
import esphome.config_validation as cv
from esphome.components import text
CONFIG_SCHEMA = text.TEXT_SCHEMA
__init__.py
: empty
fallblatt_abc.h
:
#include "esphome.h"
#include "esphome/core/component.h"
#include "esphome/components/text/text.h"
using namespace esphome;
using namespace text;
class FallblattABC : public Component, public Text {
public:
void setup() {
}
void loop() {
}
void control(const std::string &value) {
ESP_LOGI("ABC", "Text has been set: %s", value.c_str());
}
};
I would expect, that there pops up some kind of entity I can send text to (via the text.set
Action) and that the log line appears if I do so.
However, this is not the case. If I define for instance a GPIO sensor in test.yaml
, it pops up. So what am I missing?
Thanks a lot!