File tree Expand file tree Collapse file tree 4 files changed +10
-0
lines changed
Expand file tree Collapse file tree 4 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1515 cv .GenerateID (): cv .declare_id (generate .OpenthermHub ),
1616 cv .Optional ("in_pin" , 4 ): cv .int_ ,
1717 cv .Optional ("out_pin" , 5 ): cv .int_ ,
18+ cv .Optional ("master_id" , 5 ): cv .int_ ,
1819 cv .Optional ("ch_enable" , True ): cv .boolean ,
1920 cv .Optional ("dhw_enable" , True ): cv .boolean ,
2021 cv .Optional ("cooling_enable" , False ): cv .boolean ,
Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ namespace message_data {
6767#define OPENTHERM_IGNORE_2 (x, y )
6868
6969unsigned int OpenthermHub::build_request (OpenThermMessageID request_id) {
70+ if (request_id == OpenThermMessageID::MConfigMMemberIDcode) {
71+ ESP_LOGD (TAG, " Building Member Config request with id %d" , this ->master_id );
72+ return ot->buildRequest (OpenThermMessageType::WRITE_DATA, OpenThermMessageID::MConfigMMemberIDcode, this ->master_id );
73+ }
7074 // First, handle the status request. This requires special logic, because we
7175 // wouldn't want to inadvertently disable domestic hot water, for example.
7276 // It is also included in the macro-generated code below, but that will
@@ -225,6 +229,7 @@ void OpenthermHub::setup() {
225229 this ->ot = new OpenTherm (this ->in_pin , this ->out_pin , false );
226230 this ->ot ->begin (this ->handle_interrupt_callback , this ->process_response_callback );
227231
232+ this ->add_initial_message (OpenThermMessageID::MConfigMMemberIDcode);
228233 // Ensure that there is at least one request, as we are required to
229234 // communicate at least once every second. Sending the status request is
230235 // good practice anyway.
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ class OpenthermHub : public Component {
6262protected:
6363 // Communication pins for the OpenTherm interface
6464 int in_pin, out_pin;
65+ // Master id for MConfigMMemberIDcode command
66+ int master_id = 0 ;
6567 // The OpenTherm interface from @ihormelnyk's library
6668 OpenTherm* ot;
6769
@@ -114,6 +116,7 @@ class OpenthermHub : public Component {
114116 // Setters for the input and output OpenTherm interface pins
115117 void set_in_pin (int in_pin) { this ->in_pin = in_pin; }
116118 void set_out_pin (int out_pin) { this ->out_pin = out_pin; }
119+ void set_master_id (int master_id) { this ->master_id = master_id; }
117120
118121 #define OPENTHERM_SET_SENSOR (entity ) void set_ ## entity(sensor::Sensor* sensor) { this ->entity = sensor; }
119122 OPENTHERM_SENSOR_LIST (OPENTHERM_SET_SENSOR, )
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ captive_portal:
2929opentherm :
3030 in_pin : 4
3131 out_pin : 5
32+ # master_id: 4 # default 0, baxi 4
3233 ch_enable : true
3334 dhw_enable : false
3435 cooling_enable : false
You can’t perform that action at this time.
0 commit comments