12 static const char *
const TAG =
"mqtt.select";
21 call.set_option(state);
29 LOG_MQTT_COMPONENT(
true,
false)
39 for (
const auto &option : traits.get_options())
void dump_config() override
MQTTSelectComponent(select::Select *select)
Construct this MQTTSelectComponent instance with the provided friendly_name and select.
bool send_initial_state() override
constexpr const char *const MQTT_OPTIONS
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.
Simple Helper struct used for Home Assistant MQTT send_discovery().
SelectCall make_call()
Instantiate a SelectCall object to modify this select component's state.
void send_discovery(JsonObject root, mqtt::SendDiscoveryConfig &config) override
constexpr const char * c_str() const
void setup() override
Override setup.
Base-class for all selects.
Implementation of SPI Controller mode.
bool has_state() const
Return whether this select component has gotten a full state yet.
const EntityBase * get_entity() const override
std::string get_state_topic_() const
Get the MQTT topic that new states will be shared to.
std::string component_type() const override
Override for MQTTComponent, returns "select".
std::string get_command_topic_() const
Get the MQTT topic for listening to commands.
void add_on_state_callback(std::function< void(std::string, size_t)> &&callback)
const StringRef & get_name() const
bool publish_state(const std::string &value)