6namespace homeassistant {
8static const char *
const TAG =
"homeassistant.binary_sensor";
17 ESP_LOGW(TAG,
"Can't convert '%s' to binary state!",
state.c_str());
23 ESP_LOGD(TAG,
"'%s::%s': Got attribute state %s", this->
entity_id_.c_str(),
24 this->attribute_.value().c_str(), ONOFF(new_state));
26 ESP_LOGD(TAG,
"'%s': Got state %s", this->
entity_id_.c_str(), ONOFF(new_state));
39 LOG_BINARY_SENSOR(
"",
"Homeassistant Binary Sensor",
this);
40 ESP_LOGCONFIG(TAG,
" Entity ID: '%s'", this->
entity_id_.c_str());
42 ESP_LOGCONFIG(TAG,
" Attribute: '%s'", this->
attribute_.
value().c_str());
void subscribe_home_assistant_state(std::string entity_id, optional< std::string > attribute, std::function< void(std::string)> f)
void publish_initial_state(bool state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
bool state
The current reported state of the binary sensor.
void publish_state(bool state)
Publish a new state to the front-end.
void dump_config() override
optional< std::string > attribute_
float get_setup_priority() const override
value_type const & value() const
APIServer * global_api_server
const float AFTER_WIFI
For components that should be initialized after WiFi 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.