ESPHome  2024.12.2
Public Member Functions | Protected Attributes
esphome::hlw8012::HLW8012Component Class Reference

#include <hlw8012.h>

Inheritance diagram for esphome::hlw8012::HLW8012Component:
esphome::PollingComponent esphome::Component

Public Member Functions

 HLW8012Component ()
 
void setup () override
 
void dump_config () override
 
float get_setup_priority () const override
 
void update () override
 
void set_initial_mode (HLW8012InitialMode initial_mode)
 
void set_sensor_model (HLW8012SensorModels sensor_model)
 
void set_change_mode_every (uint32_t change_mode_every)
 
void set_current_resistor (float current_resistor)
 
void set_voltage_divider (float voltage_divider)
 
void set_sel_pin (GPIOPin *sel_pin)
 
void set_cf_pin (InternalGPIOPin *cf_pin)
 
void set_cf1_pin (InternalGPIOPin *cf1_pin)
 
void set_voltage_sensor (sensor::Sensor *voltage_sensor)
 
void set_current_sensor (sensor::Sensor *current_sensor)
 
void set_power_sensor (sensor::Sensor *power_sensor)
 
void set_energy_sensor (sensor::Sensor *energy_sensor)
 
- Public Member Functions inherited from esphome::PollingComponent
 PollingComponent ()
 
 PollingComponent (uint32_t update_interval)
 Initialize this polling component with the given update interval in ms. More...
 
virtual void set_update_interval (uint32_t update_interval)
 Manually set the update interval in ms for this polling object. More...
 
void call_setup () override
 
virtual uint32_t get_update_interval () const
 Get the update interval in ms of this sensor. More...
 
void start_poller ()
 
void stop_poller ()
 
- Public Member Functions inherited from esphome::Component
virtual void loop ()
 This method will be called repeatedly. More...
 
float get_actual_setup_priority () const
 
void set_setup_priority (float priority)
 
virtual float get_loop_priority () const
 priority of loop(). More...
 
void call ()
 
virtual void on_shutdown ()
 
virtual void on_safe_shutdown ()
 
uint32_t get_component_state () const
 
virtual void mark_failed ()
 Mark this component as failed. More...
 
bool is_failed () const
 
bool is_ready () const
 
virtual bool can_proceed ()
 
bool status_has_warning () const
 
bool status_has_error () const
 
void status_set_warning (const char *message="unspecified")
 
void status_set_error (const char *message="unspecified")
 
void status_clear_warning ()
 
void status_clear_error ()
 
void status_momentary_warning (const std::string &name, uint32_t length=5000)
 
void status_momentary_error (const std::string &name, uint32_t length=5000)
 
bool has_overridden_loop () const
 
void set_component_source (const char *source)
 Set where this component was loaded from for some debug messages. More...
 
const char * get_component_source () const
 Get the integration where this component was declared as a string. More...
 

Protected Attributes

uint32_t nth_value_ {0}
 
bool current_mode_ {false}
 
uint32_t change_mode_at_ {0}
 
uint32_t change_mode_every_ {8}
 
float current_resistor_ {0.001}
 
float voltage_divider_ {2351}
 
HLW8012SensorModels sensor_model_ {HLW8012_SENSOR_MODEL_HLW8012}
 
uint64_t cf_total_pulses_ {0}
 
GPIOPinsel_pin_
 
InternalGPIOPincf_pin_
 
pulse_counter::PulseCounterStorageBasecf_store_
 
InternalGPIOPincf1_pin_
 
pulse_counter::PulseCounterStorageBasecf1_store_
 
sensor::Sensorvoltage_sensor_ {nullptr}
 
sensor::Sensorcurrent_sensor_ {nullptr}
 
sensor::Sensorpower_sensor_ {nullptr}
 
sensor::Sensorenergy_sensor_ {nullptr}
 
float voltage_multiplier_ {0.0f}
 
float current_multiplier_ {0.0f}
 
float power_multiplier_ {0.0f}
 
- Protected Attributes inherited from esphome::PollingComponent
uint32_t update_interval_
 
- Protected Attributes inherited from esphome::Component
uint32_t component_state_ {0x0000}
 State of this component. More...
 
float setup_priority_override_ {NAN}
 
const char * component_source_ {nullptr}
 

Additional Inherited Members

- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_dump_config ()
 
void set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f)
 Set an interval function with a unique name. More...
 
void set_interval (uint32_t interval, std::function< void()> &&f)
 
bool cancel_interval (const std::string &name)
 Cancel an interval function. More...
 
void set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 Set an retry function with a unique name. More...
 
void set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f)
 
bool cancel_retry (const std::string &name)
 Cancel a retry function. More...
 
void set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f)
 Set a timeout function with a unique name. More...
 
void set_timeout (uint32_t timeout, std::function< void()> &&f)
 
bool cancel_timeout (const std::string &name)
 Cancel a timeout function. More...
 
void defer (const std::string &name, std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
void defer (std::function< void()> &&f)
 Defer a callback to the next loop() call. More...
 
bool cancel_defer (const std::string &name)
 Cancel a defer callback using the specified name, name must not be empty. More...
 

Detailed Description

Definition at line 27 of file hlw8012.h.

Constructor & Destructor Documentation

◆ HLW8012Component()

esphome::hlw8012::HLW8012Component::HLW8012Component ( )
inline

Definition at line 29 of file hlw8012.h.

Member Function Documentation

◆ dump_config()

void esphome::hlw8012::HLW8012Component::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 36 of file hlw8012.cpp.

◆ get_setup_priority()

float esphome::hlw8012::HLW8012Component::get_setup_priority ( ) const
overridevirtual

Reimplemented from esphome::Component.

Definition at line 50 of file hlw8012.cpp.

◆ set_cf1_pin()

void esphome::hlw8012::HLW8012Component::set_cf1_pin ( InternalGPIOPin cf1_pin)
inline

Definition at line 46 of file hlw8012.h.

◆ set_cf_pin()

void esphome::hlw8012::HLW8012Component::set_cf_pin ( InternalGPIOPin cf_pin)
inline

Definition at line 45 of file hlw8012.h.

◆ set_change_mode_every()

void esphome::hlw8012::HLW8012Component::set_change_mode_every ( uint32_t  change_mode_every)
inline

Definition at line 41 of file hlw8012.h.

◆ set_current_resistor()

void esphome::hlw8012::HLW8012Component::set_current_resistor ( float  current_resistor)
inline

Definition at line 42 of file hlw8012.h.

◆ set_current_sensor()

void esphome::hlw8012::HLW8012Component::set_current_sensor ( sensor::Sensor current_sensor)
inline

Definition at line 48 of file hlw8012.h.

◆ set_energy_sensor()

void esphome::hlw8012::HLW8012Component::set_energy_sensor ( sensor::Sensor energy_sensor)
inline

Definition at line 50 of file hlw8012.h.

◆ set_initial_mode()

void esphome::hlw8012::HLW8012Component::set_initial_mode ( HLW8012InitialMode  initial_mode)
inline

Definition at line 37 of file hlw8012.h.

◆ set_power_sensor()

void esphome::hlw8012::HLW8012Component::set_power_sensor ( sensor::Sensor power_sensor)
inline

Definition at line 49 of file hlw8012.h.

◆ set_sel_pin()

void esphome::hlw8012::HLW8012Component::set_sel_pin ( GPIOPin sel_pin)
inline

Definition at line 44 of file hlw8012.h.

◆ set_sensor_model()

void esphome::hlw8012::HLW8012Component::set_sensor_model ( HLW8012SensorModels  sensor_model)
inline

Definition at line 40 of file hlw8012.h.

◆ set_voltage_divider()

void esphome::hlw8012::HLW8012Component::set_voltage_divider ( float  voltage_divider)
inline

Definition at line 43 of file hlw8012.h.

◆ set_voltage_sensor()

void esphome::hlw8012::HLW8012Component::set_voltage_sensor ( sensor::Sensor voltage_sensor)
inline

Definition at line 47 of file hlw8012.h.

◆ setup()

void esphome::hlw8012::HLW8012Component::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 12 of file hlw8012.cpp.

◆ update()

void esphome::hlw8012::HLW8012Component::update ( )
overridevirtual

Implements esphome::PollingComponent.

Definition at line 51 of file hlw8012.cpp.

Field Documentation

◆ cf1_pin_

InternalGPIOPin* esphome::hlw8012::HLW8012Component::cf1_pin_
protected

Definition at line 64 of file hlw8012.h.

◆ cf1_store_

pulse_counter::PulseCounterStorageBase& esphome::hlw8012::HLW8012Component::cf1_store_
protected

Definition at line 65 of file hlw8012.h.

◆ cf_pin_

InternalGPIOPin* esphome::hlw8012::HLW8012Component::cf_pin_
protected

Definition at line 62 of file hlw8012.h.

◆ cf_store_

pulse_counter::PulseCounterStorageBase& esphome::hlw8012::HLW8012Component::cf_store_
protected

Definition at line 63 of file hlw8012.h.

◆ cf_total_pulses_

uint64_t esphome::hlw8012::HLW8012Component::cf_total_pulses_ {0}
protected

Definition at line 60 of file hlw8012.h.

◆ change_mode_at_

uint32_t esphome::hlw8012::HLW8012Component::change_mode_at_ {0}
protected

Definition at line 55 of file hlw8012.h.

◆ change_mode_every_

uint32_t esphome::hlw8012::HLW8012Component::change_mode_every_ {8}
protected

Definition at line 56 of file hlw8012.h.

◆ current_mode_

bool esphome::hlw8012::HLW8012Component::current_mode_ {false}
protected

Definition at line 54 of file hlw8012.h.

◆ current_multiplier_

float esphome::hlw8012::HLW8012Component::current_multiplier_ {0.0f}
protected

Definition at line 72 of file hlw8012.h.

◆ current_resistor_

float esphome::hlw8012::HLW8012Component::current_resistor_ {0.001}
protected

Definition at line 57 of file hlw8012.h.

◆ current_sensor_

sensor::Sensor* esphome::hlw8012::HLW8012Component::current_sensor_ {nullptr}
protected

Definition at line 67 of file hlw8012.h.

◆ energy_sensor_

sensor::Sensor* esphome::hlw8012::HLW8012Component::energy_sensor_ {nullptr}
protected

Definition at line 69 of file hlw8012.h.

◆ nth_value_

uint32_t esphome::hlw8012::HLW8012Component::nth_value_ {0}
protected

Definition at line 53 of file hlw8012.h.

◆ power_multiplier_

float esphome::hlw8012::HLW8012Component::power_multiplier_ {0.0f}
protected

Definition at line 73 of file hlw8012.h.

◆ power_sensor_

sensor::Sensor* esphome::hlw8012::HLW8012Component::power_sensor_ {nullptr}
protected

Definition at line 68 of file hlw8012.h.

◆ sel_pin_

GPIOPin* esphome::hlw8012::HLW8012Component::sel_pin_
protected

Definition at line 61 of file hlw8012.h.

◆ sensor_model_

HLW8012SensorModels esphome::hlw8012::HLW8012Component::sensor_model_ {HLW8012_SENSOR_MODEL_HLW8012}
protected

Definition at line 59 of file hlw8012.h.

◆ voltage_divider_

float esphome::hlw8012::HLW8012Component::voltage_divider_ {2351}
protected

Definition at line 58 of file hlw8012.h.

◆ voltage_multiplier_

float esphome::hlw8012::HLW8012Component::voltage_multiplier_ {0.0f}
protected

Definition at line 71 of file hlw8012.h.

◆ voltage_sensor_

sensor::Sensor* esphome::hlw8012::HLW8012Component::voltage_sensor_ {nullptr}
protected

Definition at line 66 of file hlw8012.h.


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