mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-01-28 09:39:11 +03:00
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into dev_no_master_thermostat
This commit is contained in:
@@ -535,7 +535,7 @@ std::string DallasSensor::Sensor::name() const {
|
||||
bool DallasSensor::Sensor::apply_customization() {
|
||||
EMSESP::webCustomizationService.read([&](WebCustomization & settings) {
|
||||
auto sensors = settings.sensorCustomizations;
|
||||
if (sensors.empty()) {
|
||||
if (!sensors.empty()) {
|
||||
for (const auto & sensor : sensors) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
LOG_DEBUG(F("Loading customization for dallas sensor %s"), sensor.id_str.c_str());
|
||||
|
||||
@@ -117,7 +117,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
|
||||
register_telegram_type(set_typeids[i], F("RC300Set"), false, MAKE_PF_CB(process_RC300Set));
|
||||
register_telegram_type(summer_typeids[i], F("RC300Summer"), false, MAKE_PF_CB(process_RC300Summer));
|
||||
register_telegram_type(curve_typeids[i], F("RC300Curves"), false, MAKE_PF_CB(process_RC300Curve));
|
||||
register_telegram_type(summer2_typeids[i], F("RC300Summer2"), true, MAKE_PF_CB(process_RC300Summer2));
|
||||
register_telegram_type(summer2_typeids[i], F("RC300Summer2"), false, MAKE_PF_CB(process_RC300Summer2));
|
||||
}
|
||||
register_telegram_type(0x2F5, F("RC300WWmode"), true, MAKE_PF_CB(process_RC300WWmode));
|
||||
register_telegram_type(0x31B, F("RC300WWtemp"), true, MAKE_PF_CB(process_RC300WWtemp));
|
||||
@@ -328,6 +328,9 @@ std::shared_ptr<Thermostat::HeatingCircuit> Thermostat::heating_circuit(std::sha
|
||||
if (timer2_typeids.size()) {
|
||||
toggle_fetch(timer2_typeids[hc_num - 1], toggle_);
|
||||
}
|
||||
if (summer2_typeids.size()) {
|
||||
toggle_fetch(summer2_typeids[hc_num - 1], toggle_);
|
||||
}
|
||||
|
||||
return new_hc; // return back point to new HC object
|
||||
}
|
||||
|
||||
@@ -324,10 +324,10 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const {
|
||||
}
|
||||
|
||||
// list all the telegram type IDs for this device, outputting to a string (max size 200)
|
||||
char * EMSdevice::show_telegram_handlers(char * result, uint8_t handlers) {
|
||||
char * EMSdevice::show_telegram_handlers(char * result, const size_t len, const uint8_t handlers) {
|
||||
uint8_t size = telegram_functions_.size();
|
||||
|
||||
strlcpy(result, "", 200);
|
||||
strlcpy(result, "", len);
|
||||
|
||||
if (!size) {
|
||||
return result;
|
||||
@@ -338,9 +338,9 @@ char * EMSdevice::show_telegram_handlers(char * result, uint8_t handlers) {
|
||||
if (handlers == Handlers::ALL || (handlers == Handlers::RECEIVED && tf.received_ && !tf.fetch_)
|
||||
|| (handlers == Handlers::FETCHED && tf.received_ && tf.fetch_) || (handlers == Handlers::PENDING && !tf.received_ && !tf.fetch_)) {
|
||||
if (i++ > 0) {
|
||||
strlcat(result, " ", 200);
|
||||
strlcat(result, " ", len);
|
||||
}
|
||||
strlcat(result, Helpers::hextoa(tf.telegram_type_id_, true).c_str(), 200);
|
||||
strlcat(result, Helpers::hextoa(tf.telegram_type_id_, true).c_str(), len);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ class EMSdevice {
|
||||
enum Handlers : uint8_t { ALL, RECEIVED, FETCHED, PENDING };
|
||||
|
||||
void show_telegram_handlers(uuid::console::Shell & shell) const;
|
||||
char * show_telegram_handlers(char * result, uint8_t handlers);
|
||||
char * show_telegram_handlers(char * result, const size_t len, const uint8_t handlers);
|
||||
void show_mqtt_handlers(uuid::console::Shell & shell) const;
|
||||
void list_device_entries(JsonObject & output) const;
|
||||
void exclude_entity(uint8_t entity_id);
|
||||
|
||||
@@ -1281,7 +1281,6 @@ void EMSESP::start() {
|
||||
|
||||
esp8266React.begin(); // loads core system services settings (network, mqtt, ap, ntp etc)
|
||||
webLogService.begin(); // start web log service. now we can start capturing logs to the web log
|
||||
LOG_INFO(F("Starting EMS-ESP version %s (hostname: %s)"), EMSESP_APP_VERSION, system_.hostname().c_str()); // welcome message
|
||||
LOG_INFO(F("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str());
|
||||
|
||||
webSettingsService.begin(); // load EMS-ESP Application settings...
|
||||
@@ -1296,8 +1295,10 @@ void EMSESP::start() {
|
||||
system_.check_upgrade(); // do any system upgrades
|
||||
|
||||
// start all the EMS-ESP services
|
||||
mqtt_.start(); // mqtt init
|
||||
system_.start(); // starts commands, led, adc, button, network, syslog & uart
|
||||
mqtt_.start(); // mqtt init
|
||||
system_.start(); // starts commands, led, adc, button, network, syslog & uart
|
||||
LOG_INFO(F("Starting EMS-ESP version %s (hostname: %s)"), EMSESP_APP_VERSION, system_.hostname().c_str()); // welcome message
|
||||
|
||||
shower_.start(); // initialize shower timer and shower alert
|
||||
dallassensor_.start(); // Dallas external sensors
|
||||
analogsensor_.start(); // Analog external sensors
|
||||
|
||||
@@ -189,11 +189,11 @@ char * Helpers::render_boolean(char * result, bool value) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// render for native char strings
|
||||
char * Helpers::render_value(char * result, const char * value, const int8_t format __attribute__((unused))) {
|
||||
strcpy(result, value); // un-safe but we don't care
|
||||
return result;
|
||||
}
|
||||
// // render for native char strings
|
||||
// char * Helpers::render_value(char * result, const char * value, const int8_t format __attribute__((unused))) {
|
||||
// strcpy(result, value); // un-safe but we don't care
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// convert unsigned int (single byte) to text value and returns it
|
||||
// format: 255(0xFF)=boolean, 0=no formatting, otherwise divide by format
|
||||
|
||||
@@ -37,7 +37,7 @@ class Helpers {
|
||||
static char * render_value(char * result, const uint32_t value, const int8_t format, const uint8_t fahrenheit = 0);
|
||||
static char * render_value(char * result, const int16_t value, const int8_t format, const uint8_t fahrenheit = 0);
|
||||
static char * render_value(char * result, const int32_t value, const int8_t format, const uint8_t fahrenheit = 0);
|
||||
static char * render_value(char * result, const char * value, const int8_t format);
|
||||
// static char * render_value(char * result, const char * value, const int8_t format);
|
||||
static char * render_boolean(char * result, bool value);
|
||||
|
||||
static char * hextoa(char * result, const uint8_t value);
|
||||
|
||||
@@ -1191,16 +1191,16 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
||||
obj["product id"] = emsdevice->product_id();
|
||||
obj["version"] = emsdevice->version();
|
||||
obj["entities"] = emsdevice->count_entities();
|
||||
char result[200];
|
||||
(void)emsdevice->show_telegram_handlers(result, EMSdevice::Handlers::RECEIVED);
|
||||
char result[250];
|
||||
(void)emsdevice->show_telegram_handlers(result, sizeof(result), EMSdevice::Handlers::RECEIVED);
|
||||
if (result[0] != '\0') {
|
||||
obj["handlers received"] = result; // don't show handlers if there aren't any
|
||||
}
|
||||
(void)emsdevice->show_telegram_handlers(result, EMSdevice::Handlers::FETCHED);
|
||||
(void)emsdevice->show_telegram_handlers(result, sizeof(result), EMSdevice::Handlers::FETCHED);
|
||||
if (result[0] != '\0') {
|
||||
obj["handlers fetched"] = result;
|
||||
}
|
||||
(void)emsdevice->show_telegram_handlers(result, EMSdevice::Handlers::PENDING);
|
||||
(void)emsdevice->show_telegram_handlers(result, sizeof(result), EMSdevice::Handlers::PENDING);
|
||||
if (result[0] != '\0') {
|
||||
obj["handlers pending"] = result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user