20 if (
state == this->state) {
30 ESP_LOGE(TAG,
"'%s': Can't convert '%s' value '%s' to number!", this->
entity_id_, name,
value.c_str());
33 ESP_LOGD(TAG,
"'%s': Retrieved '%s': %s", this->
entity_id_, name,
value.c_str());
40 ESP_LOGW(TAG,
"'%s': Unknown 'mode' value '%s'", this->
entity_id_, mode.
c_str());
44 ESP_LOGD(TAG,
"'%s': Mode retrieved: %s", this->
entity_id_, mode.
c_str());
66 LOG_TEXT(
"",
"Homeassistant Text",
this);
67 ESP_LOGCONFIG(TAG,
" Entity ID: '%s'", this->
entity_id_);
75 static constexpr char SERVICE_TEXT[]
PROGMEM =
"text.set_value";
76 static constexpr char SERVICE_INPUT_TEXT[]
PROGMEM =
"input_text.set_value";
77 static constexpr char VALUE_KEY[]
PROGMEM =
"value";
86 auto &value_kv = resp.
data.emplace_back();
BedjetMode mode
BedJet operating mode.
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
bool send_homeassistant_action(const HomeassistantActionRequest &call)
Returns false when no subscribed client took the request, so it was dropped.
void get_home_assistant_state(const char *entity_id, const char *attribute, F &&f)
void subscribe_home_assistant_state(const char *entity_id, const char *attribute, F &&f)
For internal components: entity_id and attribute must live as long as the server.
FixedVector< HomeassistantServiceMap > data
optional< int > parse_length_(const char *name, StringRef value)
void state_changed_(StringRef state)
void mode_retrieved_(StringRef mode)
void control(const std::string &value) override
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
PROGMEM_STRING_TABLE(UnsetValues, "None", "unavailable", "unknown")
void add_entity_id(api::HomeassistantActionRequest &resp, const char *entity_id)
Adds the entity_id entry to an action's data.
bool can_send_action(const char *tag, const char *entity_id, EntityBase *entity)
Logs and returns false when no API client is connected or no entity is linked yet.
ESPHOME_LOG_TAG(TAG, "homeassistant.binary_sensor")
bool is_input_helper(const char *entity_id, const char *input_service)
True if entity_id is an input helper; input_service must start with "input_".
static void const char const char * state
constexpr ColorMode COLOR_MODE_LOOKUP[] PROGMEM
int16_t progmem_string_table_find(const char *value, size_t len)
The index of the string value (len bytes, in RAM) in a PROGMEM_STRING_TABLE, or -1 when it is not one...
optional< T > parse_number(const char *str)
Parse an unsigned decimal number from a null-terminated string.