ESPHome  2024.10.2
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
esphome::opentherm::OpenthermHub Class Reference

#include <hub.h>

Inheritance diagram for esphome::opentherm::OpenthermHub:
esphome::Component

Public Member Functions

 OpenthermHub ()
 
void process_response (OpenthermData &data)
 
void set_in_pin (InternalGPIOPin *in_pin)
 
void set_out_pin (InternalGPIOPin *out_pin)
 
void add_initial_message (MessageId message_id)
 
void add_repeating_message (MessageId message_id)
 
void set_ch_enable (bool value)
 
void set_dhw_enable (bool value)
 
void set_cooling_enable (bool value)
 
void set_otc_active (bool value)
 
void set_ch2_active (bool value)
 
void set_sync_mode (bool sync_mode)
 
float get_setup_priority () const override
 
void setup () override
 
void on_shutdown () override
 
void loop () override
 
void dump_config () override
 
- Public Member Functions inherited from esphome::Component
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_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...
 

Data Fields

bool ch_enable = true
 
bool dhw_enable = true
 
bool cooling_enable = false
 
bool otc_active = false
 
bool ch2_active = false
 

Protected Member Functions

OpenthermData build_request_ (MessageId request_id)
 
void handle_protocol_write_error_ ()
 
void handle_protocol_read_error_ ()
 
void handle_timeout_error_ ()
 
void stop_opentherm_ ()
 
void start_conversation_ ()
 
void read_response_ ()
 
bool check_timings_ (uint32_t cur_time)
 
bool should_skip_loop_ (uint32_t cur_time) const
 
void sync_loop_ ()
 
template<typename F >
bool spin_wait_ (uint32_t timeout, F func)
 
- Protected Member Functions inherited from esphome::Component
virtual void call_loop ()
 
virtual void call_setup ()
 
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...
 

Protected Attributes

InternalGPIOPinin_pin_
 
InternalGPIOPinout_pin_
 
std::unique_ptr< OpenThermopentherm_
 
std::unordered_set< MessageIdinitial_messages_
 
std::unordered_set< MessageIdrepeating_messages_
 
bool sending_initial_ = true
 
std::unordered_set< MessageId >::const_iterator current_message_iterator_
 
uint32_t last_conversation_start_ = 0
 
uint32_t last_conversation_end_ = 0
 
OperationMode last_mode_ = IDLE
 
OpenthermData last_request_
 
bool sync_mode_ = false
 
- 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}
 

Detailed Description

Definition at line 19 of file hub.h.

Constructor & Destructor Documentation

◆ OpenthermHub()

esphome::opentherm::OpenthermHub::OpenthermHub ( )

Definition at line 48 of file hub.cpp.

Member Function Documentation

◆ add_initial_message()

void esphome::opentherm::OpenthermHub::add_initial_message ( MessageId  message_id)
inline

Definition at line 82 of file hub.h.

◆ add_repeating_message()

void esphome::opentherm::OpenthermHub::add_repeating_message ( MessageId  message_id)
inline

Definition at line 87 of file hub.h.

◆ build_request_()

OpenthermData esphome::opentherm::OpenthermHub::build_request_ ( MessageId  request_id)
protected

Definition at line 11 of file hub.cpp.

◆ check_timings_()

bool esphome::opentherm::OpenthermHub::check_timings_ ( uint32_t  cur_time)
protected

Definition at line 180 of file hub.cpp.

◆ dump_config()

void esphome::opentherm::OpenthermHub::dump_config ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 261 of file hub.cpp.

◆ get_setup_priority()

float esphome::opentherm::OpenthermHub::get_setup_priority ( ) const
inlineoverridevirtual

Reimplemented from esphome::Component.

Definition at line 101 of file hub.h.

◆ handle_protocol_read_error_()

void esphome::opentherm::OpenthermHub::handle_protocol_read_error_ ( )
protected

Definition at line 246 of file hub.cpp.

◆ handle_protocol_write_error_()

void esphome::opentherm::OpenthermHub::handle_protocol_write_error_ ( )
protected

Definition at line 240 of file hub.cpp.

◆ handle_timeout_error_()

void esphome::opentherm::OpenthermHub::handle_timeout_error_ ( )
protected

Definition at line 252 of file hub.cpp.

◆ loop()

void esphome::opentherm::OpenthermHub::loop ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 75 of file hub.cpp.

◆ on_shutdown()

void esphome::opentherm::OpenthermHub::on_shutdown ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 73 of file hub.cpp.

◆ process_response()

void esphome::opentherm::OpenthermHub::process_response ( OpenthermData data)

Definition at line 50 of file hub.cpp.

◆ read_response_()

void esphome::opentherm::OpenthermHub::read_response_ ( )
protected

Definition at line 220 of file hub.cpp.

◆ set_ch2_active()

void esphome::opentherm::OpenthermHub::set_ch2_active ( bool  value)
inline

Definition at line 98 of file hub.h.

◆ set_ch_enable()

void esphome::opentherm::OpenthermHub::set_ch_enable ( bool  value)
inline

Definition at line 94 of file hub.h.

◆ set_cooling_enable()

void esphome::opentherm::OpenthermHub::set_cooling_enable ( bool  value)
inline

Definition at line 96 of file hub.h.

◆ set_dhw_enable()

void esphome::opentherm::OpenthermHub::set_dhw_enable ( bool  value)
inline

Definition at line 95 of file hub.h.

◆ set_in_pin()

void esphome::opentherm::OpenthermHub::set_in_pin ( InternalGPIOPin in_pin)
inline

Definition at line 78 of file hub.h.

◆ set_otc_active()

void esphome::opentherm::OpenthermHub::set_otc_active ( bool  value)
inline

Definition at line 97 of file hub.h.

◆ set_out_pin()

void esphome::opentherm::OpenthermHub::set_out_pin ( InternalGPIOPin out_pin)
inline

Definition at line 79 of file hub.h.

◆ set_sync_mode()

void esphome::opentherm::OpenthermHub::set_sync_mode ( bool  sync_mode)
inline

Definition at line 99 of file hub.h.

◆ setup()

void esphome::opentherm::OpenthermHub::setup ( )
overridevirtual

Reimplemented from esphome::Component.

Definition at line 56 of file hub.cpp.

◆ should_skip_loop_()

bool esphome::opentherm::OpenthermHub::should_skip_loop_ ( uint32_t  cur_time) const
protected

Definition at line 193 of file hub.cpp.

◆ spin_wait_()

template<typename F >
bool esphome::opentherm::OpenthermHub::spin_wait_ ( uint32_t  timeout,
func 
)
inlineprotected

Definition at line 58 of file hub.h.

◆ start_conversation_()

void esphome::opentherm::OpenthermHub::start_conversation_ ( )
protected

Definition at line 202 of file hub.cpp.

◆ stop_opentherm_()

void esphome::opentherm::OpenthermHub::stop_opentherm_ ( )
protected

Definition at line 235 of file hub.cpp.

◆ sync_loop_()

void esphome::opentherm::OpenthermHub::sync_loop_ ( )
protected

Definition at line 121 of file hub.cpp.

Field Documentation

◆ ch2_active

bool esphome::opentherm::OpenthermHub::ch2_active = false

Definition at line 91 of file hub.h.

◆ ch_enable

bool esphome::opentherm::OpenthermHub::ch_enable = true

Definition at line 91 of file hub.h.

◆ cooling_enable

bool esphome::opentherm::OpenthermHub::cooling_enable = false

Definition at line 91 of file hub.h.

◆ current_message_iterator_

std::unordered_set<MessageId>::const_iterator esphome::opentherm::OpenthermHub::current_message_iterator_
protected

Definition at line 34 of file hub.h.

◆ dhw_enable

bool esphome::opentherm::OpenthermHub::dhw_enable = true

Definition at line 91 of file hub.h.

◆ in_pin_

InternalGPIOPin* esphome::opentherm::OpenthermHub::in_pin_
protected

Definition at line 22 of file hub.h.

◆ initial_messages_

std::unordered_set<MessageId> esphome::opentherm::OpenthermHub::initial_messages_
protected

Definition at line 27 of file hub.h.

◆ last_conversation_end_

uint32_t esphome::opentherm::OpenthermHub::last_conversation_end_ = 0
protected

Definition at line 37 of file hub.h.

◆ last_conversation_start_

uint32_t esphome::opentherm::OpenthermHub::last_conversation_start_ = 0
protected

Definition at line 36 of file hub.h.

◆ last_mode_

OperationMode esphome::opentherm::OpenthermHub::last_mode_ = IDLE
protected

Definition at line 38 of file hub.h.

◆ last_request_

OpenthermData esphome::opentherm::OpenthermHub::last_request_
protected

Definition at line 39 of file hub.h.

◆ opentherm_

std::unique_ptr<OpenTherm> esphome::opentherm::OpenthermHub::opentherm_
protected

Definition at line 24 of file hub.h.

◆ otc_active

bool esphome::opentherm::OpenthermHub::otc_active = false

Definition at line 91 of file hub.h.

◆ out_pin_

InternalGPIOPin * esphome::opentherm::OpenthermHub::out_pin_
protected

Definition at line 22 of file hub.h.

◆ repeating_messages_

std::unordered_set<MessageId> esphome::opentherm::OpenthermHub::repeating_messages_
protected

Definition at line 30 of file hub.h.

◆ sending_initial_

bool esphome::opentherm::OpenthermHub::sending_initial_ = true
protected

Definition at line 32 of file hub.h.

◆ sync_mode_

bool esphome::opentherm::OpenthermHub::sync_mode_ = false
protected

Definition at line 44 of file hub.h.


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