ESPHome  2024.7.0
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::number::Number Class Referenceabstract

Base-class for all numbers. More...

#include <number.h>

Inheritance diagram for esphome::number::Number:
esphome::EntityBase esphome::copy::CopyNumber esphome::demo::DemoNumber esphome::ld2410::GateThresholdNumber esphome::ld2410::LightThresholdNumber esphome::ld2410::MaxDistanceTimeoutNumber esphome::ld2420::LD2420GateSelectNumber esphome::ld2420::LD2420MaxDistanceNumber esphome::ld2420::LD2420MinDistanceNumber esphome::ld2420::LD2420MoveSensFactorNumber esphome::ld2420::LD2420MoveThresholdNumbers esphome::ld2420::LD2420StillSensFactorNumber esphome::ld2420::LD2420StillThresholdNumbers esphome::ld2420::LD2420TimeoutNumber esphome::micronova::MicroNovaNumber esphome::modbus_controller::ModbusNumber esphome::seeed_mr24hpc1::CustomModeNumber esphome::seeed_mr24hpc1::CustomUnmanTimeNumber esphome::seeed_mr24hpc1::ExistenceThresholdNumber esphome::seeed_mr24hpc1::MotionThresholdNumber esphome::seeed_mr24hpc1::MotionToRestTimeNumber esphome::seeed_mr24hpc1::MotionTriggerTimeNumber esphome::seeed_mr24hpc1::SensitivityNumber esphome::sprinkler::SprinklerControllerNumber esphome::template_::TemplateNumber esphome::tuya::TuyaNumber

Public Member Functions

void publish_state (float state)
NumberCall make_call ()
void add_on_state_callback (std::function< void(float)> &&callback)
bool has_state () const
 Return whether this number has gotten a full state yet. More...
- 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)

Data Fields

float state
NumberTraits traits

Protected Member Functions

virtual void control (float value)=0
 Set the value of the number, this is a virtual method that each number integration must implement. More...
- Protected Member Functions inherited from esphome::EntityBase
virtual uint32_t hash_base ()
 The hash_base() function has been deprecated. More...
void calc_object_id_ ()

Protected Attributes

CallbackManager< void(float)> state_callback_
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}

Detailed Description

Base-class for all numbers.

A number can use publish_state to send out a new value.

Definition at line 39 of file number.h.

Member Function Documentation

◆ add_on_state_callback()

void esphome::number::Number::add_on_state_callback ( std::function< void(float)> &&  callback)

Definition at line 16 of file number.cpp.

◆ control()

virtual void esphome::number::Number::control ( float  value)
protectedpure virtual

◆ has_state()

bool esphome::number::Number::has_state ( ) const

Return whether this number has gotten a full state yet.

Definition at line 52 of file number.h.

◆ make_call()

NumberCall esphome::number::Number::make_call ( )

Definition at line 45 of file number.h.

◆ publish_state()

void esphome::number::Number::publish_state ( float  state)

Definition at line 9 of file number.cpp.

Field Documentation

◆ has_state_

bool esphome::number::Number::has_state_ {false}

Definition at line 66 of file number.h.

◆ state

float esphome::number::Number::state

Definition at line 41 of file number.h.

◆ state_callback_

CallbackManager<void(float)> esphome::number::Number::state_callback_

Definition at line 65 of file number.h.

◆ traits

NumberTraits esphome::number::Number::traits

Definition at line 49 of file number.h.

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