Merge pull request #2157 from MichaelDvP/dev

thermostat time #2142, boiler power reduction #2147
This commit is contained in:
Proddy
2024-10-30 14:47:13 +01:00
committed by GitHub
5 changed files with 66 additions and 24 deletions

View File

@@ -555,6 +555,15 @@ Boiler::Boiler(uint8_t device_type, int8_t device_id, uint8_t product_id, const
FL_(pvMaxComp), FL_(pvMaxComp),
DeviceValueUOM::KW, DeviceValueUOM::KW,
MAKE_CF_CB(set_pvMaxComp)); MAKE_CF_CB(set_pvMaxComp));
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&powerReduction_,
DeviceValueType::UINT8,
DeviceValueNumOp::DV_NUMOP_MUL10,
FL_(powerReduction),
DeviceValueUOM::PERCENT,
MAKE_CF_CB(set_powerReduction),
30,
60);
register_device_value(DeviceValueTAG::TAG_DEVICE_DATA, register_device_value(DeviceValueTAG::TAG_DEVICE_DATA,
&hpSetDiffPress_, &hpSetDiffPress_,
DeviceValueType::UINT8, DeviceValueType::UINT8,
@@ -1941,6 +1950,7 @@ void Boiler::process_HpSilentMode(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, silentTo_, 53); // in steps of 15 min has_update(telegram, silentTo_, 53); // in steps of 15 min
has_update(telegram, pvMaxComp_, 54); // #2062 has_update(telegram, pvMaxComp_, 54); // #2062
has_update(telegram, hpshutdown_, 58); // 1 powers off has_update(telegram, hpshutdown_, 58); // 1 powers off
has_update(telegram, powerReduction_, 64); // 3..6 -> is *10
} }
// Boiler(0x08) -B-> All(0x00), ?(0x0488), data: 8E 00 00 00 00 00 01 03 // Boiler(0x08) -B-> All(0x00), ?(0x0488), data: 8E 00 00 00 00 00 01 03
@@ -3154,6 +3164,15 @@ bool Boiler::set_hpPowerLimit(const char * value, const int8_t id) {
return false; return false;
} }
bool Boiler::set_powerReduction(const char * value, const int8_t id) {
int v;
if (Helpers::value2number(value, v)) {
write_command(0x484, 64, v / 10, 0x484);
return true;
}
return false;
}
bool Boiler::set_vp_cooling(const char * value, const int8_t id) { bool Boiler::set_vp_cooling(const char * value, const int8_t id) {
bool v; bool v;
if (Helpers::value2bool(value, v)) { if (Helpers::value2bool(value, v)) {

View File

@@ -256,6 +256,7 @@ class Boiler : public EMSdevice {
uint8_t maxHeatDhw_; uint8_t maxHeatDhw_;
uint8_t hpMaxPower_; uint8_t hpMaxPower_;
uint8_t pvMaxComp_; uint8_t pvMaxComp_;
uint8_t powerReduction_;
uint8_t pvCooling_; uint8_t pvCooling_;
uint8_t manDefrost_; uint8_t manDefrost_;
@@ -332,7 +333,6 @@ class Boiler : public EMSdevice {
uint8_t delayBoiler_; // minutes uint8_t delayBoiler_; // minutes
uint8_t tempDiffBoiler_; // relative temperature degrees uint8_t tempDiffBoiler_; // relative temperature degrees
*/ */
void process_UBAFactory(std::shared_ptr<const Telegram> telegram); void process_UBAFactory(std::shared_ptr<const Telegram> telegram);
void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram); void process_UBAParameterWW(std::shared_ptr<const Telegram> telegram);
void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram); void process_UBAMonitorFast(std::shared_ptr<const Telegram> telegram);
@@ -482,6 +482,7 @@ class Boiler : public EMSdevice {
bool set_pvMaxComp(const char * value, const int8_t id); bool set_pvMaxComp(const char * value, const int8_t id);
bool set_hpDiffPress(const char * value, const int8_t id); bool set_hpDiffPress(const char * value, const int8_t id);
bool set_hpPowerLimit(const char * value, const int8_t id); bool set_hpPowerLimit(const char * value, const int8_t id);
bool set_powerReduction(const char * value, const int8_t id);
bool set_auxLimit(const char * value, const int8_t id); bool set_auxLimit(const char * value, const int8_t id);
inline bool set_auxMaxLimit(const char * value, const int8_t id) { inline bool set_auxMaxLimit(const char * value, const int8_t id) {

View File

@@ -1561,8 +1561,18 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
return; // not supported return; // not supported
} }
static uint8_t setTimeRetry = 0;
uint8_t dst = 0xFE;
bool use_dst = !telegram->read_value(dst, 9) || dst == 0xFF;
if ((telegram->message_data[7] & 0x0C) && has_command(&dateTime_)) { // date and time not valid if ((telegram->message_data[7] & 0x0C) && has_command(&dateTime_)) { // date and time not valid
if (setTimeRetry < 3) {
if (!use_dst) {
set_datetime("ntp", 0); // set from NTP without dst
} else {
set_datetime("ntp", -1); // set from NTP set_datetime("ntp", -1); // set from NTP
}
setTimeRetry++;
}
return; return;
} }
@@ -1576,7 +1586,9 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
tm_->tm_hour = telegram->message_data[2]; tm_->tm_hour = telegram->message_data[2];
tm_->tm_min = telegram->message_data[4]; tm_->tm_min = telegram->message_data[4];
tm_->tm_sec = telegram->message_data[5]; tm_->tm_sec = telegram->message_data[5];
if (use_dst) {
tm_->tm_isdst = telegram->message_data[7] & 0x01; tm_->tm_isdst = telegram->message_data[7] & 0x01;
}
// render date to DD.MM.YYYY HH:MM and publish // render date to DD.MM.YYYY HH:MM and publish
char newdatetime[sizeof(dateTime_)]; char newdatetime[sizeof(dateTime_)];
@@ -1590,8 +1602,17 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
if (!ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { if (!ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
double difference = difftime(now, ttime); double difference = difftime(now, ttime);
if (difference > 15 || difference < -15) { if (difference > 15 || difference < -15) {
if (setTimeRetry < 3) {
if (!use_dst) {
set_datetime("ntp", 0); // set from NTP without dst
} else {
set_datetime("ntp", -1); // set from NTP set_datetime("ntp", -1); // set from NTP
}
LOG_INFO("thermostat time correction from ntp"); LOG_INFO("thermostat time correction from ntp");
setTimeRetry++;
}
} else {
setTimeRetry = 0;
} }
} }
#ifndef EMSESP_STANDALONE #ifndef EMSESP_STANDALONE
@@ -2686,7 +2707,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
data[4] = tm_->tm_min; data[4] = tm_->tm_min;
data[5] = tm_->tm_sec; data[5] = tm_->tm_sec;
data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su data[6] = (tm_->tm_wday + 6) % 7; // Bosch counts from Mo, time from Su
data[7] = tm_->tm_isdst + 2; // set DST and flag for ext. clock data[7] = (id == 0) ? 2 : tm_->tm_isdst + 2; // set DST and flag for ext. clock
if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) { if (model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
data[6]++; // Junkers use 1-7; data[6]++; // Junkers use 1-7;
data[7] = 0; data[7] = 0;

View File

@@ -576,6 +576,7 @@ MAKE_TRANSLATION(gasMeterHeat, "gasmeterheat", "gas meter heating", "Gaszähler
MAKE_TRANSLATION(gasMeterWw, "gasmeter", "gas meter", "Gaszähler", "", "", "licznik gazu", "", "", "", "", "počítadlo plynu", "počítadlo plynu") // TODO translate MAKE_TRANSLATION(gasMeterWw, "gasmeter", "gas meter", "Gaszähler", "", "", "licznik gazu", "", "", "", "", "počítadlo plynu", "počítadlo plynu") // TODO translate
MAKE_TRANSLATION(hpCurrPower, "hpcurrpower", "compressor current power", "akt. Kompressorleistung", "", "", "", "", "", "", "", "", "aktuální výkon kompresoru") // TODO translate MAKE_TRANSLATION(hpCurrPower, "hpcurrpower", "compressor current power", "akt. Kompressorleistung", "", "", "", "", "", "", "", "", "aktuální výkon kompresoru") // TODO translate
MAKE_TRANSLATION(hpPowerLimit, "hppowerlimit", "power limit", "Leistungsgrenze", "", "", "", "", "", "", "", "", "omezení výkonu") // TODO translate MAKE_TRANSLATION(hpPowerLimit, "hppowerlimit", "power limit", "Leistungsgrenze", "", "", "", "", "", "", "", "", "omezení výkonu") // TODO translate
MAKE_TRANSLATION(powerReduction, "powerreduction", "power reduction", "Leistungsverringerung", "", "", "", "", "", "", "", "", "omezení výkonu") // TODO translate
// HIU // HIU
MAKE_TRANSLATION(netFlowTemp, "netflowtemp", "heat network flow temp", "Systemvorlauftemperatur", "Netto aanvoertemperatuur", "", "temp. zasilania sieci cieplnej", "", "", "ısıtma şebekesi akış derecesi", "temperatura di mandata della rete di riscaldamento", "teplota prívodu tepelnej siete", "teplota přívodu tepelné sítě") // TODO translate MAKE_TRANSLATION(netFlowTemp, "netflowtemp", "heat network flow temp", "Systemvorlauftemperatur", "Netto aanvoertemperatuur", "", "temp. zasilania sieci cieplnej", "", "", "ısıtma şebekesi akış derecesi", "temperatura di mandata della rete di riscaldamento", "teplota prívodu tepelnej siete", "teplota přívodu tepelné sítě") // TODO translate

View File

@@ -166,12 +166,10 @@ void Roomctrl::check(uint8_t addr, const uint8_t * data, const uint8_t length) {
// empty message back if temperature not set or unknown message type // empty message back if temperature not set or unknown message type
if (data[2] == EMSdevice::EMS_TYPE_VERSION) { if (data[2] == EMSdevice::EMS_TYPE_VERSION) {
version(addr, data[0], hc); version(addr, data[0], hc);
} else if (length == 6) { // ems query
unknown(addr, data[0], data[2], data[3]);
} else if (length == 8) {
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 == 6) { // all other ems queries
unknown(addr, data[0], data[2], data[3]);
} else if (length == 8 && data[2] == 0xFF && data[3] == 0 && data[5] == 0 && data[6] == 0x23) { // 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
@@ -182,6 +180,8 @@ 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] == 0xF7) { // ems+ query with 3 bytes type src dst 7F offset len=FF FF HIGH LOW } else if (data[2] == 0xF7) { // ems+ query with 3 bytes type src dst 7F offset len=FF FF HIGH LOW
replyF7(addr, data[0], data[3], data[5], data[6], data[7], hc); replyF7(addr, data[0], data[3], data[5], data[6], data[7], hc);
} else if (length == 8) {
unknown(addr, data[0], data[3], data[5], data[6]);
} }
} }