mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Fix #505, add RC300 mqtt commands
This commit is contained in:
@@ -352,17 +352,25 @@ void Thermostat::publish_values() {
|
|||||||
if (Helpers::hasValue(hc->daytemp)) {
|
if (Helpers::hasValue(hc->daytemp)) {
|
||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
||||||
dataThermostat["heattemp"] = (float)hc->daytemp / 2;
|
dataThermostat["heattemp"] = (float)hc->daytemp / 2;
|
||||||
|
} else if (flags == EMSdevice::EMS_DEVICE_FLAG_RC300 || flags == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
||||||
|
dataThermostat["comforttemp"] = (float)hc->daytemp / 2;
|
||||||
} else {
|
} else {
|
||||||
dataThermostat["daytemp"] = (float)hc->daytemp / 2;
|
dataThermostat["daytemp"] = (float)hc->daytemp / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(hc->nighttemp)) {
|
if (Helpers::hasValue(hc->nighttemp)) {
|
||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS || flags == EMSdevice::EMS_DEVICE_FLAG_RC300 || flags == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
||||||
dataThermostat["ecotemp"] = (float)hc->nighttemp / 2;
|
dataThermostat["ecotemp"] = (float)hc->nighttemp / 2;
|
||||||
} else {
|
} else {
|
||||||
dataThermostat["nighttemp"] = (float)hc->nighttemp / 2;
|
dataThermostat["nighttemp"] = (float)hc->nighttemp / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Helpers::hasValue(hc->manualtemp)) {
|
||||||
|
dataThermostat["manualtemp"] = (float)hc->manualtemp / 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (Helpers::hasValue(hc->holidaytemp)) {
|
if (Helpers::hasValue(hc->holidaytemp)) {
|
||||||
dataThermostat["holidaytemp"] = (float)hc->holidaytemp / 2;
|
dataThermostat["holidaytemp"] = (float)hc->holidaytemp / 2;
|
||||||
}
|
}
|
||||||
@@ -851,17 +859,22 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
|||||||
if (Helpers::hasValue(hc->daytemp)) {
|
if (Helpers::hasValue(hc->daytemp)) {
|
||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
||||||
print_value(shell, 4, F("Heat temperature"), hc->daytemp, F_(degrees), 2);
|
print_value(shell, 4, F("Heat temperature"), hc->daytemp, F_(degrees), 2);
|
||||||
|
} else if (flags == EMSdevice::EMS_DEVICE_FLAG_RC300 || flags == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
||||||
|
print_value(shell, 4, F("Comfort temperature"), hc->daytemp, F_(degrees), 2);
|
||||||
} else {
|
} else {
|
||||||
print_value(shell, 4, F("Day temperature"), hc->daytemp, F_(degrees), 2);
|
print_value(shell, 4, F("Day temperature"), hc->daytemp, F_(degrees), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Helpers::hasValue(hc->nighttemp)) {
|
if (Helpers::hasValue(hc->nighttemp)) {
|
||||||
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS) {
|
if (flags == EMSdevice::EMS_DEVICE_FLAG_JUNKERS || flags == EMSdevice::EMS_DEVICE_FLAG_RC300 || flags == EMSdevice::EMS_DEVICE_FLAG_RC100) {
|
||||||
print_value(shell, 4, F("Eco temperature"), hc->nighttemp, F_(degrees), 2);
|
print_value(shell, 4, F("Eco temperature"), hc->nighttemp, F_(degrees), 2);
|
||||||
} else {
|
} else {
|
||||||
print_value(shell, 4, F("Night temperature"), hc->nighttemp, F_(degrees), 2);
|
print_value(shell, 4, F("Night temperature"), hc->nighttemp, F_(degrees), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Helpers::hasValue(hc->manualtemp)) {
|
||||||
|
print_value(shell, 4, F("Manual temperature"), hc->manualtemp, F_(degrees), 2);
|
||||||
|
}
|
||||||
if (Helpers::hasValue(hc->nofrosttemp)) {
|
if (Helpers::hasValue(hc->nofrosttemp)) {
|
||||||
print_value(shell, 4, F("Nofrost temperature"), hc->nofrosttemp, F_(degrees), 2);
|
print_value(shell, 4, F("Nofrost temperature"), hc->nofrosttemp, F_(degrees), 2);
|
||||||
}
|
}
|
||||||
@@ -1031,17 +1044,18 @@ void Thermostat::process_RC300Set(std::shared_ptr<const Telegram> telegram) {
|
|||||||
|
|
||||||
// NOTE when setting the room temp we pick from two values, hopefully one is correct!
|
// NOTE when setting the room temp we pick from two values, hopefully one is correct!
|
||||||
// manual is position 10
|
// manual is position 10
|
||||||
// comfort is position 2
|
// comfort is position 2, there are 3 levels in pos 3, 2, 1
|
||||||
// I think auto is position 8?
|
// eco is position 4
|
||||||
|
// auto is position 8, temporary until next switch
|
||||||
// actual setpoint taken from RC300Monitor (Michael 12.06.2020)
|
// actual setpoint taken from RC300Monitor (Michael 12.06.2020)
|
||||||
// changed_ |= telegram->read_value(hc->setpoint_roomTemp, 8, 1); // single byte conversion, value is * 2 - auto?
|
// changed_ |= telegram->read_value(hc->setpoint_roomTemp, 8, 1); // single byte conversion, value is * 2 - auto?
|
||||||
// changed_ |= telegram->read_value(hc->setpoint_roomTemp, 10, 1); // single byte conversion, value is * 2 - manual
|
// changed_ |= telegram->read_value(hc->setpoint_roomTemp, 10, 1); // single byte conversion, value is * 2 - manual
|
||||||
|
|
||||||
// check why mode is both in the Monitor and Set for the RC300. It'll be read twice!
|
// check why mode is both in the Monitor and Set for the RC300. It'll be read twice!
|
||||||
// changed_ |= telegram->read_value(hc->mode, 0); // Auto = xFF, Manual = x00 eg. 10 00 FF 08 01 B9 FF
|
// changed_ |= telegram->read_value(hc->mode, 0); // Auto = xFF, Manual = x00 eg. 10 00 FF 08 01 B9 FF
|
||||||
|
changed_ |= telegram->read_value(hc->daytemp, 2); // is * 2
|
||||||
changed_ |= telegram->read_value(hc->daytemp, 2); // is * 2
|
changed_ |= telegram->read_value(hc->nighttemp, 4); // is * 2
|
||||||
changed_ |= telegram->read_value(hc->nighttemp, 4); // is * 2
|
changed_ |= telegram->read_value(hc->manualtemp, 10); // is * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// types 0x31D and 0x31E
|
// types 0x31D and 0x31E
|
||||||
@@ -1580,6 +1594,8 @@ void Thermostat::set_temperature(const float temperature, const std::string & mo
|
|||||||
set_temperature(temperature, HeatingCircuit::Mode::COMFORT, hc_num);
|
set_temperature(temperature, HeatingCircuit::Mode::COMFORT, hc_num);
|
||||||
} else if (mode_tostring(HeatingCircuit::Mode::HEAT) == mode) {
|
} else if (mode_tostring(HeatingCircuit::Mode::HEAT) == mode) {
|
||||||
set_temperature(temperature, HeatingCircuit::Mode::HEAT, hc_num);
|
set_temperature(temperature, HeatingCircuit::Mode::HEAT, hc_num);
|
||||||
|
} else if (mode_tostring(HeatingCircuit::Mode::ECO) == mode) {
|
||||||
|
set_temperature(temperature, HeatingCircuit::Mode::ECO, hc_num);
|
||||||
} else if (mode_tostring(HeatingCircuit::Mode::NOFROST) == mode) {
|
} else if (mode_tostring(HeatingCircuit::Mode::NOFROST) == mode) {
|
||||||
set_temperature(temperature, HeatingCircuit::Mode::NOFROST, hc_num);
|
set_temperature(temperature, HeatingCircuit::Mode::NOFROST, hc_num);
|
||||||
} else if (mode_tostring(HeatingCircuit::Mode::SUMMER) == mode) {
|
} else if (mode_tostring(HeatingCircuit::Mode::SUMMER) == mode) {
|
||||||
@@ -1626,11 +1642,19 @@ void Thermostat::set_temperature(const float temperature, const uint8_t mode, co
|
|||||||
offset = 0x0A; // manual offset
|
offset = 0x0A; // manual offset
|
||||||
break;
|
break;
|
||||||
case HeatingCircuit::Mode::COMFORT:
|
case HeatingCircuit::Mode::COMFORT:
|
||||||
offset = 0x02; // comfort offset
|
offset = 0x02; // comfort offset level 2
|
||||||
|
break;
|
||||||
|
case HeatingCircuit::Mode::ECO:
|
||||||
|
offset = 0x04; // eco offset
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case HeatingCircuit::Mode::AUTO:
|
case HeatingCircuit::Mode::AUTO:
|
||||||
offset = 0x08; // auto offset
|
uint8_t mode_ = hc->get_mode(this->flags());
|
||||||
|
if (mode_ == HeatingCircuit::Mode::MANUAL) {
|
||||||
|
offset = 0x0A; // manual offset
|
||||||
|
} else {
|
||||||
|
offset = 0x08; // auto offset
|
||||||
|
}
|
||||||
validate_typeid = monitor_typeids[hc->hc_num() - 1]; // get setpoint roomtemp back
|
validate_typeid = monitor_typeids[hc->hc_num() - 1]; // get setpoint roomtemp back
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1801,6 +1825,10 @@ void Thermostat::set_daytemp(const char * value, const int8_t id) {
|
|||||||
set_temperature_value(value, id, HeatingCircuit::Mode::DAY);
|
set_temperature_value(value, id, HeatingCircuit::Mode::DAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Thermostat::set_comforttemp(const char * value, const int8_t id) {
|
||||||
|
set_temperature_value(value, id, HeatingCircuit::Mode::COMFORT);
|
||||||
|
}
|
||||||
|
|
||||||
void Thermostat::set_nofrosttemp(const char * value, const int8_t id) {
|
void Thermostat::set_nofrosttemp(const char * value, const int8_t id) {
|
||||||
set_temperature_value(value, id, HeatingCircuit::Mode::NOFROST);
|
set_temperature_value(value, id, HeatingCircuit::Mode::NOFROST);
|
||||||
}
|
}
|
||||||
@@ -1829,6 +1857,10 @@ void Thermostat::set_holidaytemp(const char * value, const int8_t id) {
|
|||||||
set_temperature_value(value, id, HeatingCircuit::Mode::HOLIDAY);
|
set_temperature_value(value, id, HeatingCircuit::Mode::HOLIDAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Thermostat::set_manualtemp(const char * value, const int8_t id) {
|
||||||
|
set_temperature_value(value, id, HeatingCircuit::Mode::MANUAL);
|
||||||
|
}
|
||||||
|
|
||||||
// commands for MQTT and Console
|
// commands for MQTT and Console
|
||||||
void Thermostat::add_commands() {
|
void Thermostat::add_commands() {
|
||||||
// if this thermostat doesn't support write, don't add the commands
|
// if this thermostat doesn't support write, don't add the commands
|
||||||
@@ -1843,6 +1875,12 @@ void Thermostat::add_commands() {
|
|||||||
|
|
||||||
uint8_t model = this->model();
|
uint8_t model = this->model();
|
||||||
switch (model) {
|
switch (model) {
|
||||||
|
case EMS_DEVICE_FLAG_RC100:
|
||||||
|
case EMS_DEVICE_FLAG_RC300:
|
||||||
|
register_mqtt_cmd(F("manualtemp"), [&](const char * value, const int8_t id) { set_manualtemp(value, id); });
|
||||||
|
register_mqtt_cmd(F("ecotemp"), [&](const char * value, const int8_t id) { set_ecotemp(value, id); });
|
||||||
|
register_mqtt_cmd(F("comforttemp"), [&](const char * value, const int8_t id) { set_comforttemp(value, id); });
|
||||||
|
break;
|
||||||
case EMS_DEVICE_FLAG_RC20_2:
|
case EMS_DEVICE_FLAG_RC20_2:
|
||||||
register_mqtt_cmd(F("nighttemp"), [&](const char * value, const int8_t id) { set_nighttemp(value, id); });
|
register_mqtt_cmd(F("nighttemp"), [&](const char * value, const int8_t id) { set_nighttemp(value, id); });
|
||||||
register_mqtt_cmd(F("daytemp"), [&](const char * value, const int8_t id) { set_daytemp(value, id); });
|
register_mqtt_cmd(F("daytemp"), [&](const char * value, const int8_t id) { set_daytemp(value, id); });
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class Thermostat : public EMSdevice {
|
|||||||
uint8_t nofrosttemp = EMS_VALUE_UINT_NOTSET;
|
uint8_t nofrosttemp = EMS_VALUE_UINT_NOTSET;
|
||||||
uint8_t designtemp = EMS_VALUE_UINT_NOTSET; // heating curve design temp at MinExtTemp
|
uint8_t designtemp = EMS_VALUE_UINT_NOTSET; // heating curve design temp at MinExtTemp
|
||||||
int8_t offsettemp = EMS_VALUE_INT_NOTSET; // heating curve offest temp at roomtemp signed!
|
int8_t offsettemp = EMS_VALUE_INT_NOTSET; // heating curve offest temp at roomtemp signed!
|
||||||
|
uint8_t manualtemp = EMS_VALUE_UINT_NOTSET;
|
||||||
|
|
||||||
uint8_t hc_num() const {
|
uint8_t hc_num() const {
|
||||||
return hc_num_;
|
return hc_num_;
|
||||||
@@ -265,6 +266,7 @@ class Thermostat : public EMSdevice {
|
|||||||
void set_temp(const char * value, const int8_t id);
|
void set_temp(const char * value, const int8_t id);
|
||||||
void set_nighttemp(const char * value, const int8_t id);
|
void set_nighttemp(const char * value, const int8_t id);
|
||||||
void set_daytemp(const char * value, const int8_t id);
|
void set_daytemp(const char * value, const int8_t id);
|
||||||
|
void set_comforttemp(const char * value, const int8_t id);
|
||||||
void set_nofrosttemp(const char * value, const int8_t id);
|
void set_nofrosttemp(const char * value, const int8_t id);
|
||||||
void set_ecotemp(const char * value, const int8_t id);
|
void set_ecotemp(const char * value, const int8_t id);
|
||||||
void set_heattemp(const char * value, const int8_t id);
|
void set_heattemp(const char * value, const int8_t id);
|
||||||
@@ -272,6 +274,7 @@ class Thermostat : public EMSdevice {
|
|||||||
void set_designtemp(const char * value, const int8_t id);
|
void set_designtemp(const char * value, const int8_t id);
|
||||||
void set_offsettemp(const char * value, const int8_t id);
|
void set_offsettemp(const char * value, const int8_t id);
|
||||||
void set_holidaytemp(const char * value, const int8_t id);
|
void set_holidaytemp(const char * value, const int8_t id);
|
||||||
|
void set_manualtemp(const char * value, const int8_t id);
|
||||||
|
|
||||||
void set_remotetemp(const char * value, const int8_t id);
|
void set_remotetemp(const char * value, const int8_t id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user