12static const char *
const TAG =
"mqtt.select";
29 LOG_MQTT_COMPONENT(
true,
false)
39 for (
const auto &option : traits.get_options())
const StringRef & get_name() const
constexpr const char * c_str() const
bool publish(const std::string &topic, const std::string &payload)
Send a MQTT message.
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.
void subscribe(const std::string &topic, mqtt_callback_t callback, uint8_t qos=0)
Subscribe to a MQTT topic.
const EntityBase * get_entity() const override
void setup() override
Override setup.
std::string component_type() const override
Override for MQTTComponent, returns "select".
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
void dump_config() override
bool publish_state(const std::string &value)
bool send_initial_state() override
MQTTSelectComponent(select::Select *select)
Construct this MQTTSelectComponent instance with the provided friendly_name and select.
SelectCall & set_option(const std::string &option)
Base-class for all selects.
void add_on_state_callback(std::function< void(std::string, size_t)> &&callback)
SelectCall make_call()
Instantiate a SelectCall object to modify this select component's state.
bool has_state() const
Return whether this select component has gotten a full state yet.
constexpr const char *const MQTT_OPTIONS
Providing packet encoding functions for exchanging data with a remote host.
Simple Helper struct used for Home Assistant MQTT send_discovery().
bool command_topic
If the command topic should be included. Default to true.