suggestion for #477

This commit is contained in:
MichaelDvP
2020-09-04 14:45:22 +02:00
parent 3fe814076b
commit ffb672f3fd
5 changed files with 33 additions and 23 deletions

View File

@@ -708,8 +708,8 @@ void Boiler::set_warmwater_temp(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler warm water temperature to %d C"), v);
write_command(EMS_TYPE_UBAParameterWW, 2, v);
write_command(EMS_TYPE_UBAFlags, 3, v); // for i9000, see #397
write_command(EMS_TYPE_UBAParameterWW, 2, v, EMS_TYPE_UBAParameterWW);
write_command(EMS_TYPE_UBAFlags, 3, v, EMS_TYPE_UBAParameterWW); // for i9000, see #397
}
// flow temp
@@ -720,7 +720,7 @@ void Boiler::set_flow_temp(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler flow temperature to %d C"), v);
write_command(EMS_TYPE_UBASetPoints, 0, v);
write_command(EMS_TYPE_UBASetPoints, 0, v, EMS_TYPE_UBASetPoints);
}
// set min boiler output
@@ -730,7 +730,7 @@ void Boiler::set_min_power(const char * value, const int8_t id) {
return;
}
LOG_INFO(F("Setting boiler min power to "), v);
write_command(EMS_TYPE_UBAParameters, 3, v);
write_command(EMS_TYPE_UBAParameters, 3, v, EMS_TYPE_UBAParameters);
}
// set max temp
@@ -741,7 +741,7 @@ void Boiler::set_max_power(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler max power to %d C"), v);
write_command(EMS_TYPE_UBAParameters, 2, v);
write_command(EMS_TYPE_UBAParameters, 2, v, EMS_TYPE_UBAParameters);
}
// set boiler on hysteresis
@@ -752,7 +752,7 @@ void Boiler::set_hyst_on(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler hysteresis on to %d C"), v);
write_command(EMS_TYPE_UBAParameters, 5, v);
write_command(EMS_TYPE_UBAParameters, 5, v, EMS_TYPE_UBAParameters);
}
// set boiler off hysteresis
@@ -763,7 +763,7 @@ void Boiler::set_hyst_off(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler hysteresis off to %d C"), v);
write_command(EMS_TYPE_UBAParameters, 4, v);
write_command(EMS_TYPE_UBAParameters, 4, v, EMS_TYPE_UBAParameters);
}
// set min burner period
@@ -774,7 +774,7 @@ void Boiler::set_burn_period(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting burner min. period to %d min"), v);
write_command(EMS_TYPE_UBAParameters, 6, v);
write_command(EMS_TYPE_UBAParameters, 6, v, EMS_TYPE_UBAParameters);
}
// set pump delay
@@ -785,7 +785,7 @@ void Boiler::set_pump_delay(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler pump delay to %d min"), v);
write_command(EMS_TYPE_UBAParameters, 8, v);
write_command(EMS_TYPE_UBAParameters, 8, v, EMS_TYPE_UBAParameters);
}
// note some boilers do not have this setting, than it's done by thermostat
@@ -807,7 +807,7 @@ void Boiler::set_warmwater_mode(const char * value, const int8_t id) {
} else {
return; // do nothing
}
write_command(EMS_TYPE_UBAParameterWW, 9, set);
write_command(EMS_TYPE_UBAParameterWW, 9, set, EMS_TYPE_UBAParameterWW);
}
// turn on/off warm water
@@ -826,7 +826,7 @@ void Boiler::set_warmwater_activated(const char * value, const int8_t id) {
} else {
n = (v ? 0xFF : 0x00); // 0xFF is on, 0x00 is off
}
write_command(EMS_TYPE_UBAParameterWW, 1, n);
write_command(EMS_TYPE_UBAParameterWW, 1, n, EMS_TYPE_UBAParameterWW);
}
// Activate / De-activate the Warm Tap Water
@@ -871,7 +871,7 @@ void Boiler::set_warmwater_onetime(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler warm water OneTime loading %s"), v ? "on" : "off");
write_command(EMS_TYPE_UBAFlags, 0, (v ? 0x22 : 0x02));
write_command(EMS_TYPE_UBAFlags, 0, (v ? 0x22 : 0x02), 0x18);
}
// Activate / De-activate circulation of warm water 0x35
@@ -883,7 +883,7 @@ void Boiler::set_warmwater_circulation(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting boiler warm water circulation %s"), v ? "on" : "off");
write_command(EMS_TYPE_UBAFlags, 1, (v ? 0x22 : 0x02));
write_command(EMS_TYPE_UBAFlags, 1, (v ? 0x22 : 0x02), 0x18);
}
// add console commands

View File

@@ -1217,7 +1217,7 @@ void Thermostat::set_minexttemp(const char * value, const int8_t id) {
return;
}
LOG_INFO(F("Setting min external temperature to %d"), mt);
write_command(EMS_TYPE_IBASettings, 5, mt);
write_command(EMS_TYPE_IBASettings, 5, mt, EMS_TYPE_IBASettings);
}
// 0xA5 - Clock offset
@@ -1227,7 +1227,7 @@ void Thermostat::set_clockoffset(const char * value, const int8_t id) {
return;
}
LOG_INFO(F("Setting clock offset to %d"), co);
write_command(EMS_TYPE_IBASettings, 12, co);
write_command(EMS_TYPE_IBASettings, 12, co, EMS_TYPE_IBASettings);
}
// 0xA5 - Calibrate internal temperature
@@ -1238,7 +1238,7 @@ void Thermostat::set_calinttemp(const char * value, const int8_t id) {
}
// does this value need to be multiple by 10?
LOG_INFO(F("Calibrating internal temperature to %d.%d"), ct / 10, ct < 0 ? -ct % 10 : ct % 10);
write_command(EMS_TYPE_IBASettings, 2, ct);
write_command(EMS_TYPE_IBASettings, 2, ct, EMS_TYPE_IBASettings);
}
// 0xA5 - Set the display settings
@@ -1248,7 +1248,7 @@ void Thermostat::set_display(const char * value, const int8_t id) {
return;
}
LOG_INFO(F("Setting display to %d"), ds);
write_command(EMS_TYPE_IBASettings, 0, ds);
write_command(EMS_TYPE_IBASettings, 0, ds, EMS_TYPE_IBASettings);
}
void Thermostat::set_remotetemp(const char * value, const int8_t id) {
@@ -1285,7 +1285,7 @@ void Thermostat::set_building(const char * value, const int8_t id) {
}
LOG_INFO(F("Setting building to %d"), bg);
write_command(EMS_TYPE_wwSettings, 6, bg);
write_command(EMS_TYPE_IBASettings, 6, bg, EMS_TYPE_IBASettings);
}
// 0xA5 Set the language settings
@@ -1295,7 +1295,7 @@ void Thermostat::set_language(const char * value, const int8_t id) {
return;
}
LOG_INFO(F("Setting language to %d"), lg);
write_command(EMS_TYPE_wwSettings, 1, lg);
write_command(EMS_TYPE_IBASettings, 1, lg, EMS_TYPE_IBASettings);
}
// Set the control-mode for hc 0-off, 1-RC20, 2-RC3x
@@ -1340,7 +1340,7 @@ void Thermostat::set_wwmode(const char * value, const int8_t id) {
if (set != 0xFF) {
LOG_INFO(F("Setting thermostat warm water mode to %s"), v.c_str());
write_command(EMS_TYPE_wwSettings, 2, set);
write_command(EMS_TYPE_wwSettings, 2, set, EMS_TYPE_wwSettings);
} else {
LOG_WARNING(F("Set thermostat warm water mode: Invalid mode: %s"), v.c_str());
}
@@ -1444,7 +1444,7 @@ void Thermostat::set_datetime(const char * value, const int8_t id) {
data[7] = (dt[22] - '0') + 2; // DST and flag
}
LOG_INFO(F("Setting date and time"));
write_command(EMS_TYPE_time, 0, data, 8, 0);
write_command(EMS_TYPE_time, 0, data, 8, EMS_TYPE_time);
}
// sets the thermostat working mode, where mode is a string
@@ -1488,7 +1488,7 @@ void Thermostat::set_mode_n(const uint8_t mode, const uint8_t hc_num) {
// get hc based on number
std::shared_ptr<Thermostat::HeatingCircuit> hc = heating_circuit(hc_num);
if (hc == nullptr) {
LOG_WARNING(F("Set mode: Heating Circuit %d not found or activated"), hc_num);
LOG_WARNING(F("set mode: Heating Circuit %d not found or activated"), hc_num);
return;
}

View File

@@ -58,6 +58,7 @@ uint8_t EMSESP::actual_master_thermostat_ = EMSESP_DEFAULT_MASTER_THERMOSTAT; /
uint16_t EMSESP::watch_id_ = WATCH_ID_NONE; // for when log is TRACE. 0 means no trace set
uint8_t EMSESP::watch_ = 0; // trace off
uint16_t EMSESP::read_id_ = WATCH_ID_NONE;
uint16_t EMSESP::publish_id_ = 0;
bool EMSESP::tap_water_active_ = false; // for when Boiler states we having running warm water. used in Shower()
uint32_t EMSESP::last_fetch_ = 0;
uint8_t EMSESP::unique_id_count_ = 0;
@@ -507,7 +508,10 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
found = emsdevice->handle_telegram(telegram);
// check to see if we need to follow up after the telegram has been processed
if (found) {
if (emsdevice->updated_values()) {
if (emsdevice->updated_values() || telegram->type_id == publish_id_) {
if (telegram->type_id == publish_id_) {
publish_id_ = 0;
}
emsdevice->publish_values(); // publish to MQTT if we explicitly have too
}
}
@@ -717,6 +721,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
LOG_DEBUG(F("Last Tx write successful"));
txservice_.increment_telegram_write_count(); // last tx/write was confirmed ok
txservice_.send_poll(); // close the bus
publish_id_ = txservice_.get_post_send_query();
txservice_.post_send_query(); // follow up with any post-read
txservice_.reset_retry_count();
tx_successful = true;

View File

@@ -191,6 +191,7 @@ class EMSESP {
static uint16_t watch_id_;
static uint8_t watch_;
static uint16_t read_id_;
static uint16_t publish_id_;
static bool tap_water_active_;
static uint8_t unique_id_count_;

View File

@@ -288,6 +288,10 @@ class TxService : public EMSbus {
telegram_last_post_send_query_ = type_id;
}
uint16_t get_post_send_query() {
return telegram_last_post_send_query_;
}
uint32_t telegram_read_count() const {
return telegram_read_count_;
}