11#ifdef OPENTHERM_USE_SENSOR
15#ifdef OPENTHERM_USE_BINARY_SENSOR
19#ifdef OPENTHERM_USE_SWITCH
23#ifdef OPENTHERM_USE_OUTPUT
27#ifdef OPENTHERM_USE_NUMBER
32#include <unordered_map>
33#include <unordered_set>
41static const uint8_t REPEATING_MESSAGE_ORDER = 255;
42static const uint8_t INITIAL_UNORDERED_MESSAGE_ORDER = 254;
54 OPENTHERM_BINARY_SENSOR_LIST(OPENTHERM_DECLARE_BINARY_SENSOR, )
58 OPENTHERM_NUMBER_LIST(OPENTHERM_DECLARE_NUMBER, )
62 OPENTHERM_INPUT_SENSOR_LIST(OPENTHERM_DECLARE_INPUT_SENSOR, )
66 bool sending_initial_ = true;
100 template<typename F>
bool spin_wait_(uint32_t timeout, F func) {
101 auto start_time =
millis();
105 if (cur_time - start_time >= timeout) {
125 OPENTHERM_BINARY_SENSOR_LIST(OPENTHERM_SET_BINARY_SENSOR, )
129 OPENTHERM_NUMBER_LIST(OPENTHERM_SET_NUMBER, )
133 OPENTHERM_INPUT_SENSOR_LIST(OPENTHERM_SET_INPUT_SENSOR, )
172 void setup()
override;
174 void loop()
override;
BedjetMode mode
BedJet operating mode.
void set_cooling_enable(bool value)
void set_summer_mode_active(bool value)
OPENTHERM_SENSOR_LIST(OPENTHERM_DECLARE_SENSOR,) OPENTHERM_BINARY_SENSOR_LIST(OPENTHERM_DECLARE_BINARY_SENSOR
void check_timings_(uint32_t cur_time)
uint32_t last_conversation_end_
void dump_config() override
void on_shutdown() override
void set_in_pin(InternalGPIOPin *in_pin)
void handle_timer_error_()
std::vector< MessageId > messages_
OpenthermData build_request_(MessageId request_id) const
void set_sync_mode(bool sync_mode)
void start_conversation_()
void add_initial_message(MessageId message_id, uint8_t order)
void set_out_pin(InternalGPIOPin *out_pin)
void add_repeating_message(MessageId message_id)
OPENTHERM_SENSOR_LIST(OPENTHERM_SET_SENSOR,) OPENTHERM_BINARY_SENSOR_LIST(OPENTHERM_SET_BINARY_SENSOR
OPENTHERM_SETTING_LIST(OPENTHERM_DECLARE_SETTING,) bool sending_initial_
void set_dhw_enable(bool value)
InternalGPIOPin * out_pin_
std::unordered_map< MessageId, uint8_t > configured_messages_
void set_dhw_block(bool value)
void process_response(OpenthermData &data)
void add_on_before_process_response_callback(std::function< void(OpenthermData &)> &&callback)
OPENTHERM_SWITCH_LIST(OPENTHERM_DECLARE_SWITCH,) OPENTHERM_NUMBER_LIST(OPENTHERM_DECLARE_NUMBER
InternalGPIOPin * in_pin_
void set_otc_active(bool value)
CallbackManager< void(OpenthermData &)> before_send_callback_
bool handle_error_(OperationMode mode)
CallbackManager< void(OpenthermData &)> before_process_response_callback_
bool spin_wait_(uint32_t timeout, F func)
std::vector< MessageId >::const_iterator message_iterator_
uint32_t last_conversation_start_
float get_setup_priority() const override
void write_initial_messages_(std::vector< MessageId > &target)
void write_repeating_messages_(std::vector< MessageId > &target)
OpenthermData last_request_
void set_ch2_active(bool value)
bool should_skip_loop_(uint32_t cur_time) const
OPENTHERM_OUTPUT_LIST(OPENTHERM_DECLARE_OUTPUT,) OPENTHERM_INPUT_SENSOR_LIST(OPENTHERM_DECLARE_INPUT_SENSOR
void add_on_before_send_callback(std::function< void(OpenthermData &)> &&callback)
std::unique_ptr< OpenTherm > opentherm_
void set_ch_enable(bool value)
void handle_timeout_error_()
void handle_protocol_error_()
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Providing packet encoding functions for exchanging data with a remote host.
void IRAM_ATTR HOT yield()
uint32_t IRAM_ATTR HOT millis()
Structure to hold Opentherm data packet content.