ESPHome
2024.10.2
|
#include <text_sensor.h>
Public Member Functions | |
std::string | get_state () const |
Getter-syntax for .state. More... | |
std::string | get_raw_state () const |
Getter-syntax for .raw_state. More... | |
void | publish_state (const std::string &state) |
void | add_filter (Filter *filter) |
Add a filter to the filter chain. Will be appended to the back. More... | |
void | add_filters (const std::vector< Filter *> &filters) |
Add a list of vectors to the back of the filter chain. More... | |
void | set_filters (const std::vector< Filter *> &filters) |
Clear the filters and replace them by filters. More... | |
void | clear_filters () |
Clear the entire filter chain. More... | |
void | add_on_state_callback (std::function< void(std::string)> callback) |
void | add_on_raw_state_callback (std::function< void(std::string)> callback) |
Add a callback that will be called every time the sensor sends a raw value. More... | |
virtual std::string | unique_id () |
Override this method to set the unique ID of this sensor. More... | |
bool | has_state () |
void | internal_send_state_to_frontend (const std::string &state) |
Public Member Functions inherited from esphome::EntityBase | |
const StringRef & | get_name () const |
void | set_name (const char *name) |
bool | has_own_name () const |
std::string | get_object_id () const |
void | set_object_id (const char *object_id) |
uint32_t | get_object_id_hash () |
bool | is_internal () const |
void | set_internal (bool internal) |
bool | is_disabled_by_default () const |
void | set_disabled_by_default (bool disabled_by_default) |
EntityCategory | get_entity_category () const |
void | set_entity_category (EntityCategory entity_category) |
std::string | get_icon () const |
void | set_icon (const char *icon) |
Public Member Functions inherited from esphome::EntityBase_DeviceClass | |
std::string | get_device_class () |
Get the device class, using the manual override if set. More... | |
void | set_device_class (const char *device_class) |
Manually set the device class. More... | |
Data Fields | |
std::string | state |
std::string | raw_state |
Protected Attributes | |
CallbackManager< void(std::string)> | raw_callback_ |
Storage for raw state callbacks. More... | |
CallbackManager< void(std::string)> | callback_ |
Storage for filtered state callbacks. More... | |
Filter * | filter_list_ {nullptr} |
Store all active filters. More... | |
bool | has_state_ {false} |
Protected Attributes inherited from esphome::EntityBase | |
StringRef | name_ |
const char * | object_id_c_str_ {nullptr} |
const char * | icon_c_str_ {nullptr} |
uint32_t | object_id_hash_ |
bool | has_own_name_ {false} |
bool | internal_ {false} |
bool | disabled_by_default_ {false} |
EntityCategory | entity_category_ {ENTITY_CATEGORY_NONE} |
Protected Attributes inherited from esphome::EntityBase_DeviceClass | |
const char * | device_class_ {nullptr} |
Device class override. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from esphome::EntityBase | |
virtual uint32_t | hash_base () |
The hash_base() function has been deprecated. More... | |
void | calc_object_id_ () |
Definition at line 34 of file text_sensor.h.
void esphome::text_sensor::TextSensor::add_filter | ( | Filter * | filter | ) |
Add a filter to the filter chain. Will be appended to the back.
Definition at line 22 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::add_filters | ( | const std::vector< Filter *> & | filters | ) |
Add a list of vectors to the back of the filter chain.
Definition at line 36 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::add_on_raw_state_callback | ( | std::function< void(std::string)> | callback | ) |
Add a callback that will be called every time the sensor sends a raw value.
Definition at line 55 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::add_on_state_callback | ( | std::function< void(std::string)> | callback | ) |
Definition at line 52 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::clear_filters | ( | ) |
Clear the entire filter chain.
Definition at line 45 of file text_sensor.cpp.
std::string esphome::text_sensor::TextSensor::get_raw_state | ( | ) | const |
Getter-syntax for .raw_state.
Definition at line 60 of file text_sensor.cpp.
std::string esphome::text_sensor::TextSensor::get_state | ( | ) | const |
Getter-syntax for .state.
Definition at line 59 of file text_sensor.cpp.
bool esphome::text_sensor::TextSensor::has_state | ( | ) |
Definition at line 69 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::internal_send_state_to_frontend | ( | const std::string & | state | ) |
Definition at line 61 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::publish_state | ( | const std::string & | state | ) |
Definition at line 9 of file text_sensor.cpp.
void esphome::text_sensor::TextSensor::set_filters | ( | const std::vector< Filter *> & | filters | ) |
Clear the filters and replace them by filters.
Definition at line 41 of file text_sensor.cpp.
|
virtual |
Override this method to set the unique ID of this sensor.
Reimplemented in esphome::wifi_info::MacAddressWifiInfo, esphome::wifi_info::BSSIDWiFiInfo, esphome::wifi_info::SSIDWiFiInfo, esphome::wifi_info::ScanResultsWiFiInfo, esphome::ethernet_info::MACAddressEthernetInfo, esphome::ethernet_info::DNSAddressEthernetInfo, esphome::wifi_info::DNSAddressWifiInfo, esphome::ethernet_info::IPAddressEthernetInfo, esphome::wifi_info::IPAddressWiFiInfo, and esphome::version::VersionTextSensor.
Definition at line 68 of file text_sensor.cpp.
|
protected |
Storage for filtered state callbacks.
Definition at line 76 of file text_sensor.h.
|
protected |
Store all active filters.
Definition at line 78 of file text_sensor.h.
|
protected |
Definition at line 80 of file text_sensor.h.
|
protected |
Storage for raw state callbacks.
Definition at line 75 of file text_sensor.h.
std::string esphome::text_sensor::TextSensor::raw_state |
Definition at line 60 of file text_sensor.h.
std::string esphome::text_sensor::TextSensor::state |
Definition at line 59 of file text_sensor.h.