7namespace homeassistant {
9static const char *
const TAG =
"homeassistant.switch";
19 ESP_LOGW(TAG,
"Can't convert '%s' to binary state!",
state.c_str());
24 ESP_LOGD(TAG,
"'%s': Got state %s", this->
entity_id_, ONOFF(new_state));
32 LOG_SWITCH(
"",
"Homeassistant Switch",
this);
33 ESP_LOGCONFIG(TAG,
" Entity ID: '%s'", this->
entity_id_);
40 ESP_LOGE(TAG,
"No clients connected to API server");
56 auto &entity_id_kv = resp.
data.emplace_back();
57 entity_id_kv.key = ENTITY_ID_KEY;
StringRef is a reference to a string owned by something else.
static constexpr StringRef from_lit(const CharT(&s)[N])
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 write_state(bool state) override
float get_setup_priority() const override
void dump_config() override
bool state
The current reported state of the binary sensor.
void publish_state(bool state)
Publish a state to the front-end from the back-end.
APIServer * global_api_server
const float AFTER_CONNECTION
For components that should be initialized after a data connection (API/MQTT) is connected.
Providing packet encoding functions for exchanging data with a remote host.
ParseOnOffState parse_on_off(const char *str, const char *on, const char *off)
Parse a string that contains either on, off or toggle.