mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
test for +1691
This commit is contained in:
@@ -1867,6 +1867,10 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) {
|
||||
Roomctrl::set_remotetemp(Roomctrl::RC200, hc->hc(), hc->remotetemp); // RC200
|
||||
} else if (hc->control == 2 || hc->control == 3) { // RC100(2) and RC100H(3)
|
||||
Roomctrl::set_remotetemp(Roomctrl::RC100H, hc->hc(), hc->remotetemp); // RC100H
|
||||
} else {
|
||||
// test for #1691
|
||||
Roomctrl::set_remotetemp(Roomctrl::RC200, hc->hc(), hc->remotetemp); // RC200
|
||||
// Roomctrl::set_remotetemp(0, hc->hc(), EMS_VALUE_SHORT_NOTSET); // no remote set, switch off
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1985,9 +1989,9 @@ bool Thermostat::set_control(const char * value, const int8_t id) {
|
||||
} else if (model() == EMSdevice::EMS_DEVICE_FLAG_BC400 || model() == EMSdevice::EMS_DEVICE_FLAG_RC300 || model() == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
||||
if (Helpers::value2enum(value, ctrl, FL_(enum_control1))) {
|
||||
write_command(hpmode_typeids[hc->hc()], 3, ctrl);
|
||||
if (hc->remotetemp != EMS_VALUE_SHORT_NOTSET && ctrl > 0) {
|
||||
Roomctrl::set_remotetemp(ctrl == 1 ? Roomctrl::RC200 : Roomctrl::RC100H, hc->hc(), hc->remotetemp);
|
||||
}
|
||||
// if (hc->remotetemp != EMS_VALUE_SHORT_NOTSET && ctrl > 0) {
|
||||
// Roomctrl::set_remotetemp(ctrl == 1 ? Roomctrl::RC200 : Roomctrl::RC100H, hc->hc(), hc->remotetemp);
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
} else if (Helpers::value2enum(value, ctrl, FL_(enum_control))) {
|
||||
|
||||
@@ -25,20 +25,27 @@ bool Roomctrl::switch_off_[HCS] = {false, false, false, false};
|
||||
uint32_t Roomctrl::rc_time_[HCS] = {0, 0, 0, 0};
|
||||
int16_t Roomctrl::remotetemp_[HCS] = {EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET, EMS_VALUE_SHORT_NOTSET};
|
||||
uint8_t Roomctrl::remotehum_[HCS] = {EMS_VALUE_UINT_NOTSET, EMS_VALUE_UINT_NOTSET, EMS_VALUE_UINT_NOTSET, EMS_VALUE_UINT_NOTSET};
|
||||
uint8_t Roomctrl::sendcnt[] = {0, 0, 0, 0};
|
||||
uint8_t Roomctrl::type_ = RC20;
|
||||
uint8_t Roomctrl::sendcnt[HCS] = {0, 0, 0, 0};
|
||||
uint8_t Roomctrl::type_[HCS] = {0, 0, 0, 0};
|
||||
|
||||
/**
|
||||
* set the temperature,
|
||||
*/
|
||||
void Roomctrl::set_remotetemp(const uint8_t type, const uint8_t hc, const int16_t temp) {
|
||||
if (!type_[hc] && !type) {
|
||||
return;
|
||||
}
|
||||
if (remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET && temp == EMS_VALUE_SHORT_NOTSET) {
|
||||
remotetemp_[hc] = EMS_VALUE_SHORT_NOTSET;
|
||||
switch_off_[hc] = true;
|
||||
rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now
|
||||
sendcnt[hc] = 0;
|
||||
return;
|
||||
}
|
||||
if (hc >= HCS || (type != RC20 && type != FB10 && type != RC100H && type != SENSOR && type != RC200)) {
|
||||
return;
|
||||
}
|
||||
type_ = type;
|
||||
if (remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET && temp == EMS_VALUE_SHORT_NOTSET) {
|
||||
switch_off_[hc] = true;
|
||||
}
|
||||
type_[hc] = type;
|
||||
if (remotetemp_[hc] != temp) {
|
||||
rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now
|
||||
sendcnt[hc] = 0;
|
||||
@@ -46,14 +53,11 @@ void Roomctrl::set_remotetemp(const uint8_t type, const uint8_t hc, const int16_
|
||||
remotetemp_[hc] = temp;
|
||||
}
|
||||
|
||||
// set humidity for RC100H emulation
|
||||
void Roomctrl::set_remotehum(const uint8_t type, const uint8_t hc, const int8_t hum) {
|
||||
if (hc >= HCS || (type != RC20 && type != FB10 && type != RC100H && type != SENSOR)) {
|
||||
if (hc >= HCS || (type != RC100H) || type != type_[hc]) {
|
||||
return;
|
||||
}
|
||||
type_ = type;
|
||||
if (remotehum_[hc] != EMS_VALUE_UINT_NOTSET && (uint8_t)hum == EMS_VALUE_UINT_NOTSET) {
|
||||
switch_off_[hc] = true;
|
||||
}
|
||||
if (remotehum_[hc] != hum) {
|
||||
rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now
|
||||
sendcnt[hc] = 1;
|
||||
@@ -63,17 +67,14 @@ void Roomctrl::set_remotehum(const uint8_t type, const uint8_t hc, const int8_t
|
||||
|
||||
uint8_t Roomctrl::get_hc(uint8_t addr) {
|
||||
addr &= 0x7F;
|
||||
switch (type_) {
|
||||
case SENSOR:
|
||||
return addr - 0x40;
|
||||
case RC200:
|
||||
case RC100H:
|
||||
return addr - 0x38;
|
||||
case FB10:
|
||||
case RC20:
|
||||
default:
|
||||
return addr - 0x18;
|
||||
if (addr >= 0x40 && addr <= 0x44) {
|
||||
return addr - 0x40; // SENSOR
|
||||
} else if (addr >= 0x38 && addr <= 0x3B) {
|
||||
return addr - 0x38; // RC100H, RC200
|
||||
} else if (addr >= 0x18 && addr <= 0x1B) {
|
||||
return addr - 0x18; // RC20, FB10
|
||||
}
|
||||
return 0xFF; // invalid
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +93,7 @@ void Roomctrl::send(uint8_t addr) {
|
||||
}
|
||||
|
||||
if (uuid::get_uptime() - rc_time_[hc] > SEND_INTERVAL) { // send every minute
|
||||
if (type_ == RC100H) {
|
||||
if (type_[hc] == RC100H) {
|
||||
if (sendcnt[hc] == 1) { // second telegram for humidity
|
||||
if (switch_off_[hc]) {
|
||||
remotehum_[hc] = EMS_VALUE_UINT_NOTSET;
|
||||
@@ -108,18 +109,19 @@ void Roomctrl::send(uint8_t addr) {
|
||||
}
|
||||
temperature(addr, 0x10, hc); // send to master-thermostat
|
||||
}
|
||||
} else if (type_ == RC200) {
|
||||
} else if (type_[hc] == RC200) {
|
||||
rc_time_[hc] = uuid::get_uptime();
|
||||
temperature(addr, 0x10, hc);
|
||||
} else if (type_ == FB10) {
|
||||
} else if (type_[hc] == FB10) {
|
||||
rc_time_[hc] = uuid::get_uptime();
|
||||
temperature(addr, 0x10, hc); // send to master-thermostat (https://github.com/emsesp/EMS-ESP32/issues/336)
|
||||
} else { // type==RC20 or SENSOR
|
||||
rc_time_[hc] = uuid::get_uptime();
|
||||
temperature(addr, 0x00, hc); // send to all
|
||||
}
|
||||
if (remotehum_[hc] == EMS_VALUE_UINT_NOTSET) {
|
||||
if (remotehum_[hc] == EMS_VALUE_UINT_NOTSET && switch_off_[hc]) {
|
||||
switch_off_[hc] = false;
|
||||
type_[hc] = 0;
|
||||
}
|
||||
} else {
|
||||
// acknowledge every poll, otherwise the master shows error A22-816
|
||||
@@ -131,13 +133,11 @@ void Roomctrl::send(uint8_t addr) {
|
||||
* check if there is a message for the remote room controller
|
||||
*/
|
||||
void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) {
|
||||
if (type_ == SENSOR) {
|
||||
uint8_t hc = get_hc(addr);
|
||||
if (hc >= HCS || length < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t hc = get_hc(addr);
|
||||
// check address, reply only on addresses 0x18..0x1B
|
||||
if (hc >= HCS || length < 5) {
|
||||
if (type_[hc] == SENSOR) {
|
||||
return;
|
||||
}
|
||||
// no reply if the temperature is not set
|
||||
@@ -153,7 +153,7 @@ void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) {
|
||||
// reads: for now we only reply to version and remote temperature
|
||||
// empty message back if temperature not set or unknown message type
|
||||
if (data[2] == EMSdevice::EMS_TYPE_VERSION) {
|
||||
version(addr, data[0]);
|
||||
version(addr, data[0], hc);
|
||||
} else if (length == 6 && remotetemp_[hc] == EMS_VALUE_SHORT_NOTSET) {
|
||||
unknown(addr, data[0], data[2], data[3]);
|
||||
} else if (length == 8 && remotetemp_[hc] == EMS_VALUE_SHORT_NOTSET) {
|
||||
@@ -174,22 +174,22 @@ void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) {
|
||||
}
|
||||
|
||||
/**
|
||||
* send version info RC20 (Prod. 113, Ver. 02.01) or RC20RF (Prod. 93, Ver. 02.00)
|
||||
* send version info
|
||||
*/
|
||||
void Roomctrl::version(uint8_t addr, uint8_t dst) {
|
||||
void Roomctrl::version(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
uint8_t data[20];
|
||||
data[0] = addr | EMSbus::ems_mask();
|
||||
data[1] = dst & 0x7F;
|
||||
data[2] = 0x02;
|
||||
data[3] = 0;
|
||||
data[4] = type_; // set RC20 id 113, Ver 02.01 or Junkers FB10 id 109, Ver 16.05, RC100H id 200 ver 40.04
|
||||
if (type_ == RC20) {
|
||||
data[4] = type_[hc]; // set RC20 id 113, Ver 02.01 or Junkers FB10 id 109, Ver 16.05, RC100H id 200 ver 40.04
|
||||
if (type_[hc] == RC20) {
|
||||
data[5] = 2; // version 2.01
|
||||
data[6] = 1;
|
||||
data[7] = EMSbus::calculate_crc(data, 7); // apppend CRC
|
||||
EMSuart::transmit(data, 8);
|
||||
return;
|
||||
} else if (type_ == FB10) {
|
||||
} else if (type_[hc] == FB10) {
|
||||
data[5] = 16; // version 16.05
|
||||
data[6] = 5;
|
||||
data[7] = 0;
|
||||
@@ -202,7 +202,7 @@ void Roomctrl::version(uint8_t addr, uint8_t dst) {
|
||||
data[14] = EMSbus::calculate_crc(data, 14); // apppend CRC
|
||||
EMSuart::transmit(data, 15);
|
||||
return;
|
||||
} else if (type_ == RC200) {
|
||||
} else if (type_[hc] == RC200) {
|
||||
data[5] = 32; // version 32.02 see #1611
|
||||
data[6] = 2;
|
||||
data[7] = 0;
|
||||
@@ -215,7 +215,7 @@ void Roomctrl::version(uint8_t addr, uint8_t dst) {
|
||||
data[14] = EMSbus::calculate_crc(data, 14); // apppend CRC
|
||||
EMSuart::transmit(data, 15);
|
||||
return;
|
||||
} else if (type_ == RC100H) {
|
||||
} else if (type_[hc] == RC100H) {
|
||||
data[5] = 40; // version 40.04
|
||||
data[6] = 4;
|
||||
data[7] = 0;
|
||||
@@ -258,7 +258,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
uint8_t data[12];
|
||||
data[0] = addr | EMSbus::ems_mask();
|
||||
data[1] = dst & 0x7F;
|
||||
if (type_ == RC20) { // RC20, telegram 0xAF
|
||||
if (type_[hc] == RC20) { // RC20, telegram 0xAF
|
||||
data[2] = 0xAF;
|
||||
data[3] = 0;
|
||||
data[4] = (uint8_t)(remotetemp_[hc] >> 8);
|
||||
@@ -266,7 +266,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
data[6] = 0;
|
||||
data[7] = EMSbus::calculate_crc(data, 7); // apppend CRC
|
||||
EMSuart::transmit(data, 8);
|
||||
} else if (type_ == FB10) { // Junkers FB10, telegram 0x0123
|
||||
} else if (type_[hc] == FB10) { // Junkers FB10, telegram 0x0123
|
||||
data[2] = 0xFF;
|
||||
data[3] = 0;
|
||||
data[4] = 0;
|
||||
@@ -275,7 +275,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF);
|
||||
data[8] = EMSbus::calculate_crc(data, 8); // apppend CRC
|
||||
EMSuart::transmit(data, 9);
|
||||
} else if (type_ == RC200) { // RC200, telegram 42B, ff
|
||||
} else if (type_[hc] == RC200) { // RC200, telegram 42B, ff
|
||||
data[2] = 0xFF;
|
||||
data[3] = 0;
|
||||
data[4] = 3;
|
||||
@@ -288,7 +288,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
data[10] = 1; // not sure what this is and if we need it, maybe mode?
|
||||
data[11] = EMSbus::calculate_crc(data, 11); // apppend CRC
|
||||
EMSuart::transmit(data, 12);
|
||||
} else if (type_ == RC100H) { // RC100H, telegram 42B, ff
|
||||
} else if (type_[hc] == RC100H) { // RC100H, telegram 42B, ff
|
||||
data[2] = 0xFF;
|
||||
data[3] = 0;
|
||||
data[4] = 3;
|
||||
@@ -297,7 +297,7 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF);
|
||||
data[8] = EMSbus::calculate_crc(data, 8); // apppend CRC
|
||||
EMSuart::transmit(data, 9);
|
||||
} else if (type_ == SENSOR) { // wireless sensor, broadcast id 435
|
||||
} else if (type_[hc] == SENSOR) { // wireless sensor, broadcast id 435
|
||||
data[2] = 0xFF;
|
||||
data[3] = 0;
|
||||
data[4] = 3;
|
||||
@@ -315,7 +315,7 @@ void Roomctrl::humidity(uint8_t addr, uint8_t dst, uint8_t hc) {
|
||||
data[0] = addr | EMSbus::ems_mask();
|
||||
data[1] = dst & 0x7F;
|
||||
uint16_t dew = calc_dew(remotetemp_[hc], remotehum_[hc]);
|
||||
if (type_ == RC100H) { // RC100H, telegram 47B
|
||||
if (type_[hc] == RC100H) { // RC100H, telegram 47B
|
||||
data[2] = 0xFF;
|
||||
data[3] = 0;
|
||||
data[4] = 3;
|
||||
|
||||
@@ -39,7 +39,7 @@ class Roomctrl {
|
||||
static constexpr uint8_t HCS = 4; // max 4 heating circuits
|
||||
|
||||
static uint8_t get_hc(const uint8_t addr);
|
||||
static void version(uint8_t addr, uint8_t dst);
|
||||
static void version(uint8_t addr, uint8_t dst, uint8_t hc);
|
||||
static void unknown(uint8_t addr, uint8_t dst, uint8_t type, uint8_t offset);
|
||||
static void unknown(uint8_t addr, uint8_t dst, uint8_t offset, uint8_t typeh, uint8_t typel);
|
||||
static void temperature(uint8_t addr, uint8_t dst, uint8_t hc);
|
||||
@@ -53,7 +53,7 @@ class Roomctrl {
|
||||
static int16_t remotetemp_[HCS];
|
||||
static uint8_t remotehum_[HCS];
|
||||
static uint8_t sendcnt[HCS];
|
||||
static uint8_t type_; // type is product-id 113 for RC20 or 109 for Junkers FB10
|
||||
static uint8_t type_[HCS]; // type is product-id 113 for RC20 or 109 for Junkers FB10
|
||||
};
|
||||
|
||||
} // namespace emsesp
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.7.0-dev.2"
|
||||
#define EMSESP_APP_VERSION "3.7.0-test.2"
|
||||
|
||||
Reference in New Issue
Block a user