mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-26 16:49:11 +03:00
use FB10 telegram 0x123, ack writes
This commit is contained in:
@@ -176,7 +176,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
|||||||
// JUNKERS/HT3
|
// JUNKERS/HT3
|
||||||
} else if (model == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
} else if (model == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
||||||
if (device_id >= 0x18 && device_id <= 0x1B) { // remote hc1-hc4
|
if (device_id >= 0x18 && device_id <= 0x1B) { // remote hc1-hc4
|
||||||
register_telegram_type(0x122 + (device_id - 0x18), "JunkersRemote", false, MAKE_PF_CB(process_JunkersRemoteMonitor));
|
register_telegram_type(0x123, "JunkersRemote", false, MAKE_PF_CB(process_JunkersRemoteMonitor));
|
||||||
register_device_values(); // register device values for common values (not heating circuit)
|
register_device_values(); // register device values for common values (not heating circuit)
|
||||||
return; // no values to add
|
return; // no values to add
|
||||||
}
|
}
|
||||||
@@ -775,7 +775,7 @@ void Thermostat::process_JunkersSet2(std::shared_ptr<const Telegram> telegram) {
|
|||||||
has_enumupdate(telegram, hc->mode, 4, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto
|
has_enumupdate(telegram, hc->mode, 4, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto
|
||||||
}
|
}
|
||||||
|
|
||||||
// type 0x122 ff - FR10/FR110 Junkers as remote
|
// type 0x123 - FB10 Junkers remote
|
||||||
void Thermostat::process_JunkersRemoteMonitor(std::shared_ptr<const Telegram> telegram) {
|
void Thermostat::process_JunkersRemoteMonitor(std::shared_ptr<const Telegram> telegram) {
|
||||||
has_update(telegram, tempsensor1_, 0); // roomTemp from remote
|
has_update(telegram, tempsensor1_, 0); // roomTemp from remote
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ uint8_t Roomctrl::get_hc(uint8_t addr) {
|
|||||||
/**
|
/**
|
||||||
* if remote control is active send the temperature every minute
|
* if remote control is active send the temperature every minute
|
||||||
*/
|
*/
|
||||||
void Roomctrl::send(const uint8_t addr) {
|
void Roomctrl::send(uint8_t addr) {
|
||||||
|
addr &= 0x7F;
|
||||||
uint8_t hc = get_hc(addr);
|
uint8_t hc = get_hc(addr);
|
||||||
// check address, reply only on addresses 0x18..0x1B or 0x40..0x43
|
// check address, reply only on addresses 0x18..0x1B or 0x40..0x43
|
||||||
if (hc >= HCS) {
|
if (hc >= HCS) {
|
||||||
@@ -142,7 +143,7 @@ void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) {
|
|||||||
}
|
}
|
||||||
// reply to writes with write nack byte
|
// reply to writes with write nack byte
|
||||||
if ((addr & 0x80) == 0) { // it's a write to us
|
if ((addr & 0x80) == 0) { // it's a write to us
|
||||||
nack_write(); // we don't accept writes.
|
ack_write(); // accept writes, don't care.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addr &= 0x7F;
|
addr &= 0x7F;
|
||||||
@@ -156,7 +157,7 @@ void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) {
|
|||||||
unknown(addr, data[0], data[3], data[5], data[6]);
|
unknown(addr, data[0], data[3], data[5], data[6]);
|
||||||
} else if (data[2] == 0xAF && data[3] == 0) {
|
} else if (data[2] == 0xAF && data[3] == 0) {
|
||||||
temperature(addr, data[0], hc);
|
temperature(addr, data[0], hc);
|
||||||
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 0 && data[6] == 0x22 + hc) { // Junkers
|
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 0 && data[6] == 0x23) { // Junkers
|
||||||
temperature(addr, data[0], hc);
|
temperature(addr, data[0], hc);
|
||||||
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 3 && data[6] == 0x2B + hc) { // EMS+ temperature
|
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 3 && data[6] == 0x2B + hc) { // EMS+ temperature
|
||||||
temperature(addr, data[0], hc);
|
temperature(addr, data[0], hc);
|
||||||
@@ -237,11 +238,11 @@ void Roomctrl::temperature(uint8_t addr, uint8_t dst, uint8_t hc) {
|
|||||||
data[6] = 0;
|
data[6] = 0;
|
||||||
data[7] = EMSbus::calculate_crc(data, 7); // apppend CRC
|
data[7] = EMSbus::calculate_crc(data, 7); // apppend CRC
|
||||||
EMSuart::transmit(data, 8);
|
EMSuart::transmit(data, 8);
|
||||||
} else if (type_ == FB10) { // Junkers FB10, telegram 0x0122
|
} else if (type_ == FB10) { // Junkers FB10, telegram 0x0123
|
||||||
data[2] = 0xFF;
|
data[2] = 0xFF;
|
||||||
data[3] = 0;
|
data[3] = 0;
|
||||||
data[4] = 0;
|
data[4] = 0;
|
||||||
data[5] = 0x22 + hc; // count with hc?
|
data[5] = 0x23; // count with hc?
|
||||||
data[6] = (uint8_t)(remotetemp_[hc] >> 8);
|
data[6] = (uint8_t)(remotetemp_[hc] >> 8);
|
||||||
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF);
|
data[7] = (uint8_t)(remotetemp_[hc] & 0xFF);
|
||||||
data[8] = EMSbus::calculate_crc(data, 8); // apppend CRC
|
data[8] = EMSbus::calculate_crc(data, 8); // apppend CRC
|
||||||
@@ -309,6 +310,15 @@ void Roomctrl::nack_write() {
|
|||||||
EMSuart::transmit(data, 1);
|
EMSuart::transmit(data, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* send a ack if someone want to write to us.
|
||||||
|
*/
|
||||||
|
void Roomctrl::ack_write() {
|
||||||
|
uint8_t data[1];
|
||||||
|
data[0] = TxService::TX_WRITE_SUCCESS;
|
||||||
|
EMSuart::transmit(data, 1);
|
||||||
|
}
|
||||||
|
|
||||||
int16_t Roomctrl::calc_dew(int16_t temp, uint8_t humi) {
|
int16_t Roomctrl::calc_dew(int16_t temp, uint8_t humi) {
|
||||||
if (humi == EMS_VALUE_UINT_NOTSET || temp == EMS_VALUE_SHORT_NOTSET) {
|
if (humi == EMS_VALUE_UINT_NOTSET || temp == EMS_VALUE_SHORT_NOTSET) {
|
||||||
return EMS_VALUE_SHORT_NOTSET;
|
return EMS_VALUE_SHORT_NOTSET;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace emsesp {
|
|||||||
|
|
||||||
class Roomctrl {
|
class Roomctrl {
|
||||||
public:
|
public:
|
||||||
static void send(const uint8_t addr);
|
static void send(uint8_t addr);
|
||||||
static void check(uint8_t addr, const uint8_t * data, const uint8_t length);
|
static void check(uint8_t addr, const uint8_t * data, const uint8_t length);
|
||||||
static void set_remotetemp(const uint8_t type, const uint8_t hc, const int16_t temp);
|
static void set_remotetemp(const uint8_t type, const uint8_t hc, const int16_t temp);
|
||||||
static void set_remotehum(const uint8_t type, const uint8_t hc, const int8_t hum);
|
static void set_remotehum(const uint8_t type, const uint8_t hc, const int8_t hum);
|
||||||
@@ -42,6 +42,7 @@ class Roomctrl {
|
|||||||
static void temperature(uint8_t addr, uint8_t dst, uint8_t hc);
|
static void temperature(uint8_t addr, uint8_t dst, uint8_t hc);
|
||||||
static void humidity(uint8_t addr, uint8_t dst, uint8_t hc);
|
static void humidity(uint8_t addr, uint8_t dst, uint8_t hc);
|
||||||
static void nack_write();
|
static void nack_write();
|
||||||
|
static void ack_write();
|
||||||
static int16_t calc_dew(int16_t temp, uint8_t hum);
|
static int16_t calc_dew(int16_t temp, uint8_t hum);
|
||||||
|
|
||||||
static bool switch_off_[HCS];
|
static bool switch_off_[HCS];
|
||||||
|
|||||||
Reference in New Issue
Block a user