13 #ifndef OPENTHERM_SENSOR_LIST 14 #define OPENTHERM_SENSOR_LIST(F, sep) 16 #ifndef OPENTHERM_BINARY_SENSOR_LIST 17 #define OPENTHERM_BINARY_SENSOR_LIST(F, sep) 19 #ifndef OPENTHERM_SWITCH_LIST 20 #define OPENTHERM_SWITCH_LIST(F, sep) 22 #ifndef OPENTHERM_NUMBER_LIST 23 #define OPENTHERM_NUMBER_LIST(F, sep) 25 #ifndef OPENTHERM_OUTPUT_LIST 26 #define OPENTHERM_OUTPUT_LIST(F, sep) 28 #ifndef OPENTHERM_INPUT_SENSOR_LIST 29 #define OPENTHERM_INPUT_SENSOR_LIST(F, sep) 31 #ifndef OPENTHERM_SETTING_LIST 32 #define OPENTHERM_SETTING_LIST(F, sep) 36 #define OPENTHERM_DECLARE_SENSOR(entity) sensor::Sensor *entity; 37 #define OPENTHERM_DECLARE_BINARY_SENSOR(entity) binary_sensor::BinarySensor *entity; 38 #define OPENTHERM_DECLARE_SWITCH(entity) OpenthermSwitch *entity; 39 #define OPENTHERM_DECLARE_NUMBER(entity) OpenthermNumber *entity; 40 #define OPENTHERM_DECLARE_OUTPUT(entity) OpenthermOutput *entity; 41 #define OPENTHERM_DECLARE_INPUT_SENSOR(entity) sensor::Sensor *entity; 42 #define OPENTHERM_DECLARE_SETTING(type, entity, def) type entity = def; 45 #define OPENTHERM_SET_SENSOR(entity) \ 46 void set_##entity(sensor::Sensor *sensor) { this->entity = sensor; } 48 #define OPENTHERM_SET_BINARY_SENSOR(entity) \ 49 void set_##entity(binary_sensor::BinarySensor *binary_sensor) { this->entity = binary_sensor; } 51 #define OPENTHERM_SET_SWITCH(entity) \ 52 void set_##entity(OpenthermSwitch *sw) { this->entity = sw; } 54 #define OPENTHERM_SET_NUMBER(entity) \ 55 void set_##entity(OpenthermNumber *number) { this->entity = number; } 57 #define OPENTHERM_SET_OUTPUT(entity) \ 58 void set_##entity(OpenthermOutput *output) { this->entity = output; } 60 #define OPENTHERM_SET_INPUT_SENSOR(entity) \ 61 void set_##entity(sensor::Sensor *sensor) { this->entity = sensor; } 63 #define OPENTHERM_SET_SETTING(type, entity, def) \ 64 void set_##entity(type value) { this->entity = value; } 77 #ifndef OPENTHERM_SENSOR_MESSAGE_HANDLERS 78 #define OPENTHERM_SENSOR_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 80 #ifndef OPENTHERM_BINARY_SENSOR_MESSAGE_HANDLERS 81 #define OPENTHERM_BINARY_SENSOR_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 83 #ifndef OPENTHERM_SWITCH_MESSAGE_HANDLERS 84 #define OPENTHERM_SWITCH_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 86 #ifndef OPENTHERM_NUMBER_MESSAGE_HANDLERS 87 #define OPENTHERM_NUMBER_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 89 #ifndef OPENTHERM_OUTPUT_MESSAGE_HANDLERS 90 #define OPENTHERM_OUTPUT_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 92 #ifndef OPENTHERM_INPUT_SENSOR_MESSAGE_HANDLERS 93 #define OPENTHERM_INPUT_SENSOR_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 95 #ifndef OPENTHERM_SETTING_MESSAGE_HANDLERS 96 #define OPENTHERM_SETTING_MESSAGE_HANDLERS(MESSAGE, ENTITY, entity_sep, postscript, msg_sep) 100 #define OPENTHERM_MESSAGE_WRITE_MESSAGE(msg) \ 101 case MessageId::msg: { \ 102 data.type = MessageType::WRITE_DATA; \ 103 data.id = request_id; 104 #define OPENTHERM_MESSAGE_WRITE_ENTITY(key, msg_data) message_data::write_##msg_data(this->key->state, data); 105 #define OPENTHERM_MESSAGE_WRITE_SETTING(key, msg_data) message_data::write_##msg_data(this->key, data); 106 #define OPENTHERM_MESSAGE_WRITE_POSTSCRIPT \ 111 #define OPENTHERM_MESSAGE_READ_MESSAGE(msg) \ 112 case MessageId::msg: \ 113 data.type = MessageType::READ_DATA; \ 114 data.id = request_id; \ 118 #define OPENTHERM_MESSAGE_RESPONSE_MESSAGE(msg) case MessageId::msg: 119 #define OPENTHERM_MESSAGE_RESPONSE_ENTITY(key, msg_data) this->key->publish_state(message_data::parse_##msg_data(data)); 120 #define OPENTHERM_MESSAGE_RESPONSE_POSTSCRIPT break; 122 #define OPENTHERM_IGNORE(x, y) 125 #ifndef OPENTHERM_READ_ch_enable 126 #define OPENTHERM_READ_ch_enable true 128 #ifndef OPENTHERM_READ_dhw_enable 129 #define OPENTHERM_READ_dhw_enable true 131 #ifndef OPENTHERM_READ_t_set 132 #define OPENTHERM_READ_t_set 0.0 134 #ifndef OPENTHERM_READ_cooling_enable 135 #define OPENTHERM_READ_cooling_enable false 137 #ifndef OPENTHERM_READ_cooling_control 138 #define OPENTHERM_READ_cooling_control 0.0 140 #ifndef OPENTHERM_READ_otc_active 141 #define OPENTHERM_READ_otc_active false 143 #ifndef OPENTHERM_READ_ch2_active 144 #define OPENTHERM_READ_ch2_active false 146 #ifndef OPENTHERM_READ_t_set_ch2 147 #define OPENTHERM_READ_t_set_ch2 0.0 149 #ifndef OPENTHERM_READ_summer_mode_active 150 #define OPENTHERM_READ_summer_mode_active false 152 #ifndef OPENTHERM_READ_dhw_block 153 #define OPENTHERM_READ_dhw_block false 158 #define SHOW_INNER(x) #x 159 #define SHOW(x) SHOW_INNER(x) Implementation of SPI Controller mode.