ESPHome  2021.9.1
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::text_sensor::TextSensor Class Reference

#include <text_sensor.h>

Inheritance diagram for esphome::text_sensor::TextSensor:
esphome::Nameable esphome::ble_scanner::BLEScanner esphome::demo::DemoTextSensor esphome::homeassistant::HomeassistantTextSensor esphome::mqtt_subscribe::MQTTSubscribeTextSensor esphome::nextion::NextionTextSensor esphome::pipsolar::PipsolarTextSensor esphome::sun::SunTextSensor esphome::teleinfo::TeleInfoTextSensor esphome::template_::TemplateTextSensor esphome::version::VersionTextSensor esphome::wifi_info::BSSIDWiFiInfo esphome::wifi_info::IPAddressWiFiInfo esphome::wifi_info::MacAddressWifiInfo esphome::wifi_info::SSIDWiFiInfo

Public Member Functions

 TextSensor ()
 TextSensor (const std::string &name)
void publish_state (const std::string &state)
void set_icon (const std::string &icon)
void add_on_state_callback (std::function< void(std::string)> callback)
std::string get_icon ()
virtual std::string icon ()
virtual std::string unique_id ()
bool has_state ()
- Public Member Functions inherited from esphome::Nameable
 Nameable ()
 Nameable (std::string name)
const std::string & get_name () const
void set_name (const std::string &name)
const std::string & get_object_id ()
 Get the sanitized name of this nameable as an ID. Caching it internally. More...
uint32_t get_object_id_hash ()
bool is_internal () const
void set_internal (bool internal)
bool is_disabled_by_default () const
 Check if this object is declared to be disabled by default. More...
void set_disabled_by_default (bool disabled_by_default)

Data Fields

std::string state

Protected Member Functions

uint32_t hash_base () override
- Protected Member Functions inherited from esphome::Nameable
void calc_object_id_ ()

Protected Attributes

CallbackManager< void(std::string)> callback_
optional< std::string > icon_
bool has_state_ {false}
- Protected Attributes inherited from esphome::Nameable
std::string name_
std::string object_id_
uint32_t object_id_hash_
bool internal_ {false}
bool disabled_by_default_ {false}

Detailed Description

Definition at line 20 of file text_sensor.h.

Constructor & Destructor Documentation

◆ TextSensor() [1/2]

esphome::text_sensor::TextSensor::TextSensor ( )

Definition at line 9 of file text_sensor.cpp.

◆ TextSensor() [2/2]

esphome::text_sensor::TextSensor::TextSensor ( const std::string &  name)

Definition at line 10 of file text_sensor.cpp.

Member Function Documentation

◆ add_on_state_callback()

void esphome::text_sensor::TextSensor::add_on_state_callback ( std::function< void(std::string)>  callback)

Definition at line 19 of file text_sensor.cpp.

◆ get_icon()

std::string esphome::text_sensor::TextSensor::get_icon ( )

Definition at line 22 of file text_sensor.cpp.

◆ has_state()

bool esphome::text_sensor::TextSensor::has_state ( )

Definition at line 29 of file text_sensor.cpp.

◆ hash_base()

uint32_t esphome::text_sensor::TextSensor::hash_base ( )

Implements esphome::Nameable.

Definition at line 30 of file text_sensor.cpp.

◆ icon()

std::string esphome::text_sensor::TextSensor::icon ( )

Definition at line 27 of file text_sensor.cpp.

◆ publish_state()

void esphome::text_sensor::TextSensor::publish_state ( const std::string &  state)

Definition at line 12 of file text_sensor.cpp.

◆ set_icon()

void esphome::text_sensor::TextSensor::set_icon ( const std::string &  icon)

Definition at line 18 of file text_sensor.cpp.

◆ unique_id()

std::string esphome::text_sensor::TextSensor::unique_id ( )

Field Documentation

◆ callback_

CallbackManager<void(std::string)> esphome::text_sensor::TextSensor::callback_

Definition at line 46 of file text_sensor.h.

◆ has_state_

bool esphome::text_sensor::TextSensor::has_state_ {false}

Definition at line 48 of file text_sensor.h.

◆ icon_

optional<std::string> esphome::text_sensor::TextSensor::icon_

Definition at line 47 of file text_sensor.h.

◆ state

std::string esphome::text_sensor::TextSensor::state

Definition at line 31 of file text_sensor.h.

The documentation for this class was generated from the following files: