no poll-ack for remote thermostat

This commit is contained in:
MichaelDvP
2024-04-15 09:08:05 +02:00
parent 3c5790639e
commit 4d400bd7ce
2 changed files with 22 additions and 19 deletions

View File

@@ -25,8 +25,8 @@ bool Roomctrl::switch_off_[HCS] = {false, false, false, false};
uint32_t Roomctrl::rc_time_[HCS] = {0, 0, 0, 0}; 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}; 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::remotehum_[HCS] = {EMS_VALUE_UINT_NOTSET, EMS_VALUE_UINT_NOTSET, EMS_VALUE_UINT_NOTSET, EMS_VALUE_UINT_NOTSET};
uint8_t Roomctrl::sendcnt[HCS] = {0, 0, 0, 0}; uint8_t Roomctrl::sendtype_[HCS] = {SendType::TEMP, SendType::TEMP, SendType::TEMP, SendType::TEMP};
uint8_t Roomctrl::type_[HCS] = {0, 0, 0, 0}; uint8_t Roomctrl::type_[HCS] = {RemoteType::NONE, RemoteType::NONE, RemoteType::NONE, RemoteType::NONE};
/** /**
* set the temperature, * set the temperature,
@@ -35,11 +35,11 @@ void Roomctrl::set_remotetemp(const uint8_t type, const uint8_t hc, const int16_
if (!type_[hc] && !type) { if (!type_[hc] && !type) {
return; return;
} }
if (remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET && temp == EMS_VALUE_SHORT_NOTSET) { if (remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET && temp == EMS_VALUE_SHORT_NOTSET) { // switch remote off
remotetemp_[hc] = EMS_VALUE_SHORT_NOTSET; remotetemp_[hc] = EMS_VALUE_SHORT_NOTSET;
switch_off_[hc] = true; switch_off_[hc] = true;
rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now
sendcnt[hc] = 0; sendtype_[hc] = SendType::TEMP;
return; return;
} }
if (hc >= HCS || (type != RC20 && type != FB10 && type != RC100H && type != SENSOR && type != RC200 && type != RC100)) { if (hc >= HCS || (type != RC20 && type != FB10 && type != RC100H && type != SENSOR && type != RC200 && type != RC100)) {
@@ -48,7 +48,7 @@ void Roomctrl::set_remotetemp(const uint8_t type, const uint8_t hc, const int16_
type_[hc] = type; type_[hc] = type;
if (remotetemp_[hc] != temp) { if (remotetemp_[hc] != temp) {
rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now
sendcnt[hc] = 0; sendtype_[hc] = SendType::TEMP;
} }
remotetemp_[hc] = temp; remotetemp_[hc] = temp;
} }
@@ -60,7 +60,7 @@ void Roomctrl::set_remotehum(const uint8_t type, const uint8_t hc, const int8_t
} }
if (remotehum_[hc] != hum) { if (remotehum_[hc] != hum) {
rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now rc_time_[hc] = uuid::get_uptime() - SEND_INTERVAL; // send now
sendcnt[hc] = 1; sendtype_[hc] = SendType::HUMI;
} }
remotehum_[hc] = hum; remotehum_[hc] = hum;
} }
@@ -78,7 +78,7 @@ 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 15 seconds
*/ */
void Roomctrl::send(uint8_t addr) { void Roomctrl::send(uint8_t addr) {
addr &= 0x7F; addr &= 0x7F;
@@ -92,18 +92,18 @@ void Roomctrl::send(uint8_t addr) {
return; return;
} }
if (uuid::get_uptime() - rc_time_[hc] > SEND_INTERVAL) { // send every minute if (uuid::get_uptime() - rc_time_[hc] > SEND_INTERVAL) { // check interval
if (type_[hc] == RC100H) { if (type_[hc] == RC100H) {
if (sendcnt[hc] == 1) { // second telegram for humidity if (sendtype_[hc] == SendType::HUMI) { // send humidity
if (switch_off_[hc]) { if (switch_off_[hc]) {
remotehum_[hc] = EMS_VALUE_UINT_NOTSET; remotehum_[hc] = EMS_VALUE_UINT_NOTSET;
} }
rc_time_[hc] = uuid::get_uptime(); rc_time_[hc] = uuid::get_uptime();
humidity(addr, 0x10, hc); humidity(addr, 0x10, hc);
sendcnt[hc] = 0; sendtype_[hc] = SendType::TEMP;
} else { // temperature telegram } else { // temperature telegram
if (remotehum_[hc] != EMS_VALUE_UINT_NOTSET) { if (remotehum_[hc] != EMS_VALUE_UINT_NOTSET) {
sendcnt[hc] = 1; sendtype_[hc] = SendType::HUMI;
} else { } else {
rc_time_[hc] = uuid::get_uptime(); rc_time_[hc] = uuid::get_uptime();
} }
@@ -121,11 +121,12 @@ void Roomctrl::send(uint8_t addr) {
} }
if (remotehum_[hc] == EMS_VALUE_UINT_NOTSET && switch_off_[hc]) { if (remotehum_[hc] == EMS_VALUE_UINT_NOTSET && switch_off_[hc]) {
switch_off_[hc] = false; switch_off_[hc] = false;
type_[hc] = 0; type_[hc] = RemoteType::NONE;
} }
} else { } else {
// acknowledge every poll, otherwise the master shows error A22-816 // acknowledge every poll, otherwise the master shows error A22-816
EMSuart::send_poll(addr | EMSbus::ems_mask()); // not needed for 15 sec repeat rate, causes incomplete telegrams if poll-ack is sent
// EMSuart::send_poll(addr | EMSbus::ems_mask());
} }
} }

View File

@@ -24,19 +24,21 @@ namespace emsesp {
class Roomctrl { class Roomctrl {
public: public:
// Product-Id of the remote
enum RemoteType : uint8_t { NONE = 0, RC20 = 113, FB10 = 109, RC100H = 200, SENSOR = 0x40, RC200 = 157, RC100 = 165 };
static void send(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);
enum : uint8_t { RC20 = 113, FB10 = 109, RC100H = 200, SENSOR = 0x40, RC200 = 157, RC100 = 165 };
static bool is_remote(const uint8_t hc) { static bool is_remote(const uint8_t hc) {
return (hc < 4 && remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET); return (hc < 4 && remotetemp_[hc] != EMS_VALUE_SHORT_NOTSET);
} }
private: private:
static constexpr uint8_t ADDR = 0x18; // address for hc1 static constexpr uint32_t SEND_INTERVAL = 15000; // 15 sec
static constexpr uint32_t SEND_INTERVAL = 15000; // ~1/4 minute
static constexpr uint8_t HCS = 4; // max 4 heating circuits static constexpr uint8_t HCS = 4; // max 4 heating circuits
enum SendType : uint8_t { TEMP, HUMI };
static uint8_t get_hc(const uint8_t addr); static uint8_t get_hc(const uint8_t addr);
static void version(uint8_t addr, uint8_t dst, uint8_t hc); static void version(uint8_t addr, uint8_t dst, uint8_t hc);
@@ -52,7 +54,7 @@ class Roomctrl {
static uint32_t rc_time_[HCS]; static uint32_t rc_time_[HCS];
static int16_t remotetemp_[HCS]; static int16_t remotetemp_[HCS];
static uint8_t remotehum_[HCS]; static uint8_t remotehum_[HCS];
static uint8_t sendcnt[HCS]; static uint8_t sendtype_[HCS];
static uint8_t type_[HCS]; // 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
}; };