ESPHome 2025.8.0b2
Loading...
Searching...
No Matches
esphome::esp32_touch::ESP32TouchBinarySensor Class Reference

Simple helper class to expose a touch pad value as a binary sensor. More...

#include <esp32_touch.h>

Inheritance diagram for esphome::esp32_touch::ESP32TouchBinarySensor:
esphome::binary_sensor::BinarySensor esphome::StatefulEntityBase< bool > esphome::EntityBase_DeviceClass esphome::EntityBase

Public Member Functions

 ESP32TouchBinarySensor (touch_pad_t touch_pad, uint32_t threshold, uint32_t wakeup_threshold)
 
touch_pad_t get_touch_pad () const
 
uint32_t get_threshold () const
 
void set_threshold (uint32_t threshold)
 
uint32_t get_value () const
 Get the raw touch measurement value.
 
uint32_t get_wakeup_threshold () const
 
- Public Member Functions inherited from esphome::binary_sensor::BinarySensor
 BinarySensor ()
 
void publish_state (bool new_state)
 Publish a new state to the front-end.
 
void publish_initial_state (bool new_state)
 Publish the initial state, this will not make the callback manager send callbacks and is meant only for the initial state on boot.
 
void add_filter (Filter *filter)
 
void add_filters (const std::vector< Filter * > &filters)
 
void send_state_internal (bool new_state)
 
virtual bool is_status_binary_sensor () const
 Return whether this binary sensor has outputted a state.
 
- Public Member Functions inherited from esphome::StatefulEntityBase< bool >
virtual bool has_state () const
 
virtual const bool & get_state () const
 
virtual bool get_state_default (bool default_value) const
 
void invalidate_state ()
 
void add_full_state_callback (std::function< void(optional< bool > previous, optional< bool > current)> &&callback)
 
void add_on_state_callback (std::function< void(bool)> &&callback)
 
void set_trigger_on_initial_state (bool trigger_on_initial_state)
 
- Public Member Functions inherited from esphome::EntityBase
const StringRefget_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)
 
StringRef get_icon_ref () const
 
uint32_t get_device_id () const
 
void set_device (Device *device)
 
bool has_state () const
 
void set_has_state (bool state)
 
- Public Member Functions inherited from esphome::EntityBase_DeviceClass
std::string get_device_class ()
 Get the device class, using the manual override if set.
 
void set_device_class (const char *device_class)
 Manually set the device class.
 
StringRef get_device_class_ref () const
 Get the device class as StringRef.
 

Protected Attributes

friend ESP32TouchComponent
 
touch_pad_t touch_pad_ {TOUCH_PAD_MAX}
 
uint32_t threshold_ {0}
 
uint32_t benchmark_ {}
 
uint32_t value_ {0}
 Stores the last raw touch measurement value.
 
bool last_state_ {false}
 
const uint32_t wakeup_threshold_ {0}
 
uint32_t last_touch_time_ {}
 
bool initial_state_published_ {}
 
- Protected Attributes inherited from esphome::binary_sensor::BinarySensor
Filterfilter_list_ {nullptr}
 
- Protected Attributes inherited from esphome::StatefulEntityBase< bool >
optional< bool > state_
 
bool trigger_on_initial_state_
 
CallbackManager< void(optional< bool > previous, optional< bool > current)> * full_state_callbacks_
 
CallbackManager< void(bool)> * state_callbacks_
 
- 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_ {}
 
Devicedevice_ {}
 
struct esphome::EntityBase::EntityFlags flags_
 
- Protected Attributes inherited from esphome::EntityBase_DeviceClass
const char * device_class_ {nullptr}
 Device class override.
 

Additional Inherited Members

- Data Fields inherited from esphome::binary_sensor::BinarySensor
bool state {}
 
- Protected Member Functions inherited from esphome::StatefulEntityBase< bool >
bool set_state_ (const optional< bool > &state)
 Set a new state for this entity.
 
- Protected Member Functions inherited from esphome::EntityBase
virtual uint32_t hash_base ()
 The hash_base() function has been deprecated.
 
void calc_object_id_ ()
 

Detailed Description

Simple helper class to expose a touch pad value as a binary sensor.

Definition at line 229 of file esp32_touch.h.

Constructor & Destructor Documentation

◆ ESP32TouchBinarySensor()

esphome::esp32_touch::ESP32TouchBinarySensor::ESP32TouchBinarySensor ( touch_pad_t touch_pad,
uint32_t threshold,
uint32_t wakeup_threshold )
inline

Definition at line 231 of file esp32_touch.h.

Member Function Documentation

◆ get_threshold()

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::get_threshold ( ) const
inline

Definition at line 235 of file esp32_touch.h.

◆ get_touch_pad()

touch_pad_t esphome::esp32_touch::ESP32TouchBinarySensor::get_touch_pad ( ) const
inline

Definition at line 234 of file esp32_touch.h.

◆ get_value()

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::get_value ( ) const
inline

Get the raw touch measurement value.

Note
Although this method may appear unused within the component, it is a public API used by lambdas in user configurations for custom touch value processing.
Returns
The current raw touch sensor reading

Definition at line 242 of file esp32_touch.h.

◆ get_wakeup_threshold()

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::get_wakeup_threshold ( ) const
inline

Definition at line 244 of file esp32_touch.h.

◆ set_threshold()

void esphome::esp32_touch::ESP32TouchBinarySensor::set_threshold ( uint32_t threshold)
inline

Definition at line 236 of file esp32_touch.h.

Field Documentation

◆ benchmark_

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::benchmark_ {}
protected

Definition at line 251 of file esp32_touch.h.

◆ ESP32TouchComponent

friend esphome::esp32_touch::ESP32TouchBinarySensor::ESP32TouchComponent
protected

Definition at line 247 of file esp32_touch.h.

◆ initial_state_published_

bool esphome::esp32_touch::ESP32TouchBinarySensor::initial_state_published_ {}
protected

Definition at line 265 of file esp32_touch.h.

◆ last_state_

bool esphome::esp32_touch::ESP32TouchBinarySensor::last_state_ {false}
protected

Definition at line 254 of file esp32_touch.h.

◆ last_touch_time_

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::last_touch_time_ {}
protected

Definition at line 264 of file esp32_touch.h.

◆ threshold_

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::threshold_ {0}
protected

Definition at line 250 of file esp32_touch.h.

◆ touch_pad_

touch_pad_t esphome::esp32_touch::ESP32TouchBinarySensor::touch_pad_ {TOUCH_PAD_MAX}
protected

Definition at line 249 of file esp32_touch.h.

◆ value_

uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::value_ {0}
protected

Stores the last raw touch measurement value.

Definition at line 253 of file esp32_touch.h.

◆ wakeup_threshold_

const uint32_t esphome::esp32_touch::ESP32TouchBinarySensor::wakeup_threshold_ {0}
protected

Definition at line 255 of file esp32_touch.h.


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