12 static const char *
const TAG =
"mqtt.text";
21 call.set_value(state);
30 LOG_MQTT_COMPONENT(
true,
true)
TextMode get_mode() const
MQTTTextComponent(text::Text *text)
Construct this MQTTTextComponent instance with the provided friendly_name and text.
void setup() override
Override setup.
Base-class for all text inputs.
TextCall make_call()
Instantiate a TextCall object to modify this text component's state.
bool command_topic
If the command topic should be included. Default to true.
bool publish(const std::string &topic, const std::string &payload)
Send a MQTT message.
void subscribe(const std::string &topic, mqtt_callback_t callback, uint8_t qos=0)
Subscribe to a MQTT topic.
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
void add_on_state_callback(std::function< void(std::string)> &&callback)
bool has_state() const
Return whether this text input has gotten a full state yet.
bool send_initial_state() override
Simple Helper struct used for Home Assistant MQTT send_discovery().
constexpr const char *const MQTT_MODE
constexpr const char * c_str() const
void dump_config() override
const EntityBase * get_entity() const override
Implementation of SPI Controller mode.
std::string component_type() const override
Override for MQTTComponent, returns "text".
bool publish_state(const std::string &value)
std::string get_state_topic_() const
Get the MQTT topic that new states will be shared to.
std::string get_command_topic_() const
Get the MQTT topic for listening to commands.
const StringRef & get_name() const