thermostat RC300 mode

This commit is contained in:
MichaelDvP
2023-11-14 10:53:20 +01:00
parent 3b30083e7c
commit 4f1ef297c7
5 changed files with 25 additions and 12 deletions

View File

@@ -976,7 +976,8 @@ void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram)
has_update(telegram, hc->roomTemp, 0); // is * 10 has_update(telegram, hc->roomTemp, 0); // is * 10
has_bitupdate(telegram, hc->modetype, 10, 1); has_bitupdate(telegram, hc->modetype, 10, 1);
has_bitupdate(telegram, hc->mode, 10, 0); // bit 1, mode (auto=1 or manual=0) // auto status, read mode in settings
// has_bitupdate(telegram, hc->mode, 10, 0); // bit 0, mode (auto=1 or manual=0)
// if manual, take the current setpoint temp at pos 6 // if manual, take the current setpoint temp at pos 6
// if auto, take the next setpoint temp at pos 7 // if auto, take the next setpoint temp at pos 7
@@ -990,7 +991,7 @@ void Thermostat::process_RC300Monitor(std::shared_ptr<const Telegram> telegram)
// summermode is bit 4 for boilers and bit 6 for heatpumps: 0:winter, 1:summer // summermode is bit 4 for boilers and bit 6 for heatpumps: 0:winter, 1:summer
telegram->read_value(hc->statusbyte, 2); telegram->read_value(hc->statusbyte, 2);
// use summertemp or hpoperatingstate, https://github.com/emsesp/EMS-ESP32/issues/747, #550, #503 // use summertemp or hpoperatingstate, https://github.com/emsesp/EMS-ESP32/issues/747, #550, #503
if ((hc->statusbyte & 1) || !is_fetch(summer2_typeids[hc->hc()])) { if ((hc->statusbyte & 1) || !is_received(summer2_typeids[hc->hc()])) {
has_update(hc->summermode, hc->statusbyte & 0x50 ? 1 : 0); has_update(hc->summermode, hc->statusbyte & 0x50 ? 1 : 0);
has_update(hc->hpoperatingstate, EMS_VALUE_UINT_NOTSET); has_update(hc->hpoperatingstate, EMS_VALUE_UINT_NOTSET);
} else { } else {
@@ -1022,12 +1023,13 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
// has_update(telegram, hc->selTemp, 10, 1); // single byte conversion, value is * 2 - manual // has_update(telegram, hc->selTemp, 10, 1); // single byte conversion, value is * 2 - manual
telegram->read_value(hc->mode_new, 21); // 0-off, 1-manual, 2-auto telegram->read_value(hc->mode_new, 21); // 0-off, 1-manual, 2-auto
if (Helpers::hasValue(hc->mode_new)) { if (hc->mode_new <= 2) {
has_update(hc->mode, hc->mode_new); has_update(hc->mode, hc->mode_new);
} else { } else {
uint8_t mode = EMS_VALUE_UINT_NOTSET; uint8_t mode = hc->mode == 2 ? 0xFF : 0; // auto : manual
telegram->read_value(mode, 0); if (telegram->read_value(mode, 0)) {
has_update(hc->mode, mode == 0xFF ? 2 : 1); has_update(hc->mode, mode == 0xFF ? 2 : 1);
}
} }
has_update(telegram, hc->daytemp, 2); // is * 2 has_update(telegram, hc->daytemp, 2); // is * 2
has_update(telegram, hc->nighttemp, 4); // is * 2 has_update(telegram, hc->nighttemp, 4); // is * 2
@@ -1063,7 +1065,7 @@ void Thermostat::process_RC300Summer(std::shared_ptr<const Telegram> telegram) {
has_update(telegram, hc->roominfluence, 0); has_update(telegram, hc->roominfluence, 0);
has_update(telegram, hc->roominfl_factor, 1); // is * 10 has_update(telegram, hc->roominfl_factor, 1); // is * 10
has_update(telegram, hc->offsettemp, 2); has_update(telegram, hc->offsettemp, 2);
if (!is_fetch(summer2_typeids[hc->hc()])) { if (!is_received(summer2_typeids[hc->hc()])) {
has_update(telegram, hc->summertemp, 6); has_update(telegram, hc->summertemp, 6);
has_update(telegram, hc->summersetmode, 7); has_update(telegram, hc->summersetmode, 7);
} }
@@ -2616,7 +2618,7 @@ bool Thermostat::set_summermode(const char * value, const int8_t id) {
uint8_t set; uint8_t set;
if (is_fetch(summer2_typeids[hc->hc()])) { if (is_received(summer2_typeids[hc->hc()])) {
if ((hc->statusbyte & 1) && Helpers::value2enum(value, set, FL_(enum_summermode))) { if ((hc->statusbyte & 1) && Helpers::value2enum(value, set, FL_(enum_summermode))) {
write_command(summer2_typeids[hc->hc()], 0, set, summer2_typeids[hc->hc()]); write_command(summer2_typeids[hc->hc()], 0, set, summer2_typeids[hc->hc()]);
return true; return true;
@@ -3169,7 +3171,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
validate_typeid = set_typeids[hc->hc()]; validate_typeid = set_typeids[hc->hc()];
switch (mode) { switch (mode) {
case HeatingCircuit::Mode::SUMMER: case HeatingCircuit::Mode::SUMMER:
if (is_fetch(summer2_typeids[hc->hc()])) { if (is_received(summer2_typeids[hc->hc()])) {
offset = 0x01; offset = 0x01;
set_typeid = summer2_typeids[hc->hc()]; set_typeid = summer2_typeids[hc->hc()];
} else { } else {
@@ -3604,7 +3606,7 @@ void Thermostat::register_device_values() {
&wwDisinfectHour_, &wwDisinfectHour_,
DeviceValueType::UINT, DeviceValueType::UINT,
DeviceValueNumOp::DV_NUMOP_MUL15, DeviceValueNumOp::DV_NUMOP_MUL15,
FL_(wwDisinfectHour), FL_(wwDisinfectTime),
DeviceValueUOM::MINUTES, DeviceValueUOM::MINUTES,
MAKE_CF_CB(set_wwDisinfectHour), MAKE_CF_CB(set_wwDisinfectHour),
0, 0,

View File

@@ -41,7 +41,7 @@ class Thermostat : public EMSdevice {
uint8_t tempautotemp; uint8_t tempautotemp;
int8_t remoteseltemp; int8_t remoteseltemp;
uint8_t mode; uint8_t mode;
uint8_t mode_new; uint8_t mode_new = EMS_VALUE_UINT_NOTSET; // not initialized by register_value
uint8_t modetype; uint8_t modetype;
uint8_t summermode; uint8_t summermode;
uint8_t holidaymode; uint8_t holidaymode;

View File

@@ -333,6 +333,16 @@ bool EMSdevice::is_fetch(uint16_t telegram_id) const {
return false; return false;
} }
// get status of automatic fetch for a telegramID
bool EMSdevice::is_received(uint16_t telegram_id) const {
for (const auto & tf : telegram_functions_) {
if (tf.telegram_type_id_ == telegram_id) {
return tf.received_;
}
}
return false;
}
// check for a tag to create a nest // check for a tag to create a nest
bool EMSdevice::has_tags(const uint8_t tag) const { bool EMSdevice::has_tags(const uint8_t tag) const {
for (const auto & dv : devicevalues_) { for (const auto & dv : devicevalues_) {

View File

@@ -316,6 +316,7 @@ class EMSdevice {
void fetch_values(); void fetch_values();
void toggle_fetch(uint16_t telegram_id, bool toggle); void toggle_fetch(uint16_t telegram_id, bool toggle);
bool is_fetch(uint16_t telegram_id) const; bool is_fetch(uint16_t telegram_id) const;
bool is_received(uint16_t telegram_id) const;
bool has_telegram_id(uint16_t id) const; bool has_telegram_id(uint16_t id) const;
void ha_config_clear(); void ha_config_clear();

View File

@@ -614,7 +614,7 @@ MAKE_TRANSLATION(wwChargeDuration, "wwchargeduration", "charge duration", "Laded
MAKE_TRANSLATION(wwDisinfect, "wwdisinfect", "disinfection", "Desinfektion", "Desinfectie", "Desinfektion", "dezynfekcja termiczna", "desinfeksjon", "désinfection", "dezenfeksiyon", "disinfezione") MAKE_TRANSLATION(wwDisinfect, "wwdisinfect", "disinfection", "Desinfektion", "Desinfectie", "Desinfektion", "dezynfekcja termiczna", "desinfeksjon", "désinfection", "dezenfeksiyon", "disinfezione")
MAKE_TRANSLATION(wwDisinfectDay, "wwdisinfectday", "disinfection day", "Desinfektionstag", "Desinfectiedag", "Desinfektionsdag", "dzień dezynfekcji termicznej", "desinfeksjonsdag", "jour désinfection", "dezenfeksiyon günü", "giorno disinfezione") MAKE_TRANSLATION(wwDisinfectDay, "wwdisinfectday", "disinfection day", "Desinfektionstag", "Desinfectiedag", "Desinfektionsdag", "dzień dezynfekcji termicznej", "desinfeksjonsdag", "jour désinfection", "dezenfeksiyon günü", "giorno disinfezione")
MAKE_TRANSLATION(wwDisinfectHour, "wwdisinfecthour", "disinfection hour", "Desinfektionsstunde", "Desinfectieuur", "Desinfektionstimme", "godzina dezynfekcji termicznej", "desinfeksjonstime", "heure désinfection", "dezenfeksiyon saati", "ora disinfezione") MAKE_TRANSLATION(wwDisinfectHour, "wwdisinfecthour", "disinfection hour", "Desinfektionsstunde", "Desinfectieuur", "Desinfektionstimme", "godzina dezynfekcji termicznej", "desinfeksjonstime", "heure désinfection", "dezenfeksiyon saati", "ora disinfezione")
MAKE_TRANSLATION(wwDisinfectTime, "wwdisinfecttime", "disinfection time", "Desinfektionsdauer", "Desinfectietijd", "Desinfektionstid", "maksymalny czas trwania dezynfekcji termicznej", "desinfeksjonstid", "durée désinfection", "dezenfeksiyon zamanı", "orario disinfezione") MAKE_TRANSLATION(wwDisinfectTime, "wwdisinfecttime", "disinfection time", "Desinfektionszeit", "Desinfectietijd", "Desinfektionstid", "maksymalny czas trwania dezynfekcji termicznej", "desinfeksjonstid", "durée désinfection", "dezenfeksiyon zamanı", "orario disinfezione")
MAKE_TRANSLATION(wwDailyHeating, "wwdailyheating", "daily heating", "täglich Heizen", "Dagelijks opwarmen", "Daglig Uppvärmning", "codzienne nagrzewanie", "daglig oppvarming", "chauffage quotidien", "günlük ısıtma", "riscaldamento giornaliero") MAKE_TRANSLATION(wwDailyHeating, "wwdailyheating", "daily heating", "täglich Heizen", "Dagelijks opwarmen", "Daglig Uppvärmning", "codzienne nagrzewanie", "daglig oppvarming", "chauffage quotidien", "günlük ısıtma", "riscaldamento giornaliero")
MAKE_TRANSLATION(wwDailyHeatTime, "wwdailyheattime", "daily heating time", "tägliche Heizzeit", "Tijd dagelijkse opwarming", "Daglig Uppvärmningstid", "czas trwania codziennego nagrzewania", "daglig oppvarmingstid", "heure chauffage quotidien", "günlük ısıtma süresi", "orario riscaldamento giornaliero") MAKE_TRANSLATION(wwDailyHeatTime, "wwdailyheattime", "daily heating time", "tägliche Heizzeit", "Tijd dagelijkse opwarming", "Daglig Uppvärmningstid", "czas trwania codziennego nagrzewania", "daglig oppvarmingstid", "heure chauffage quotidien", "günlük ısıtma süresi", "orario riscaldamento giornaliero")