17 if (
state == this->state) {
26 if (!min_value.has_value()) {
27 ESP_LOGE(TAG,
"'%s': Can't convert 'min' value '%s' to number!", this->
entity_id_, min.
c_str());
30 ESP_LOGD(TAG,
"'%s': Min retrieved: %s", this->
entity_id_, min.
c_str());
36 if (!max_value.has_value()) {
37 ESP_LOGE(TAG,
"'%s': Can't convert 'max' value '%s' to number!", this->
entity_id_, max.
c_str());
40 ESP_LOGD(TAG,
"'%s': Max retrieved: %s", this->
entity_id_, max.
c_str());
47 }
else if (mode ==
"password") {
50 ESP_LOGW(TAG,
"'%s': Unknown 'mode' value '%s'", this->
entity_id_, mode.
c_str());
53 ESP_LOGD(TAG,
"'%s': Mode retrieved: %s", this->
entity_id_, mode.
c_str());
71 LOG_TEXT(
"",
"Homeassistant Text",
this);
72 ESP_LOGCONFIG(TAG,
" Entity ID: '%s'", this->
entity_id_);
79 ESP_LOGE(TAG,
"No clients connected to API server");
83#ifdef USE_API_WIZARD_LINKED_INPUTS
85 ESP_LOGW(TAG,
"'%s': No entity ID set yet", this->
get_name().c_str());
91 static const char SERVICE_TEXT[] PROGMEM =
"text.set_value";
92 static const char SERVICE_INPUT_TEXT[] PROGMEM =
"input_text.set_value";
93 static const char ENTITY_ID_KEY[] PROGMEM =
"entity_id";
94 static const char VALUE_KEY[] PROGMEM =
"value";
98 const bool input_helper = ESPHOME_strncmp_P(this->
entity_id_, SERVICE_INPUT_TEXT,
sizeof(
"input_") - 1) == 0;
103 auto &entity_id_kv = resp.
data.emplace_back();
107 auto &value_kv = resp.
data.emplace_back();
BedjetMode mode
BedJet operating mode.
const StringRef & get_name() const
A string that may live in flash (on ESP8266): pointer and length, with no byte-reading operations.
static constexpr ProgmemStringRef from_lit(const char(&s)[N])
A PROGMEM char array, with its length known at compile time.
StringRef is a reference to a string owned by something else.
constexpr const char * c_str() const
void get_home_assistant_state(const char *entity_id, const char *attribute, std::function< void(StringRef)> &&f)
void send_homeassistant_action(const HomeassistantActionRequest &call)
void subscribe_home_assistant_state(const char *entity_id, const char *attribute, std::function< void(StringRef)> &&f)
FixedVector< HomeassistantServiceMap > data
void state_changed_(StringRef state)
void mode_retrieved_(StringRef mode)
void dump_config() override
float get_setup_priority() const override
void max_retrieved_(StringRef max)
void control(const std::string &value) override
void min_retrieved_(StringRef min)
void publish_state(const std::string &state)
void set_mode(TextMode mode)
void set_max_length(int max_length)
void set_min_length(int min_length)
APIServer * global_api_server
ESPHOME_LOG_TAG(TAG, "homeassistant.binary_sensor")
constexpr float AFTER_CONNECTION
For components that should be initialized after a data connection (API/MQTT) is connected.
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.