mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Boiler: sort values, delete doubles, thermostat: add mode to change temp
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
[platformio]
|
||||
default_envs = esp8266
|
||||
; default_envs = esp32
|
||||
; default_envs = esp32_d1
|
||||
|
||||
# override any settings with your own local ones in pio_local.ini
|
||||
extra_configs = pio_local.ini
|
||||
@@ -74,7 +73,7 @@ upload_protocol = espota
|
||||
upload_flags =
|
||||
--port=8266
|
||||
--auth=neo
|
||||
;upload_port = 192.168.0.20
|
||||
upload_port = ems-esp.local
|
||||
|
||||
[env:esp8266]
|
||||
build_type = release
|
||||
@@ -87,7 +86,6 @@ board_build.f_cpu = 160000000L ; 160MHz
|
||||
board_build.ldscript = eagle.flash.4m1m.ld ; 1019 KB sketch, 1000 KB SPIFFS. 4KB EEPROM, 4KB RFCAL, 12KB WIFI stack, 2052 KB OTA & buffer
|
||||
; board_build.ldscript = eagle.flash.4m2m.ld ; 1019 KB sketch, 2024 KB SPIFFS. 4KB EEPROM, 4KB RFCAL, 12KB WIFI stack, 1028 KB OTA & buffer
|
||||
build_flags = ${common.build_flags} ${common.debug_flags} -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
upload_port = 192.168.0.20
|
||||
|
||||
[env:esp32]
|
||||
build_type = release
|
||||
@@ -95,11 +93,3 @@ platform = espressif32
|
||||
board = esp32dev
|
||||
lib_deps = ${common.libs_core} ${common.libs_esp32}
|
||||
build_flags = ${common.build_flags} ${common.debug_flags} -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
|
||||
|
||||
[env:esp32_d1]
|
||||
build_type = release
|
||||
platform = espressif32
|
||||
board = wemos_d1_mini32
|
||||
lib_deps = ${common.libs_core} ${common.libs_esp32}
|
||||
build_flags = ${common.build_flags} ${common.debug_flags} -D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH -D WEMOS_D1_32
|
||||
upload_port = 192.168.0.23
|
||||
|
||||
@@ -335,9 +335,6 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
||||
|
||||
char buffer[10]; // used for formatting
|
||||
|
||||
print_value(shell, 2, F("Selected flow temperature"), F_(degrees), Helpers::render_value(buffer, selFlowTemp_, 1));
|
||||
print_value(shell, 2, F("Warm Water selected temperature"), F_(degrees), Helpers::render_value(buffer, wWSelTemp_, 1));
|
||||
|
||||
if (tap_water_active_ != EMS_VALUE_BOOL_NOTSET) {
|
||||
print_value(shell, 2, F("Hot tap water"), tap_water_active_ ? "running" : "off");
|
||||
}
|
||||
@@ -347,8 +344,8 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
||||
}
|
||||
|
||||
print_value(shell, 2, F("Warm Water activated"), Helpers::render_value(buffer, wWActivated_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Warm Water charging type"), wWCircPumpType_ ? "3-way valve" : "charge pump");
|
||||
print_value(shell, 2, F("Warm Water circulation pump available"), Helpers::render_value(buffer, wWCircPump_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Warm Water circulation pump type"), wWCircPumpType_ ? "3-way pump" : "charge pump");
|
||||
if (wWCircPumpMode_ == 7) {
|
||||
print_value(shell, 2, F("Warm Water circulation pump freq"), "continuous");
|
||||
} else {
|
||||
@@ -360,6 +357,7 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
||||
strlcat(s, "x3min", 7);
|
||||
print_value(shell, 2, F("Warm Water circulation pump freq"), s);
|
||||
}
|
||||
print_value(shell, 2, F("Warm Water circulation active"), Helpers::render_value(buffer, wWCirc_, EMS_VALUE_BOOL));
|
||||
|
||||
if (wWComfort_ == 0x00) {
|
||||
print_value(shell, 2, F("Warm Water comfort setting"), "Hot");
|
||||
@@ -369,20 +367,20 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
||||
print_value(shell, 2, F("Warm Water comfort setting"), "Intelligent");
|
||||
}
|
||||
|
||||
print_value(shell, 2, F("Warm Water selected temperature"), F_(degrees), Helpers::render_value(buffer, wWSelTemp_, 1));
|
||||
print_value(shell, 2, F("Warm Water disinfection temperature"), F_(degrees), Helpers::render_value(buffer, wWDisinfectTemp_, 1));
|
||||
print_value(shell, 2, F("Warm Water circulation active"), F_(degrees), Helpers::render_value(buffer, wWCirc_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Warm Water selected temperature"), F_(degrees), Helpers::render_value(buffer, wWSelTemp_, 1));
|
||||
print_value(shell, 2, F("Warm Water set temperature"), F_(degrees), Helpers::render_value(buffer, wWSetTmp_, 1));
|
||||
print_value(shell, 2, F("Warm Water current temperature"), F_(degrees), Helpers::render_value(buffer, wWCurTmp_, 10));
|
||||
print_value(shell, 2, F("Warm water temperature (intern)"), F_(degrees), Helpers::render_value(buffer, wwStorageTemp1_, 10));
|
||||
print_value(shell, 2, F("Warm water temperature (extern)"), F_(degrees), Helpers::render_value(buffer, wwStorageTemp2_, 10));
|
||||
print_value(shell, 2, F("Warm Water current temperature (intern)"), F_(degrees), Helpers::render_value(buffer, wWCurTmp_, 10));
|
||||
print_value(shell, 2, F("Warm water storage temperature (intern)"), F_(degrees), Helpers::render_value(buffer, wwStorageTemp1_, 10));
|
||||
print_value(shell, 2, F("Warm Water current temperature (extern)"), F_(degrees), Helpers::render_value(buffer, wWCurTmp2_, 10));
|
||||
print_value(shell, 2, F("Warm water storage temperature (extern)"), F_(degrees), Helpers::render_value(buffer, wwStorageTemp2_, 10));
|
||||
print_value(shell, 2, F("Warm Water current tap water flow"), F("l/min"), Helpers::render_value(buffer, wWCurFlow_, 10));
|
||||
print_value(shell, 2, F("Warm Water # starts"), Helpers::render_value(buffer, wWStarts_, 1));
|
||||
if (wWWorkM_ != EMS_VALUE_ULONG_NOTSET) {
|
||||
shell.printfln(F(" Warm Water active time: %d days %d hours %d minutes"), wWWorkM_ / 1440, (wWWorkM_ % 1440) / 60, wWWorkM_ % 60);
|
||||
}
|
||||
print_value(shell, 2, F("Warm Water 3-way valve"), Helpers::render_value(buffer, wWHeat_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Warm Water charging"), Helpers::render_value(buffer, wWHeat_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Warm Water disinfecting"), Helpers::render_value(buffer, wWDesinfecting_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Selected flow temperature"), F_(degrees), Helpers::render_value(buffer, selFlowTemp_, 1));
|
||||
print_value(shell, 2, F("Current flow temperature"), F_(degrees), Helpers::render_value(buffer, curFlowTemp_, 10));
|
||||
print_value(shell, 2, F("Max boiler temperature"), F_(degrees), Helpers::render_value(buffer, boilTemp_, 10));
|
||||
@@ -391,7 +389,6 @@ void Boiler::show_values(uuid::console::Shell & shell) {
|
||||
print_value(shell, 2, F("Boiler pump"), Helpers::render_value(buffer, heatPmp_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Fan"), Helpers::render_value(buffer, fanWork_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Ignition"), Helpers::render_value(buffer, ignWork_, EMS_VALUE_BOOL));
|
||||
print_value(shell, 2, F("Circulation pump"), Helpers::render_value(buffer, wWCirc_, EMS_VALUE_BOOL));
|
||||
|
||||
print_value(shell, 2, F("Burner selected max power"), F_(percent), Helpers::render_value(buffer, selBurnPow_, 1));
|
||||
print_value(shell, 2, F("Burner current power"), F_(percent), Helpers::render_value(buffer, curBurnPow_, 1));
|
||||
|
||||
@@ -824,6 +824,7 @@ void EMSESP::loop() {
|
||||
txservice_.loop(); // check that the Tx is all ok
|
||||
shower_.loop(); // check for shower on/off
|
||||
sensors_.loop(); // this will also send out via MQTT
|
||||
delay(MYESP_DELAY); // some time to WiFi and everything else to catch up, calls yield, and also prevent overheating
|
||||
|
||||
// force a query on the EMS devices to fetch latest data at a set interval (1 min)
|
||||
if ((uuid::get_uptime() - last_fetch_ > EMS_FETCH_FREQUENCY)) {
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "shower.h"
|
||||
|
||||
#define LOG_TRACE_WATCH_NONE 0 // no watch set
|
||||
#define MYESP_DELAY 1
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ MAKE_PSTR_WORD(mode)
|
||||
|
||||
MAKE_PSTR(hc_optional, "[heating circuit]")
|
||||
MAKE_PSTR(mode_mandatory, "<mode>")
|
||||
MAKE_PSTR(mode_optional, "[mode]")
|
||||
MAKE_PSTR(master_thermostat_fmt, "Master Thermostat device ID = %s")
|
||||
|
||||
namespace emsesp {
|
||||
@@ -527,13 +528,16 @@ void Thermostat::publish_values() {
|
||||
dataThermostat["circuitcalctemp"] = hc->circuitcalctemp;
|
||||
}
|
||||
|
||||
if (hc->offsettemp != 100) {
|
||||
dataThermostat["offsettemp"] = (int8_t)hc->offsettemp / 2;
|
||||
if (hc->offsettemp != EMS_VALUE_INT_NOTSET) {
|
||||
dataThermostat["offsettemp"] = hc->offsettemp / 2;
|
||||
}
|
||||
|
||||
if (hc->designtemp != EMS_VALUE_UINT_NOTSET) {
|
||||
dataThermostat["designtemp"] = hc->designtemp;
|
||||
}
|
||||
if (hc->designtemp != EMS_VALUE_UINT_NOTSET) {
|
||||
dataThermostat["summertemp"] = hc->summertemp;
|
||||
}
|
||||
|
||||
// when using HA always send the mode otherwise it'll break the component/widget and report an error
|
||||
if ((hc->mode != EMS_VALUE_UINT_NOTSET) || (mqtt_format_ == Settings::MQTT_format::HA)) {
|
||||
@@ -888,10 +892,9 @@ void Thermostat::show_values(uuid::console::Shell & shell) {
|
||||
print_value(shell, 4, F("Night temperature"), F_(degrees), Helpers::render_value(buffer, hc->nighttemp, 2));
|
||||
print_value(shell, 4, F("Holiday temperature"), F_(degrees), Helpers::render_value(buffer, hc->holidaytemp, 2));
|
||||
|
||||
if (hc->offsettemp < 100) {
|
||||
print_value(shell, 4, F("Offset temperature"), F_(degrees), Helpers::render_value(buffer, hc->offsettemp, 2));
|
||||
}
|
||||
print_value(shell, 4, F("Offset temperature"), F_(degrees), Helpers::render_value(buffer, hc->offsettemp, 2));
|
||||
print_value(shell, 4, F("Design temperature"), F_(degrees), Helpers::render_value(buffer, hc->designtemp, 0));
|
||||
print_value(shell, 4, F("Summer temperature"), F_(degrees), Helpers::render_value(buffer, hc->summertemp, 0));
|
||||
}
|
||||
|
||||
// show flow temp if we have it
|
||||
@@ -1250,6 +1253,35 @@ void Thermostat::set_mode(const uint8_t mode, const uint8_t hc_num) {
|
||||
write_command(set_typeids[hc->hc_num() - 1], offset, set_mode_value, validate_typeid);
|
||||
}
|
||||
|
||||
// sets the thermostat temp, where mode is a string
|
||||
void Thermostat::set_temperature(const float temperature, const std::string & mode, const uint8_t hc_num) {
|
||||
if (mode_tostring(HeatingCircuit::Mode::MANUAL) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::MANUAL, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::AUTO) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::AUTO, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::DAY) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::DAY, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::NIGHT) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::NIGHT, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::COMFORT) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::COMFORT, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::HEAT) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::HEAT, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::NOFROST) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::NOFROST, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::SUMMER) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::SUMMER, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::HOLIDAY) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::HOLIDAY, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::OFFSET) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::OFFSET, hc_num);
|
||||
} else if (mode_tostring(HeatingCircuit::Mode::DESIGN) == mode) {
|
||||
set_temperature(temperature, HeatingCircuit::Mode::DESIGN, hc_num);
|
||||
} else {
|
||||
LOG_WARNING(F("Invalid mode %s."), mode.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// Set the temperature of the thermostat
|
||||
void Thermostat::set_temperature(const float temperature, const uint8_t mode, const uint8_t hc_num) {
|
||||
if (can_write()) {
|
||||
@@ -1425,10 +1457,16 @@ void Thermostat::console_commands(Shell & shell, unsigned int context) {
|
||||
EMSESPShell::commands->add_command(ShellContext::THERMOSTAT,
|
||||
CommandFlags::ADMIN,
|
||||
flash_string_vector{F_(change), F_(temp)},
|
||||
flash_string_vector{F_(degrees_mandatory), F_(hc_optional)},
|
||||
flash_string_vector{F_(degrees_mandatory), F_(hc_optional),F_(mode_optional)},
|
||||
[=](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
|
||||
uint8_t hc = (arguments.size() == 1) ? DEFAULT_HEATING_CIRCUIT : arguments[1].at(0) - '0';
|
||||
set_temperature(atof(arguments.front().c_str()), HeatingCircuit::Mode::AUTO, hc);
|
||||
uint8_t hc = (arguments.size() >= 2) ? arguments[1].at(0) - '0' : DEFAULT_HEATING_CIRCUIT;
|
||||
//uint8_t mode = (arguments.size() == 3) ? atoi(arguments.back().c_str()) : HeatingCircuit::Mode::AUTO;
|
||||
if ((arguments.size() == 3)) {
|
||||
set_temperature(atof(arguments.front().c_str()), arguments.back().c_str(), hc);
|
||||
} else {
|
||||
set_temperature(atof(arguments.front().c_str()), HeatingCircuit::Mode::AUTO, hc);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EMSESPShell::commands->add_command(
|
||||
@@ -1437,7 +1475,7 @@ void Thermostat::console_commands(Shell & shell, unsigned int context) {
|
||||
flash_string_vector{F_(change), F_(mode)},
|
||||
flash_string_vector{F_(mode_mandatory), F_(hc_optional)},
|
||||
[=](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
|
||||
uint8_t hc = (arguments.size() == 1) ? DEFAULT_HEATING_CIRCUIT : arguments[1].at(0) - '0';
|
||||
uint8_t hc = (arguments.size() == 2) ? arguments[1].at(0) - '0' : DEFAULT_HEATING_CIRCUIT;
|
||||
set_mode(arguments.front(), hc);
|
||||
},
|
||||
[](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments __attribute__((unused))) -> const std::vector<std::string> {
|
||||
|
||||
@@ -60,7 +60,7 @@ class Thermostat : public EMSdevice {
|
||||
uint8_t summertemp = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t nofrosttemp = EMS_VALUE_UINT_NOTSET;
|
||||
uint8_t designtemp = EMS_VALUE_UINT_NOTSET; // heatingcurve design temp at MinExtTemp
|
||||
uint8_t offsettemp = 100; // heatingcurve offest temp at roomtemp signed!
|
||||
int8_t offsettemp = EMS_VALUE_INT_NOTSET; // heatingcurve offest temp at roomtemp signed!
|
||||
uint16_t remotetemp = EMS_VALUE_SHORT_NOTSET; // for simulating a RC20 remote
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ class Thermostat : public EMSdevice {
|
||||
void set_settings_language(const uint8_t lg);
|
||||
void set_mode(const uint8_t mode, const uint8_t hc_num);
|
||||
void set_mode(const std::string & mode, const uint8_t hc_num);
|
||||
void set_temperature(const float temperature, const std::string & mode, const uint8_t hc_num);
|
||||
void set_temperature(const float temperature, const uint8_t mode, const uint8_t hc_num);
|
||||
|
||||
// MQTT functions
|
||||
|
||||
Reference in New Issue
Block a user