mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-08 16:59:50 +03:00
auto formatting
This commit is contained in:
@@ -32,7 +32,7 @@ void AnalogSensor::start() {
|
||||
analogSetAttenuation(ADC_2_5db); // for all channels 1.5V
|
||||
|
||||
|
||||
LOG_INFO(("Starting Analog sensor service"));
|
||||
LOG_INFO("Starting Analog sensor service");
|
||||
|
||||
// Add API call for /info
|
||||
Command::add(
|
||||
|
||||
@@ -376,7 +376,7 @@ bool Command::list(const uint8_t device_type, JsonObject & output) {
|
||||
// output list of all commands to console for a specific DeviceType
|
||||
void Command::show(uuid::console::Shell & shell, uint8_t device_type, bool verbose) {
|
||||
if (cmdfunctions_.empty()) {
|
||||
shell.println(("No commands available"));
|
||||
shell.println("No commands available");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,12 +59,12 @@ void EMSESPShell::stopped() {
|
||||
// this is one of the first functions called when the shell is started
|
||||
void EMSESPShell::display_banner() {
|
||||
println();
|
||||
printfln(("┌──────────────────────────────────────┐"));
|
||||
printfln("┌──────────────────────────────────────┐");
|
||||
printfln(("│ %sEMS-ESP version %-10s%s │"), COLOR_BOLD_ON, EMSESP_APP_VERSION, COLOR_BOLD_OFF);
|
||||
printfln(("│ %s%shttps://github.com/emsesp/EMS-ESP32%s │"), COLOR_BRIGHT_GREEN, COLOR_UNDERLINE, COLOR_RESET);
|
||||
printfln(("│ │"));
|
||||
printfln("│ │");
|
||||
printfln(("│ type %shelp%s to show available commands │"), COLOR_UNDERLINE, COLOR_RESET);
|
||||
printfln(("└──────────────────────────────────────┘"));
|
||||
printfln("└──────────────────────────────────────┘");
|
||||
println();
|
||||
|
||||
// set console name
|
||||
@@ -151,16 +151,16 @@ void EMSESPShell::add_console_commands() {
|
||||
},
|
||||
"local");
|
||||
} else {
|
||||
shell.println(("Must be 0B, 0D, 0A, 0F or 12"));
|
||||
shell.println("Must be 0B, 0D, 0A, 0F or 12");
|
||||
}
|
||||
},
|
||||
[](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments __attribute__((unused))) -> const std::vector<std::string> {
|
||||
return std::vector<std::string>{
|
||||
(("0B")),
|
||||
(("0D")),
|
||||
(("0A")),
|
||||
(("0F")),
|
||||
(("12")),
|
||||
("0B"),
|
||||
("0D"),
|
||||
("0A"),
|
||||
("0F"),
|
||||
("12"),
|
||||
|
||||
};
|
||||
});
|
||||
@@ -189,7 +189,7 @@ void EMSESPShell::add_console_commands() {
|
||||
if (arguments.size() == 0) {
|
||||
EMSESP::scan_devices();
|
||||
} else {
|
||||
shell.printfln(("Performing a deep scan..."));
|
||||
shell.printfln("Performing a deep scan...");
|
||||
EMSESP::clear_all_devices();
|
||||
std::vector<uint8_t> Device_Ids;
|
||||
|
||||
@@ -240,7 +240,7 @@ void EMSESPShell::add_console_commands() {
|
||||
uint8_t device_id = Helpers::hextoint(arguments.front().c_str());
|
||||
|
||||
if (!EMSESP::valid_device(device_id)) {
|
||||
shell.printfln(("Invalid deviceID"));
|
||||
shell.printfln("Invalid deviceID");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -305,28 +305,28 @@ void EMSESPShell::add_console_commands() {
|
||||
|
||||
EMSESP::watch_id(watch_id);
|
||||
} else {
|
||||
shell.printfln(("Invalid: use watch raw|on|off|unknown|id [id]"));
|
||||
shell.printfln("Invalid: use watch raw|on|off|unknown|id [id]");
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t watch = EMSESP::watch();
|
||||
if (watch == EMSESP::WATCH_OFF) {
|
||||
shell.printfln(("Watching telegrams is off"));
|
||||
shell.printfln("Watching telegrams is off");
|
||||
return;
|
||||
}
|
||||
|
||||
// if logging is off, the watch won't show anything, show force it back to NOTICE
|
||||
if (shell.log_level() < Level::NOTICE) {
|
||||
shell.log_level(Level::NOTICE);
|
||||
shell.printfln(("Setting log level to Notice"));
|
||||
shell.printfln("Setting log level to Notice");
|
||||
}
|
||||
|
||||
if (watch == EMSESP::WATCH_ON) {
|
||||
shell.printfln(("Watching incoming telegrams, displayed in decoded format"));
|
||||
shell.printfln("Watching incoming telegrams, displayed in decoded format");
|
||||
} else if (watch == EMSESP::WATCH_RAW) {
|
||||
shell.printfln(("Watching incoming telegrams, displayed as raw bytes")); // WATCH_RAW
|
||||
shell.printfln("Watching incoming telegrams, displayed as raw bytes"); // WATCH_RAW
|
||||
} else {
|
||||
shell.printfln(("Watching unknown telegrams")); // WATCH_UNKNOWN
|
||||
shell.printfln("Watching unknown telegrams"); // WATCH_UNKNOWN
|
||||
}
|
||||
|
||||
watch_id = EMSESP::watch_id();
|
||||
@@ -351,7 +351,7 @@ void EMSESPShell::add_console_commands() {
|
||||
// validate the device_type
|
||||
uint8_t device_type = EMSdevice::device_name_2_device_type(arguments[0].c_str());
|
||||
if (!Command::device_has_commands(device_type)) {
|
||||
shell.print(("Invalid device. Available devices are: "));
|
||||
shell.print("Invalid device. Available devices are: ");
|
||||
Command::show_devices(shell);
|
||||
return;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void EMSESPShell::add_console_commands() {
|
||||
|
||||
// validate that a command is present
|
||||
if (arguments.size() < 2) {
|
||||
shell.print(("Missing command. Available commands are: "));
|
||||
shell.print("Missing command. Available commands are: ");
|
||||
Command::show(shell, device_type, false); // non-verbose mode
|
||||
return;
|
||||
}
|
||||
@@ -399,8 +399,8 @@ void EMSESPShell::add_console_commands() {
|
||||
}
|
||||
|
||||
if (return_code == CommandRet::NOT_FOUND) {
|
||||
shell.println(("Unknown command"));
|
||||
shell.print(("Available commands are: "));
|
||||
shell.println("Unknown command");
|
||||
shell.print("Available commands are: ");
|
||||
Command::show(shell, device_type, false); // non-verbose mode
|
||||
} else if (return_code != CommandRet::OK) {
|
||||
shell.printfln(("Bad syntax (error code %d)"), return_code);
|
||||
@@ -494,7 +494,7 @@ void Console::load_standard_commands(unsigned int context) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
shell.print(("levels: "));
|
||||
shell.print("levels: ");
|
||||
std::vector<std::string> v = uuid::log::levels_lowercase();
|
||||
size_t i = v.size();
|
||||
while (i--) {
|
||||
@@ -543,7 +543,7 @@ void Console::load_standard_commands(unsigned int context) {
|
||||
} else {
|
||||
shell.delay_until(now + INVALID_PASSWORD_DELAY_MS, [](Shell & shell) {
|
||||
shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, ("Invalid su password on console"));
|
||||
shell.println(("su: incorrect password"));
|
||||
shell.println("su: incorrect password");
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -579,7 +579,7 @@ void Console::load_system_commands(unsigned int context) {
|
||||
if (securitySettings.jwtSecret.equals(password.c_str())) {
|
||||
EMSESP::system_.format(shell);
|
||||
} else {
|
||||
shell.println(("incorrect password"));
|
||||
shell.println("incorrect password");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -602,9 +602,9 @@ void Console::load_system_commands(unsigned int context) {
|
||||
return StateUpdateResult::CHANGED;
|
||||
},
|
||||
"local");
|
||||
shell.println(("su password updated"));
|
||||
shell.println("su password updated");
|
||||
} else {
|
||||
shell.println(("Passwords do not match"));
|
||||
shell.println("Passwords do not match");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -675,7 +675,7 @@ void Console::load_system_commands(unsigned int context) {
|
||||
});
|
||||
shell.println("Use `wifi reconnect` to save and apply the new settings");
|
||||
} else {
|
||||
shell.println(("Passwords do not match"));
|
||||
shell.println("Passwords do not match");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -737,7 +737,7 @@ EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, bool local)
|
||||
: uuid::console::Shell(commands, ShellContext::MAIN, local ? (CommandFlags::USER | CommandFlags::LOCAL) : CommandFlags::USER)
|
||||
, uuid::console::StreamConsole(stream)
|
||||
, EMSESPShell()
|
||||
, name_((("Serial")))
|
||||
, name_(("Serial"))
|
||||
, pty_(SIZE_MAX)
|
||||
, addr_()
|
||||
, port_(0) {
|
||||
|
||||
@@ -42,7 +42,7 @@ void DallasSensor::start() {
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
bus_.begin(dallas_gpio_);
|
||||
LOG_INFO(("Starting Dallas sensor service"));
|
||||
LOG_INFO("Starting Dallas sensor service");
|
||||
#endif
|
||||
|
||||
// Add API calls
|
||||
@@ -84,7 +84,7 @@ void DallasSensor::loop() {
|
||||
if (state_ == State::IDLE) {
|
||||
if (time_now - last_activity_ >= READ_INTERVAL_MS) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_DEBUG(("[DEBUG] Read sensor temperature"));
|
||||
LOG_DEBUG("[DEBUG] Read sensor temperature");
|
||||
#endif
|
||||
if (bus_.reset() || parasite_) {
|
||||
YIELD;
|
||||
@@ -99,7 +99,7 @@ void DallasSensor::loop() {
|
||||
if (++scanretry_ > SCAN_MAX) { // every 30 sec
|
||||
scanretry_ = 0;
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_ERROR(("Bus reset failed"));
|
||||
LOG_ERROR("Bus reset failed");
|
||||
#endif
|
||||
for (auto & sensor : sensors_) {
|
||||
sensor.temperature_c = EMS_VALUE_SHORT_NOTSET;
|
||||
@@ -112,13 +112,13 @@ void DallasSensor::loop() {
|
||||
} else if (state_ == State::READING) {
|
||||
if (temperature_convert_complete() && (time_now - last_activity_ > CONVERSION_MS)) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_DEBUG(("Scanning for sensors"));
|
||||
LOG_DEBUG("Scanning for sensors");
|
||||
#endif
|
||||
bus_.reset_search();
|
||||
state_ = State::SCANNING;
|
||||
} else if (time_now - last_activity_ > READ_TIMEOUT_MS) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_WARNING(("Dallas sensor read timeout"));
|
||||
LOG_WARNING("Dallas sensor read timeout");
|
||||
#endif
|
||||
state_ = State::IDLE;
|
||||
sensorfails_++;
|
||||
@@ -126,7 +126,7 @@ void DallasSensor::loop() {
|
||||
} else if (state_ == State::SCANNING) {
|
||||
if (time_now - last_activity_ > SCAN_TIMEOUT_MS) {
|
||||
#ifdef EMSESP_DEBUG_SENSOR
|
||||
LOG_ERROR(("Dallas sensor scan timeout"));
|
||||
LOG_ERROR("Dallas sensor scan timeout");
|
||||
#endif
|
||||
state_ = State::IDLE;
|
||||
sensorfails_++;
|
||||
|
||||
@@ -2083,9 +2083,9 @@ bool Boiler::set_ww_circulation_mode(const char * value, const int8_t id) {
|
||||
if (v < 7) {
|
||||
// LOG_INFO(("Setting dhw circulation mode %dx3min"), v);
|
||||
} else if (v == 7) {
|
||||
// LOG_INFO(("Setting dhw circulation mode continuous"));
|
||||
// LOG_INFO("Setting dhw circulation mode continuous");
|
||||
} else {
|
||||
// LOG_WARNING(("Set dhw circulation mode: Invalid value"));
|
||||
// LOG_WARNING("Set dhw circulation mode: Invalid value");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2109,12 +2109,12 @@ bool Boiler::set_reset(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
if (num == 1) {
|
||||
// LOG_INFO(("Reset boiler maintenance message"));
|
||||
// LOG_INFO("Reset boiler maintenance message");
|
||||
write_command(0x05, 0x08, 0xFF, 0x1C);
|
||||
has_update(&reset_);
|
||||
return true;
|
||||
} else if (num == 2) {
|
||||
// LOG_INFO(("Reset boiler error message"));
|
||||
// LOG_INFO("Reset boiler error message");
|
||||
write_command(0x05, 0x00, 0x5A); // error reset
|
||||
has_update(&reset_);
|
||||
return true;
|
||||
@@ -2131,7 +2131,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) {
|
||||
std::string s;
|
||||
if (Helpers::value2string(value, s)) {
|
||||
if (s == Helpers::translated_word(FL_(reset))) {
|
||||
// LOG_INFO(("Reset boiler maintenance message"));
|
||||
// LOG_INFO("Reset boiler maintenance message");
|
||||
write_command(0x05, 0x08, 0xFF, 0x1C);
|
||||
return true;
|
||||
}
|
||||
@@ -2169,7 +2169,7 @@ bool Boiler::set_maintenance(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_WARNING(("Setting maintenance: wrong format"));
|
||||
LOG_WARNING("Setting maintenance: wrong format");
|
||||
return false;
|
||||
}
|
||||
//maintenance
|
||||
@@ -2183,7 +2183,7 @@ bool Boiler::set_maintenancetime(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
LOG_WARNING(("Setting maintenance: wrong format"));
|
||||
LOG_WARNING("Setting maintenance: wrong format");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2204,7 +2204,7 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_WARNING(("Setting maintenance: wrong format"));
|
||||
LOG_WARNING("Setting maintenance: wrong format");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1369,7 +1369,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
double difference = difftime(now, ttime);
|
||||
if (difference > 15 || difference < -15) {
|
||||
set_datetime("ntp", -1); // set from NTP
|
||||
LOG_INFO(("thermostat time correction from ntp"));
|
||||
LOG_INFO("thermostat time correction from ntp");
|
||||
}
|
||||
}
|
||||
#ifndef EMSESP_STANDALONE
|
||||
@@ -1380,7 +1380,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
}
|
||||
struct timeval newnow = {.tv_sec = ttime};
|
||||
settimeofday(&newnow, nullptr);
|
||||
LOG_INFO(("ems-esp time set from thermostat"));
|
||||
LOG_INFO("ems-esp time set from thermostat");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2132,7 +2132,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
if (!EMSESP::system_.ntp_connected()) {
|
||||
LOG_WARNING(("Set date: no valid NTP data, setting from ESP Clock"));
|
||||
LOG_WARNING("Set date: no valid NTP data, setting from ESP Clock");
|
||||
}
|
||||
|
||||
data[0] = tm_->tm_year - 100; // Bosch counts from 2000
|
||||
@@ -2153,7 +2153,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) {
|
||||
data[6] = (dt[20] - '0'); // day of week, Mo:0
|
||||
data[7] = (dt[22] - '0') + 2; // DST and flag
|
||||
} else {
|
||||
LOG_WARNING(("Set date: invalid data, wrong length"));
|
||||
LOG_WARNING("Set date: invalid data, wrong length");
|
||||
return false;
|
||||
}
|
||||
if (data[1] == 0 || data[1] > 12 || data[2] > 23 || data[3] == 0 || data[3] > 31 || data[4] > 59 || data[5] > 59 || data[6] > 6 || data[7] > 3) {
|
||||
|
||||
@@ -62,19 +62,19 @@ std::string EMSdevice::uom_to_string(uint8_t uom) {
|
||||
std::string EMSdevice::brand_to_string() const {
|
||||
switch (brand_) {
|
||||
case EMSdevice::Brand::BOSCH:
|
||||
return (("Bosch"));
|
||||
return ("Bosch");
|
||||
case EMSdevice::Brand::JUNKERS:
|
||||
return (("Junkers"));
|
||||
return ("Junkers");
|
||||
case EMSdevice::Brand::BUDERUS:
|
||||
return (("Buderus"));
|
||||
return ("Buderus");
|
||||
case EMSdevice::Brand::NEFIT:
|
||||
return (("Nefit"));
|
||||
return ("Nefit");
|
||||
case EMSdevice::Brand::SIEGER:
|
||||
return (("Sieger"));
|
||||
return ("Sieger");
|
||||
case EMSdevice::Brand::WORCESTER:
|
||||
return (("Worcester"));
|
||||
return ("Worcester");
|
||||
case EMSdevice::Brand::IVT:
|
||||
return (("IVT"));
|
||||
return ("IVT");
|
||||
default:
|
||||
return ((""));
|
||||
}
|
||||
@@ -302,28 +302,28 @@ void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) const {
|
||||
}
|
||||
shell.printf(COLOR_RESET);
|
||||
*/
|
||||
shell.printf((" Received telegram type IDs: "));
|
||||
shell.printf(" Received telegram type IDs: ");
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
if (tf.received_ && !tf.fetch_) {
|
||||
shell.printf(("0x%02X "), tf.telegram_type_id_);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
shell.printf((" Fetched telegram type IDs: "));
|
||||
shell.printf(" Fetched telegram type IDs: ");
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
if (tf.fetch_) {
|
||||
shell.printf(("0x%02X "), tf.telegram_type_id_);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
shell.printf((" Pending telegram type IDs: "));
|
||||
shell.printf(" Pending telegram type IDs: ");
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
if (!tf.received_ && !tf.fetch_) {
|
||||
shell.printf(("0x%02X "), tf.telegram_type_id_);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
shell.printf((" Ignored telegram type IDs: "));
|
||||
shell.printf(" Ignored telegram type IDs: ");
|
||||
for (auto handlers : handlers_ignored_) {
|
||||
shell.printf(("0x%02X "), handlers);
|
||||
}
|
||||
@@ -1467,9 +1467,9 @@ bool EMSdevice::has_telegram_id(uint16_t id) const {
|
||||
std::string EMSdevice::telegram_type_name(std::shared_ptr<const Telegram> telegram) const {
|
||||
// see if it's one of the common ones, like Version
|
||||
if (telegram->type_id == EMS_TYPE_VERSION) {
|
||||
return (("Version"));
|
||||
return ("Version");
|
||||
} else if (telegram->type_id == EMS_TYPE_UBADevices) {
|
||||
return (("UBADevices"));
|
||||
return ("UBADevices");
|
||||
}
|
||||
|
||||
for (const auto & tf : telegram_functions_) {
|
||||
|
||||
@@ -190,7 +190,7 @@ void EMSESP::uart_init() {
|
||||
if (System::is_valid_gpio(rx_gpio) && System::is_valid_gpio(tx_gpio)) {
|
||||
EMSuart::start(tx_mode, rx_gpio, tx_gpio); // start UART
|
||||
} else {
|
||||
LOG_WARNING(("Invalid UART Rx/Tx GPIOs. Check config."));
|
||||
LOG_WARNING("Invalid UART Rx/Tx GPIOs. Check config.");
|
||||
}
|
||||
|
||||
txservice_.start(); // sends out request to EMS bus for all devices
|
||||
@@ -234,20 +234,20 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// EMS bus information
|
||||
switch (bus_status()) {
|
||||
case BUS_STATUS_OFFLINE:
|
||||
shell.printfln(("EMS Bus is disconnected."));
|
||||
shell.printfln("EMS Bus is disconnected.");
|
||||
break;
|
||||
case BUS_STATUS_TX_ERRORS:
|
||||
shell.printfln(("EMS Bus is connected, but Tx is not stable."));
|
||||
shell.printfln("EMS Bus is connected, but Tx is not stable.");
|
||||
break;
|
||||
default:
|
||||
shell.printfln(("EMS Bus is connected."));
|
||||
shell.printfln("EMS Bus is connected.");
|
||||
break;
|
||||
}
|
||||
|
||||
shell.println();
|
||||
|
||||
if (bus_status() != BUS_STATUS_OFFLINE) {
|
||||
shell.printfln(("EMS Bus info:"));
|
||||
shell.printfln("EMS Bus info:");
|
||||
EMSESP::webSettingsService.read([&](WebSettings & settings) { shell.printfln((" Tx mode: %d"), settings.tx_mode); });
|
||||
shell.printfln((" Bus protocol: %s"), EMSbus::is_ht3() ? ("HT3") : ("Buderus"));
|
||||
shell.printfln((" #recognized EMS devices: %d"), EMSESP::emsdevices.size());
|
||||
@@ -265,7 +265,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// Rx queue
|
||||
auto rx_telegrams = rxservice_.queue();
|
||||
if (rx_telegrams.empty()) {
|
||||
shell.printfln(("Rx Queue is empty"));
|
||||
shell.printfln("Rx Queue is empty");
|
||||
} else {
|
||||
shell.printfln(("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s");
|
||||
for (const auto & it : rx_telegrams) {
|
||||
@@ -278,7 +278,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// Tx queue
|
||||
auto tx_telegrams = txservice_.queue();
|
||||
if (tx_telegrams.empty()) {
|
||||
shell.printfln(("Tx Queue is empty"));
|
||||
shell.printfln("Tx Queue is empty");
|
||||
} else {
|
||||
shell.printfln(("Tx Queue (%ld telegram%s):"), tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s");
|
||||
|
||||
@@ -301,7 +301,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
// show EMS device values to the shell console
|
||||
void EMSESP::show_device_values(uuid::console::Shell & shell) {
|
||||
if (emsdevices.empty()) {
|
||||
shell.printfln(("No EMS devices detected."));
|
||||
shell.printfln("No EMS devices detected.");
|
||||
shell.println();
|
||||
return;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) {
|
||||
// show Dallas temperature sensors and Analog sensors
|
||||
void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
if (dallassensor_.have_sensors()) {
|
||||
shell.printfln(("Temperature sensors:"));
|
||||
shell.printfln("Temperature sensors:");
|
||||
char s[10];
|
||||
char s2[10];
|
||||
uint8_t fahrenheit = EMSESP::system_.fahrenheit() ? 2 : 0;
|
||||
@@ -384,7 +384,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
if (analogsensor_.have_sensors()) {
|
||||
char s[10];
|
||||
char s2[10];
|
||||
shell.printfln(("Analog sensors:"));
|
||||
shell.printfln("Analog sensors:");
|
||||
for (const auto & sensor : analogsensor_.sensors()) {
|
||||
switch (sensor.type()) {
|
||||
case AnalogSensor::AnalogType::ADC:
|
||||
@@ -537,7 +537,7 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
||||
}
|
||||
if (need_publish) {
|
||||
if (doc.overflowed()) {
|
||||
LOG_WARNING(("MQTT buffer overflow, please use individual topics"));
|
||||
LOG_WARNING("MQTT buffer overflow, please use individual topics");
|
||||
}
|
||||
Mqtt::publish(Mqtt::tag_to_topic(device_type, DeviceValueTAG::TAG_NONE), json);
|
||||
}
|
||||
@@ -808,7 +808,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
||||
// only process broadcast telegrams or ones sent to us on request
|
||||
// if ((telegram->dest != 0x00) && (telegram->dest != rxservice_.ems_bus_id())) {
|
||||
if (telegram->operation == Telegram::Operation::RX_READ) {
|
||||
// LOG_DEBUG(("read telegram received, not processing"));
|
||||
// LOG_DEBUG("read telegram received, not processing");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -884,12 +884,12 @@ bool EMSESP::device_exists(const uint8_t device_id) {
|
||||
// for each associated EMS device go and get its system information
|
||||
void EMSESP::show_devices(uuid::console::Shell & shell) {
|
||||
if (emsdevices.empty()) {
|
||||
shell.printfln(("No EMS devices detected. Try using 'scan devices' from the ems menu."));
|
||||
shell.printfln("No EMS devices detected. Try using 'scan devices' from the ems menu.");
|
||||
shell.println();
|
||||
return;
|
||||
}
|
||||
|
||||
shell.printfln(("These EMS devices are currently active:"));
|
||||
shell.printfln("These EMS devices are currently active:");
|
||||
shell.println();
|
||||
|
||||
// count the number of thermostats
|
||||
@@ -1018,7 +1018,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
name = "generic boiler";
|
||||
device_type = DeviceType::BOILER;
|
||||
flags = DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP;
|
||||
LOG_WARNING(("Unknown EMS boiler. Using generic profile. Please report on GitHub."));
|
||||
LOG_WARNING("Unknown EMS boiler. Using generic profile. Please report on GitHub.");
|
||||
} else {
|
||||
LOG_WARNING(("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub."), device_id);
|
||||
return false;
|
||||
@@ -1190,14 +1190,14 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
// if we're waiting on a Write operation, we want a single byte 1 or 4
|
||||
if ((tx_state == Telegram::Operation::TX_WRITE) && (length == 1)) {
|
||||
if (first_value == TxService::TX_WRITE_SUCCESS) {
|
||||
LOG_DEBUG(("Last Tx write successful"));
|
||||
LOG_DEBUG("Last Tx write successful");
|
||||
txservice_.increment_telegram_write_count(); // last tx/write was confirmed ok
|
||||
txservice_.send_poll(); // close the bus
|
||||
publish_id_ = txservice_.post_send_query(); // follow up with any post-read if set
|
||||
txservice_.reset_retry_count();
|
||||
tx_successful = true;
|
||||
} else if (first_value == TxService::TX_WRITE_FAIL) {
|
||||
LOG_ERROR(("Last Tx write rejected by host"));
|
||||
LOG_ERROR("Last Tx write rejected by host");
|
||||
txservice_.send_poll(); // close the bus
|
||||
txservice_.reset_retry_count();
|
||||
}
|
||||
@@ -1206,7 +1206,7 @@ void EMSESP::incoming_telegram(uint8_t * data, const uint8_t length) {
|
||||
uint8_t src = data[0];
|
||||
uint8_t dest = data[1];
|
||||
if (txservice_.is_last_tx(src, dest)) {
|
||||
LOG_DEBUG(("Last Tx read successful"));
|
||||
LOG_DEBUG("Last Tx read successful");
|
||||
txservice_.increment_telegram_read_count();
|
||||
txservice_.send_poll(); // close the bus
|
||||
txservice_.reset_retry_count();
|
||||
@@ -1289,14 +1289,14 @@ void EMSESP::start() {
|
||||
webLogService.begin(); // start web log service. now we can start capturing logs to the web log
|
||||
|
||||
#ifdef EMSESP_DEBUG
|
||||
LOG_NOTICE(("System is running in Debug mode"));
|
||||
LOG_NOTICE("System is running in Debug mode");
|
||||
#endif
|
||||
|
||||
LOG_INFO(("Last system reset reason Core0: %s, Core1: %s"), system_.reset_reason(0).c_str(), system_.reset_reason(1).c_str());
|
||||
|
||||
// do any system upgrades
|
||||
if (system_.check_upgrade()) {
|
||||
LOG_INFO(("System needs a restart to apply new settings. Please wait."));
|
||||
LOG_INFO("System needs a restart to apply new settings. Please wait.");
|
||||
system_.system_restart();
|
||||
};
|
||||
|
||||
|
||||
24
src/mqtt.cpp
24
src/mqtt.cpp
@@ -192,7 +192,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
shell.println();
|
||||
|
||||
// show subscriptions
|
||||
shell.printfln(("MQTT topic subscriptions:"));
|
||||
shell.printfln("MQTT topic subscriptions:");
|
||||
for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
|
||||
shell.printfln((" %s/%s"), mqtt_base_.c_str(), mqtt_subfunction.topic_.c_str());
|
||||
}
|
||||
@@ -200,7 +200,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
|
||||
// show queues
|
||||
if (mqtt_messages_.empty()) {
|
||||
shell.printfln(("MQTT queue is empty"));
|
||||
shell.printfln("MQTT queue is empty");
|
||||
shell.println();
|
||||
return;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ void Mqtt::show_topic_handlers(uuid::console::Shell & shell, const uint8_t devic
|
||||
return;
|
||||
}
|
||||
|
||||
// shell.print((" Subscribed MQTT topics: "));
|
||||
// shell.print(" Subscribed MQTT topics: ");
|
||||
// for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
|
||||
// if (mqtt_subfunction.device_type_ == device_type) {
|
||||
// shell.printf(("%s "), mqtt_subfunction.topic_.c_str());
|
||||
@@ -368,7 +368,7 @@ void Mqtt::on_publish(uint16_t packetId) const {
|
||||
// if the last published failed, don't bother checking it. wait for the next retry
|
||||
if (mqtt_message.packet_id_ == 0) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
LOG_DEBUG(("[DEBUG] ACK for failed message pid 0"));
|
||||
LOG_DEBUG("[DEBUG] ACK for failed message pid 0");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -450,15 +450,15 @@ void Mqtt::start() {
|
||||
}
|
||||
connecting_ = false;
|
||||
if (reason == AsyncMqttClientDisconnectReason::TCP_DISCONNECTED) {
|
||||
LOG_WARNING(("MQTT disconnected: TCP"));
|
||||
LOG_WARNING("MQTT disconnected: TCP");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_IDENTIFIER_REJECTED) {
|
||||
LOG_WARNING(("MQTT disconnected: Identifier Rejected"));
|
||||
LOG_WARNING("MQTT disconnected: Identifier Rejected");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_SERVER_UNAVAILABLE) {
|
||||
LOG_WARNING(("MQTT disconnected: Server unavailable"));
|
||||
LOG_WARNING("MQTT disconnected: Server unavailable");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_MALFORMED_CREDENTIALS) {
|
||||
LOG_WARNING(("MQTT disconnected: Malformed credentials"));
|
||||
LOG_WARNING("MQTT disconnected: Malformed credentials");
|
||||
} else if (reason == AsyncMqttClientDisconnectReason::MQTT_NOT_AUTHORIZED) {
|
||||
LOG_WARNING(("MQTT disconnected: Not authorized"));
|
||||
LOG_WARNING("MQTT disconnected: Not authorized");
|
||||
} else {
|
||||
LOG_WARNING(("MQTT disconnected: code %d"), reason);
|
||||
}
|
||||
@@ -535,7 +535,7 @@ void Mqtt::on_connect() {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO(("MQTT connected"));
|
||||
LOG_INFO("MQTT connected");
|
||||
|
||||
connecting_ = true;
|
||||
connectcount_++;
|
||||
@@ -686,7 +686,7 @@ std::shared_ptr<const MqttMessage> Mqtt::queue_message(const uint8_t operation,
|
||||
// if the queue is full, make room but removing the last one
|
||||
if (mqtt_messages_.size() >= MAX_MQTT_MESSAGES) {
|
||||
mqtt_messages_.pop_front();
|
||||
LOG_WARNING(("Queue overflow, removing one message"));
|
||||
LOG_WARNING("Queue overflow, removing one message");
|
||||
mqtt_publish_fails_++;
|
||||
}
|
||||
mqtt_messages_.emplace_back(mqtt_message_id_++, std::move(message));
|
||||
@@ -815,7 +815,7 @@ void Mqtt::process_queue() {
|
||||
// it will have a real packet ID
|
||||
if (mqtt_message.packet_id_ > 0) {
|
||||
#if defined(EMSESP_DEBUG)
|
||||
LOG_DEBUG(("[DEBUG] Waiting for QOS-ACK"));
|
||||
LOG_DEBUG("[DEBUG] Waiting for QOS-ACK");
|
||||
#endif
|
||||
// if we don't get the ack within 10 minutes, republish with new packet_id
|
||||
if (uuid::get_uptime_sec() - last_publish_queue_ < 600) {
|
||||
|
||||
@@ -57,7 +57,7 @@ void Shower::loop() {
|
||||
// first check to see if hot water has been on long enough to be recognized as a Shower/Bath
|
||||
if (!shower_state_ && (time_now - timer_start_) > SHOWER_MIN_DURATION) {
|
||||
set_shower_state(true);
|
||||
LOG_DEBUG(("[Shower] hot water still running, starting shower timer"));
|
||||
LOG_DEBUG("[Shower] hot water still running, starting shower timer");
|
||||
}
|
||||
// check if the shower has been on too long
|
||||
else if ((time_now - timer_start_) > shower_alert_trigger_) {
|
||||
@@ -109,7 +109,7 @@ void Shower::loop() {
|
||||
// turn back on the hot water for the shower
|
||||
void Shower::shower_alert_stop() {
|
||||
if (doing_cold_shot_) {
|
||||
LOG_DEBUG(("Shower Alert stopped"));
|
||||
LOG_DEBUG("Shower Alert stopped");
|
||||
(void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "true");
|
||||
doing_cold_shot_ = false;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void Shower::shower_alert_stop() {
|
||||
// turn off hot water to send a shot of cold
|
||||
void Shower::shower_alert_start() {
|
||||
if (shower_alert_) {
|
||||
LOG_DEBUG(("Shower Alert started"));
|
||||
LOG_DEBUG("Shower Alert started");
|
||||
(void)Command::call(EMSdevice::DeviceType::BOILER, "wwtapactivated", "false");
|
||||
doing_cold_shot_ = true;
|
||||
alert_timer_start_ = uuid::get_uptime(); // timer starts now
|
||||
|
||||
@@ -77,7 +77,7 @@ bool System::command_fetch(const char * value, const int8_t id) {
|
||||
std::string value_s;
|
||||
if (Helpers::value2string(value, value_s)) {
|
||||
if (value_s == "all") {
|
||||
LOG_INFO(("Requesting data from EMS devices"));
|
||||
LOG_INFO("Requesting data from EMS devices");
|
||||
EMSESP::fetch_device_values();
|
||||
return true;
|
||||
} else if (value_s == (F_(boiler))) {
|
||||
@@ -105,7 +105,7 @@ bool System::command_publish(const char * value, const int8_t id) {
|
||||
if (Helpers::value2string(value, value_s)) {
|
||||
if (value_s == "ha") {
|
||||
EMSESP::publish_all(true); // includes HA
|
||||
LOG_INFO(("Publishing all data to MQTT, including HA configs"));
|
||||
LOG_INFO("Publishing all data to MQTT, including HA configs");
|
||||
return true;
|
||||
} else if (value_s == (F_(boiler))) {
|
||||
EMSESP::publish_device_values(EMSdevice::DeviceType::BOILER);
|
||||
@@ -129,7 +129,7 @@ bool System::command_publish(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
EMSESP::publish_all();
|
||||
LOG_INFO(("Publishing all data to MQTT"));
|
||||
LOG_INFO("Publishing all data to MQTT");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ bool System::command_watch(const char * value, const int8_t id) {
|
||||
|
||||
// restart EMS-ESP
|
||||
void System::system_restart() {
|
||||
LOG_INFO(("Restarting EMS-ESP..."));
|
||||
LOG_INFO("Restarting EMS-ESP...");
|
||||
Shell::loop_all();
|
||||
delay(1000); // wait a second
|
||||
#ifndef EMSESP_STANDALONE
|
||||
@@ -202,7 +202,7 @@ void System::system_restart() {
|
||||
|
||||
// saves all settings
|
||||
void System::wifi_reconnect() {
|
||||
LOG_INFO(("WiFi reconnecting..."));
|
||||
LOG_INFO("WiFi reconnecting...");
|
||||
Shell::loop_all();
|
||||
EMSESP::console_.loop();
|
||||
delay(1000); // wait a second
|
||||
@@ -241,7 +241,7 @@ void System::syslog_init() {
|
||||
// start & configure syslog
|
||||
if (!was_enabled) {
|
||||
syslog_.start();
|
||||
EMSESP::logger().info(("Starting Syslog"));
|
||||
EMSESP::logger().info("Starting Syslog");
|
||||
}
|
||||
syslog_.log_level((uuid::log::Level)syslog_level_);
|
||||
syslog_.mark_interval(syslog_mark_interval_);
|
||||
@@ -255,7 +255,7 @@ void System::syslog_init() {
|
||||
} else if (was_enabled) {
|
||||
// in case service is still running, this flushes the queue
|
||||
// https://github.com/emsesp/EMS-ESP/issues/496
|
||||
EMSESP::logger().info(("Stopping Syslog"));
|
||||
EMSESP::logger().info("Stopping Syslog");
|
||||
syslog_.log_level((uuid::log::Level)-1);
|
||||
syslog_.mark_interval(0);
|
||||
syslog_.destination("");
|
||||
@@ -399,7 +399,7 @@ void System::start() {
|
||||
|
||||
// button single click
|
||||
void System::button_OnClick(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - single click"));
|
||||
LOG_DEBUG("Button pressed - single click");
|
||||
|
||||
#ifdef EMSESP_DEBUG
|
||||
#ifndef EMSESP_STANDALONE
|
||||
@@ -410,20 +410,20 @@ void System::button_OnClick(PButton & b) {
|
||||
|
||||
// button double click
|
||||
void System::button_OnDblClick(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - double click - reconnect"));
|
||||
LOG_DEBUG("Button pressed - double click - reconnect");
|
||||
EMSESP::system_.wifi_reconnect();
|
||||
}
|
||||
|
||||
// button long press
|
||||
void System::button_OnLongPress(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - long press"));
|
||||
LOG_DEBUG("Button pressed - long press");
|
||||
}
|
||||
|
||||
// button indefinite press
|
||||
void System::button_OnVLongPress(PButton & b) {
|
||||
LOG_DEBUG(("Button pressed - very long press"));
|
||||
LOG_DEBUG("Button pressed - very long press");
|
||||
#ifndef EMSESP_STANDALONE
|
||||
LOG_WARNING(("Performing factory reset..."));
|
||||
LOG_WARNING("Performing factory reset...");
|
||||
EMSESP::console_.loop();
|
||||
EMSESP::esp8266React.factoryReset();
|
||||
#endif
|
||||
@@ -437,12 +437,12 @@ void System::button_init(bool refresh) {
|
||||
|
||||
if (is_valid_gpio(pbutton_gpio_)) {
|
||||
if (!myPButton_.init(pbutton_gpio_, HIGH)) {
|
||||
LOG_DEBUG(("Multi-functional button not detected"));
|
||||
LOG_DEBUG("Multi-functional button not detected");
|
||||
} else {
|
||||
LOG_DEBUG(("Multi-functional button enabled"));
|
||||
LOG_DEBUG("Multi-functional button enabled");
|
||||
}
|
||||
} else {
|
||||
LOG_WARNING(("Invalid button GPIO. Check config."));
|
||||
LOG_WARNING("Invalid button GPIO. Check config.");
|
||||
}
|
||||
|
||||
myPButton_.onClick(BUTTON_Debounce, button_OnClick);
|
||||
@@ -772,7 +772,7 @@ int8_t System::wifi_quality(int8_t dBm) {
|
||||
|
||||
// print users to console
|
||||
void System::show_users(uuid::console::Shell & shell) {
|
||||
shell.printfln(("Users:"));
|
||||
shell.printfln("Users:");
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
EMSESP::esp8266React.getSecuritySettingsService()->read([&](SecuritySettings & securitySettings) {
|
||||
@@ -801,19 +801,19 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
shell.println("Network:");
|
||||
switch (WiFi.status()) {
|
||||
case WL_IDLE_STATUS:
|
||||
shell.printfln((" Network: Idle"));
|
||||
shell.printfln(" Network: Idle");
|
||||
break;
|
||||
|
||||
case WL_NO_SSID_AVAIL:
|
||||
shell.printfln((" Network: Network not found"));
|
||||
shell.printfln(" Network: Network not found");
|
||||
break;
|
||||
|
||||
case WL_SCAN_COMPLETED:
|
||||
shell.printfln((" Network: Network scan complete"));
|
||||
shell.printfln(" Network: Network scan complete");
|
||||
break;
|
||||
|
||||
case WL_CONNECTED:
|
||||
shell.printfln((" Network: connected"));
|
||||
shell.printfln(" Network: connected");
|
||||
shell.printfln((" SSID: %s"), WiFi.SSID().c_str());
|
||||
shell.printfln((" BSSID: %s"), WiFi.BSSIDstr().c_str());
|
||||
shell.printfln((" RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality(WiFi.RSSI()));
|
||||
@@ -828,27 +828,27 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
break;
|
||||
|
||||
case WL_CONNECT_FAILED:
|
||||
shell.printfln((" WiFi Network: Connection failed"));
|
||||
shell.printfln(" WiFi Network: Connection failed");
|
||||
break;
|
||||
|
||||
case WL_CONNECTION_LOST:
|
||||
shell.printfln((" WiFi Network: Connection lost"));
|
||||
shell.printfln(" WiFi Network: Connection lost");
|
||||
break;
|
||||
|
||||
case WL_DISCONNECTED:
|
||||
shell.printfln((" WiFi Network: Disconnected"));
|
||||
shell.printfln(" WiFi Network: Disconnected");
|
||||
break;
|
||||
|
||||
case WL_NO_SHIELD:
|
||||
default:
|
||||
shell.printfln((" WiFi Network: Unknown"));
|
||||
shell.printfln(" WiFi Network: Unknown");
|
||||
break;
|
||||
}
|
||||
|
||||
// show Ethernet if connected
|
||||
if (ethernet_connected_) {
|
||||
shell.println();
|
||||
shell.printfln((" Ethernet Network: connected"));
|
||||
shell.printfln(" Ethernet Network: connected");
|
||||
shell.printfln((" MAC address: %s"), ETH.macAddress().c_str());
|
||||
shell.printfln((" Hostname: %s"), ETH.getHostname());
|
||||
shell.printfln((" IPv4 address: %s/%s"), uuid::printable_to_string(ETH.localIP()).c_str(), uuid::printable_to_string(ETH.subnetMask()).c_str());
|
||||
@@ -862,17 +862,17 @@ void System::show_system(uuid::console::Shell & shell) {
|
||||
|
||||
shell.println("Syslog:");
|
||||
if (!syslog_enabled_) {
|
||||
shell.printfln((" Syslog: disabled"));
|
||||
shell.printfln(" Syslog: disabled");
|
||||
} else {
|
||||
shell.printfln((" Syslog: %s"), syslog_.started() ? "started" : "stopped");
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(host_fmt), !syslog_host_.isEmpty() ? syslog_host_.c_str() : (F_(unset)));
|
||||
shell.printfln((" IP: %s"), uuid::printable_to_string(syslog_.ip()).c_str());
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(port_fmt), syslog_port_);
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(log_level_fmt), uuid::log::format_level_lowercase(static_cast<uuid::log::Level>(syslog_level_)));
|
||||
shell.print((" "));
|
||||
shell.print(" ");
|
||||
shell.printfln(F_(mark_interval_fmt), syslog_mark_interval_);
|
||||
shell.printfln((" Queued: %d"), syslog_.queued());
|
||||
}
|
||||
@@ -908,10 +908,10 @@ bool System::check_upgrade() {
|
||||
// it's a customization file, just replace it and there's no need to reboot
|
||||
saveSettings(EMSESP_CUSTOMIZATION_FILE, "Customizations", input);
|
||||
} else {
|
||||
LOG_ERROR(("Unrecognized file uploaded"));
|
||||
LOG_ERROR("Unrecognized file uploaded");
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR(("Unrecognized file uploaded, not json"));
|
||||
LOG_ERROR("Unrecognized file uploaded, not json");
|
||||
}
|
||||
|
||||
// close (just in case) and remove the temp file
|
||||
@@ -1111,16 +1111,16 @@ bool System::command_info(const char * value, const int8_t id, JsonObject & outp
|
||||
node = output.createNestedObject("Bus Status");
|
||||
switch (EMSESP::bus_status()) {
|
||||
case EMSESP::BUS_STATUS_OFFLINE:
|
||||
node["bus status"] = (("disconnected"));
|
||||
node["bus status"] = ("disconnected");
|
||||
break;
|
||||
case EMSESP::BUS_STATUS_TX_ERRORS:
|
||||
node["bus status"] = (("connected, tx issues - try a different Tx Mode"));
|
||||
node["bus status"] = ("connected, tx issues - try a different Tx Mode");
|
||||
break;
|
||||
case EMSESP::BUS_STATUS_CONNECTED:
|
||||
node["bus status"] = (("connected"));
|
||||
node["bus status"] = ("connected");
|
||||
break;
|
||||
default:
|
||||
node["bus status"] = (("unknown"));
|
||||
node["bus status"] = ("unknown");
|
||||
break;
|
||||
}
|
||||
if (EMSESP::bus_status() != EMSESP::BUS_STATUS_OFFLINE) {
|
||||
|
||||
@@ -120,7 +120,7 @@ std::string Telegram::to_string() const {
|
||||
// returns telegram's message body only, in hex
|
||||
std::string Telegram::to_string_message() const {
|
||||
if (this->message_length == 0) {
|
||||
return (("<empty>"));
|
||||
return ("<empty>");
|
||||
}
|
||||
|
||||
return Helpers::data_to_hex(this->message_data, this->message_length);
|
||||
@@ -381,7 +381,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
|
||||
uint16_t status = EMSuart::transmit(telegram_raw, length);
|
||||
|
||||
if (status == EMS_TX_STATUS_ERR) {
|
||||
LOG_ERROR(("Failed to transmit Tx via UART."));
|
||||
LOG_ERROR("Failed to transmit Tx via UART.");
|
||||
if (telegram->operation == Telegram::Operation::TX_READ) {
|
||||
increment_telegram_read_fail_count(); // another Tx fail
|
||||
} else {
|
||||
@@ -412,7 +412,7 @@ void TxService::send_telegram(const uint8_t * data, const uint8_t length) {
|
||||
uint16_t status = EMSuart::transmit(telegram_raw, length);
|
||||
|
||||
if (status == EMS_TX_STATUS_ERR) {
|
||||
LOG_ERROR(("Failed to transmit Tx via UART."));
|
||||
LOG_ERROR("Failed to transmit Tx via UART.");
|
||||
increment_telegram_fail_count(); // another Tx fail
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "general") == 0) {
|
||||
EMSESP::logger().info(("Testing general. Adding a Boiler and Thermostat"));
|
||||
EMSESP::logger().info("Testing general. Adding a Boiler and Thermostat");
|
||||
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
add_device(0x18, 157); // Bosch CR100
|
||||
@@ -54,7 +54,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "2thermostats") == 0) {
|
||||
EMSESP::logger().info(("Testing with multiple thermostats..."));
|
||||
EMSESP::logger().info("Testing with multiple thermostats...");
|
||||
|
||||
add_device(0x08, 123); // GB072
|
||||
add_device(0x10, 158); // RC310
|
||||
@@ -86,7 +86,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "310") == 0) {
|
||||
EMSESP::logger().info(("Adding a GB072/RC310 combo..."));
|
||||
EMSESP::logger().info("Adding a GB072/RC310 combo...");
|
||||
|
||||
add_device(0x08, 123); // GB072
|
||||
add_device(0x10, 158); // RC310
|
||||
@@ -113,7 +113,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "gateway") == 0) {
|
||||
EMSESP::logger().info(("Adding a Gateway..."));
|
||||
EMSESP::logger().info("Adding a Gateway...");
|
||||
|
||||
// add 0x48 KM200, via a version command
|
||||
rx_telegram({0x48, 0x0B, 0x02, 0x00, 0xBD, 0x04, 0x06, 00, 00, 00, 00, 00, 00, 00});
|
||||
@@ -133,7 +133,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "mixer") == 0) {
|
||||
EMSESP::logger().info(("Adding a mixer..."));
|
||||
EMSESP::logger().info("Adding a mixer...");
|
||||
|
||||
// add controller
|
||||
add_device(0x09, 114);
|
||||
@@ -155,7 +155,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "boiler") == 0) {
|
||||
EMSESP::logger().info(("Adding boiler..."));
|
||||
EMSESP::logger().info("Adding boiler...");
|
||||
add_device(0x08, 123); // Nefit Trendline
|
||||
|
||||
// UBAuptime
|
||||
@@ -172,7 +172,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "thermostat") == 0) {
|
||||
EMSESP::logger().info(("Adding thermostat..."));
|
||||
EMSESP::logger().info("Adding thermostat...");
|
||||
|
||||
add_device(0x10, 192); // FW120
|
||||
|
||||
@@ -185,7 +185,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "solar") == 0) {
|
||||
EMSESP::logger().info(("Adding solar..."));
|
||||
EMSESP::logger().info("Adding solar...");
|
||||
|
||||
add_device(0x30, 163); // SM100
|
||||
|
||||
@@ -204,7 +204,7 @@ bool Test::run_test(const char * command, int8_t id) {
|
||||
}
|
||||
|
||||
if (strcmp(command, "heatpump") == 0) {
|
||||
EMSESP::logger().info(("Adding heatpump..."));
|
||||
EMSESP::logger().info("Adding heatpump...");
|
||||
|
||||
add_device(0x38, 200); // Enviline module
|
||||
add_device(0x10, 192); // FW120 thermostat
|
||||
@@ -238,7 +238,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "general") {
|
||||
shell.printfln(("Testing adding a general boiler & thermostat..."));
|
||||
shell.printfln("Testing adding a general boiler & thermostat...");
|
||||
run_test("general");
|
||||
shell.invoke_command("show devices");
|
||||
shell.invoke_command("show");
|
||||
@@ -247,7 +247,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "render") {
|
||||
shell.printfln(("Testing render..."));
|
||||
shell.printfln("Testing render...");
|
||||
|
||||
// check read_value to make sure it handles all the data type correctly
|
||||
uint8_t message_data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; // message_length is 9
|
||||
@@ -315,7 +315,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "devices") {
|
||||
shell.printfln(("Testing devices..."));
|
||||
shell.printfln("Testing devices...");
|
||||
|
||||
// A fake response - UBADevices(0x07)
|
||||
rx_telegram({0x08, 0x00, 0x07, 0x00, 0x0B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
|
||||
@@ -323,7 +323,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// check for boiler and controller on same product_id
|
||||
if (command == "double") {
|
||||
shell.printfln(("Testing double..."));
|
||||
shell.printfln("Testing double...");
|
||||
|
||||
add_device(0x08, 206); // Nefit Excellent HR30
|
||||
add_device(0x09, 206); // Nefit Excellent HR30 Controller
|
||||
@@ -333,7 +333,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "620") {
|
||||
EMSESP::logger().info(("Testing 620..."));
|
||||
EMSESP::logger().info("Testing 620...");
|
||||
|
||||
// Version Controller
|
||||
uart_telegram({0x09, 0x0B, 0x02, 0x00, 0x5F, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
|
||||
@@ -344,7 +344,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// unknown device
|
||||
if (command == "unknown") {
|
||||
shell.printfln(("Testing unknown..."));
|
||||
shell.printfln("Testing unknown...");
|
||||
|
||||
// add boiler
|
||||
add_device(0x08, 84);
|
||||
@@ -361,19 +361,19 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "unknown2") {
|
||||
shell.printfln(("Testing unknown2..."));
|
||||
shell.printfln("Testing unknown2...");
|
||||
|
||||
// simulate getting version information back from an unknown device
|
||||
rx_telegram({0x09, 0x0B, 0x02, 0x00, 0x5A, 0x01, 0x02}); // productID is 90 which doesn't exist
|
||||
}
|
||||
|
||||
if (command == "gateway") {
|
||||
shell.printfln(("Testing Gateway..."));
|
||||
shell.printfln("Testing Gateway...");
|
||||
run_test("gateway");
|
||||
}
|
||||
|
||||
if (command == "310") {
|
||||
shell.printfln(("Testing RC310..."));
|
||||
shell.printfln("Testing RC310...");
|
||||
run_test("310");
|
||||
shell.invoke_command("show devices");
|
||||
shell.invoke_command("show");
|
||||
@@ -382,14 +382,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "2thermostats") {
|
||||
shell.printfln(("Testing multiple thermostats..."));
|
||||
shell.printfln("Testing multiple thermostats...");
|
||||
run_test("2thermostats");
|
||||
shell.invoke_command("show");
|
||||
shell.invoke_command("show devices");
|
||||
}
|
||||
|
||||
if (command == "web") {
|
||||
shell.printfln(("Testing Web..."));
|
||||
shell.printfln("Testing Web...");
|
||||
|
||||
Mqtt::enabled(false); // turn off mqtt
|
||||
Mqtt::ha_enabled(false); // turn off ha
|
||||
@@ -438,7 +438,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "board_profile") {
|
||||
shell.printfln(("Testing board profile..."));
|
||||
shell.printfln("Testing board profile...");
|
||||
|
||||
shell.invoke_command("system");
|
||||
shell.invoke_command("set board_profile wemos");
|
||||
@@ -447,7 +447,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "boiler") {
|
||||
shell.printfln(("Testing boiler..."));
|
||||
shell.printfln("Testing boiler...");
|
||||
// Mqtt::ha_enabled(false);
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -475,7 +475,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "shower_alert") {
|
||||
shell.printfln(("Testing Shower Alert..."));
|
||||
shell.printfln("Testing Shower Alert...");
|
||||
|
||||
run_test("boiler");
|
||||
|
||||
@@ -484,7 +484,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "fr120") {
|
||||
shell.printfln(("Testing adding a thermostat FR120..."));
|
||||
shell.printfln("Testing adding a thermostat FR120...");
|
||||
|
||||
add_device(0x10, 191); // FR120 thermostat
|
||||
|
||||
@@ -496,7 +496,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "ha") {
|
||||
shell.printfln(("Testing HA mqtt discovery"));
|
||||
shell.printfln("Testing HA mqtt discovery");
|
||||
Mqtt::ha_enabled(true);
|
||||
// Mqtt::ha_enabled(false);
|
||||
|
||||
@@ -518,7 +518,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "lastcode") {
|
||||
shell.printfln(("Testing lastcode"));
|
||||
shell.printfln("Testing lastcode");
|
||||
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -536,7 +536,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "dv") {
|
||||
shell.printfln(("Testing device value rendering"));
|
||||
shell.printfln("Testing device value rendering");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -550,12 +550,12 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "dallas") {
|
||||
shell.printfln(("Testing adding Dallas sensor"));
|
||||
shell.printfln("Testing adding Dallas sensor");
|
||||
emsesp::EMSESP::dallassensor_.test();
|
||||
}
|
||||
|
||||
if (command == "dallas_full") {
|
||||
shell.printfln(("Testing adding and changing Dallas sensor"));
|
||||
shell.printfln("Testing adding and changing Dallas sensor");
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::nested_format(1);
|
||||
// Mqtt::nested_format(0);
|
||||
@@ -571,7 +571,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "analog") {
|
||||
shell.printfln(("Testing adding Analog sensor"));
|
||||
shell.printfln("Testing adding Analog sensor");
|
||||
Mqtt::ha_enabled(true);
|
||||
// Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
@@ -602,7 +602,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "masked") {
|
||||
shell.printfln(("Testing masked entities"));
|
||||
shell.printfln("Testing masked entities");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::send_response(false);
|
||||
@@ -626,7 +626,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "dv2") {
|
||||
shell.printfln(("Testing device value lost"));
|
||||
shell.printfln("Testing device value lost");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
Mqtt::send_response(false);
|
||||
@@ -647,7 +647,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
if (command == "api_values") {
|
||||
#if defined(EMSESP_STANDALONE)
|
||||
shell.printfln(("Testing API getting values"));
|
||||
shell.printfln("Testing API getting values");
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
Mqtt::send_response(false);
|
||||
@@ -680,7 +680,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "mqtt_post") {
|
||||
shell.printfln(("Testing MQTT incoming changes"));
|
||||
shell.printfln("Testing MQTT incoming changes");
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
Mqtt::send_response(false);
|
||||
@@ -696,7 +696,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
#if defined(EMSESP_STANDALONE)
|
||||
// https://github.com/emsesp/EMS-ESP32/issues/541
|
||||
if (command == "api_wwmode") {
|
||||
shell.printfln(("Testing API wwmode"));
|
||||
shell.printfln("Testing API wwmode");
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::nested_format(1);
|
||||
run_test("310");
|
||||
@@ -715,7 +715,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
#endif
|
||||
|
||||
if (command == "api") {
|
||||
shell.printfln(("Testing API with MQTT and REST, standalone"));
|
||||
shell.printfln("Testing API with MQTT and REST, standalone");
|
||||
|
||||
Mqtt::ha_enabled(true);
|
||||
// Mqtt::ha_enabled(false);
|
||||
@@ -990,7 +990,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "mqtt_nested") {
|
||||
shell.printfln(("Testing nested MQTT"));
|
||||
shell.printfln("Testing nested MQTT");
|
||||
Mqtt::ha_enabled(false); // turn off HA Discovery to stop the chatter
|
||||
|
||||
run_test("boiler");
|
||||
@@ -1010,7 +1010,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "thermostat") {
|
||||
shell.printfln(("Testing adding a thermostat FW120..."));
|
||||
shell.printfln("Testing adding a thermostat FW120...");
|
||||
|
||||
run_test("thermostat");
|
||||
shell.invoke_command("show");
|
||||
@@ -1026,7 +1026,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "tc100") {
|
||||
shell.printfln(("Testing adding a TC100 thermostat to the EMS bus..."));
|
||||
shell.printfln("Testing adding a TC100 thermostat to the EMS bus...");
|
||||
|
||||
// add a thermostat
|
||||
add_device(0x18, 202); // Bosch TC100 - https://github.com/emsesp/EMS-ESP/issues/474
|
||||
@@ -1037,7 +1037,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "solar") {
|
||||
shell.printfln(("Testing Solar"));
|
||||
shell.printfln("Testing Solar");
|
||||
run_test("solar");
|
||||
|
||||
uart_telegram("30 00 FF 0A 02 6A 04"); // SM100 pump on (1)sh
|
||||
@@ -1050,14 +1050,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "heatpump") {
|
||||
shell.printfln(("Testing Heat Pump"));
|
||||
shell.printfln("Testing Heat Pump");
|
||||
run_test("heatpump");
|
||||
shell.invoke_command("call");
|
||||
shell.invoke_command("call heatpump info");
|
||||
}
|
||||
|
||||
if (command == "solar200") {
|
||||
shell.printfln(("Testing Solar SM200"));
|
||||
shell.printfln("Testing Solar SM200");
|
||||
|
||||
add_device(0x30, 164); // SM200
|
||||
|
||||
@@ -1082,7 +1082,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "km") {
|
||||
shell.printfln(("Testing KM200 Gateway"));
|
||||
shell.printfln("Testing KM200 Gateway");
|
||||
|
||||
add_device(0x10, 158); // RC300
|
||||
add_device(0x48, 189); // KM200
|
||||
@@ -1140,7 +1140,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "cr100") {
|
||||
shell.printfln(("Testing CR100"));
|
||||
shell.printfln("Testing CR100");
|
||||
|
||||
add_device(0x18, 157); // Bosch CR100 - https://github.com/emsesp/EMS-ESP/issues/355
|
||||
|
||||
@@ -1165,14 +1165,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "rx2") {
|
||||
shell.printfln(("Testing Rx2..."));
|
||||
shell.printfln("Testing Rx2...");
|
||||
for (uint8_t i = 0; i < 30; i++) {
|
||||
uart_telegram({0x08, 0x0B, 0x33, 0x00, 0x08, 0xFF, 0x34, 0xFB, 0x00, 0x28, 0x00, 0x00, 0x46, 0x00, 0xFF, 0xFF, 0x00});
|
||||
}
|
||||
}
|
||||
|
||||
if (command == "rx") {
|
||||
shell.printfln(("Testing Rx..."));
|
||||
shell.printfln("Testing Rx...");
|
||||
|
||||
// fake telegrams. length includes CRC
|
||||
// Boiler -> Me, UBAMonitorFast(0x18), telegram: 08 00 18 00 00 02 5A 73 3D 0A 10 65 40 02 1A 80 00 01 E1 01 76 0E 3D 48 00 C9 44 02 00 (#data=25)
|
||||
@@ -1229,7 +1229,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "tx") {
|
||||
shell.printfln(("Testing Tx..."));
|
||||
shell.printfln("Testing Tx...");
|
||||
|
||||
// TX queue example - Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4)
|
||||
uint8_t t11[] = {0x44, 0x45, 0x46, 0x47};
|
||||
@@ -1266,7 +1266,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "poll") {
|
||||
shell.printfln(("Testing Poll..."));
|
||||
shell.printfln("Testing Poll...");
|
||||
|
||||
// simulate sending a read request
|
||||
// uint8_t t16[] = {0x44, 0x45, 0x46, 0x47}; // Me -> Thermostat, (0x91), telegram: 0B 17 91 05 44 45 46 47 (#data=4)
|
||||
@@ -1291,7 +1291,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "cmd") {
|
||||
shell.printfln(("Testing Commands..."));
|
||||
shell.printfln("Testing Commands...");
|
||||
|
||||
// add a thermostat with 3 HCs
|
||||
add_device(0x10, 192); // FW120
|
||||
@@ -1318,13 +1318,13 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "pin") {
|
||||
shell.printfln(("Testing pin..."));
|
||||
shell.printfln("Testing pin...");
|
||||
shell.invoke_command("call system pin");
|
||||
shell.invoke_command("call system pin 1 true");
|
||||
}
|
||||
|
||||
if (command == "mqtt2") {
|
||||
shell.printfln(("Testing MQTT large payloads..."));
|
||||
shell.printfln("Testing MQTT large payloads...");
|
||||
|
||||
DynamicJsonDocument doc(EMSESP_JSON_SIZE_XXLARGE_DYN);
|
||||
|
||||
@@ -1347,7 +1347,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "mqtt") {
|
||||
shell.printfln(("Testing MQTT..."));
|
||||
shell.printfln("Testing MQTT...");
|
||||
|
||||
Mqtt::ha_enabled(false);
|
||||
Mqtt::enabled(true);
|
||||
@@ -1422,7 +1422,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "poll2") {
|
||||
shell.printfln(("Testing Tx Sending last message on queue..."));
|
||||
shell.printfln("Testing Tx Sending last message on queue...");
|
||||
|
||||
EMSESP::show_ems(shell);
|
||||
|
||||
@@ -1433,7 +1433,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "rx2") {
|
||||
shell.printfln(("Testing rx2..."));
|
||||
shell.printfln("Testing rx2...");
|
||||
|
||||
uart_telegram({0x1B, 0x5B, 0xFD, 0x2D, 0x9E, 0x3A, 0xB6, 0xE5, 0x02, 0x20, 0x33, 0x30, 0x32, 0x3A, 0x20, 0x5B,
|
||||
0x73, 0xFF, 0xFF, 0xCB, 0xDF, 0xB7, 0xA7, 0xB5, 0x67, 0x77, 0x77, 0xE4, 0xFF, 0xFD, 0x77, 0xFF});
|
||||
@@ -1441,14 +1441,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// https://github.com/emsesp/EMS-ESP/issues/380#issuecomment-633663007
|
||||
if (command == "rx3") {
|
||||
shell.printfln(("Testing rx3..."));
|
||||
shell.printfln("Testing rx3...");
|
||||
|
||||
uart_telegram({0x21, 0x0B, 0xFF, 0x00});
|
||||
}
|
||||
|
||||
// testing the UART tx command, without a queue
|
||||
if (command == "tx2") {
|
||||
shell.printfln(("Testing tx2..."));
|
||||
shell.printfln("Testing tx2...");
|
||||
|
||||
uint8_t t[] = {0x0B, 0x88, 0x18, 0x00, 0x20, 0xD4}; // including CRC
|
||||
EMSuart::transmit(t, sizeof(t));
|
||||
@@ -1456,14 +1456,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
|
||||
// send read request with offset
|
||||
if (command == "offset") {
|
||||
shell.printfln(("Testing offset..."));
|
||||
shell.printfln("Testing offset...");
|
||||
|
||||
// send_read_request(0x18, 0x08);
|
||||
EMSESP::txservice_.read_request(0x18, 0x08, 27); // no offset
|
||||
}
|
||||
|
||||
if (command == "mixer") {
|
||||
shell.printfln(("Testing Mixer..."));
|
||||
shell.printfln("Testing Mixer...");
|
||||
|
||||
run_test("mixer");
|
||||
|
||||
@@ -1477,7 +1477,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
||||
}
|
||||
|
||||
if (command == "crash") {
|
||||
shell.printfln(("Forcing a crash..."));
|
||||
shell.printfln("Forcing a crash...");
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdiv-by-zero"
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.5.0b3"
|
||||
#define EMSESP_APP_VERSION "3.5.0b3_o"
|
||||
|
||||
@@ -117,7 +117,7 @@ void WebAPIService::parse(AsyncWebServerRequest * request, JsonObject & input) {
|
||||
emsesp::EMSESP::logger().err(error);
|
||||
api_fails_++;
|
||||
} else {
|
||||
// emsesp::EMSESP::logger().debug(("API command called successfully"));
|
||||
// emsesp::EMSESP::logger().debug("API command called successfully");
|
||||
// if there was no json output from the call, default to the output message 'OK'.
|
||||
if (!output.size()) {
|
||||
output["message"] = "OK";
|
||||
|
||||
@@ -238,7 +238,7 @@ void WebDataService::write_value(AsyncWebServerRequest * request, JsonVariant &
|
||||
if (return_code != CommandRet::OK) {
|
||||
EMSESP::logger().err(("Write command failed %s (%s)"), (const char *)output["message"], Command::return_code_string(return_code).c_str());
|
||||
} else {
|
||||
EMSESP::logger().debug(("Write command successful"));
|
||||
EMSESP::logger().debug("Write command successful");
|
||||
}
|
||||
|
||||
response->setCode((return_code == CommandRet::OK) ? 200 : 204);
|
||||
|
||||
@@ -48,7 +48,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_START:
|
||||
// EMSESP::logger().info(("Ethernet initialized"));
|
||||
// EMSESP::logger().info("Ethernet initialized");
|
||||
ETH.setHostname(EMSESP::system_.hostname().c_str());
|
||||
|
||||
// configure for static IP
|
||||
@@ -74,12 +74,12 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||
EMSESP::logger().warning(("Ethernet disconnected"));
|
||||
EMSESP::logger().warning("Ethernet disconnected");
|
||||
EMSESP::system_.ethernet_connected(false);
|
||||
break;
|
||||
|
||||
case ARDUINO_EVENT_ETH_STOP:
|
||||
EMSESP::logger().info(("Ethernet stopped"));
|
||||
EMSESP::logger().info("Ethernet stopped");
|
||||
EMSESP::system_.ethernet_connected(false);
|
||||
break;
|
||||
|
||||
@@ -202,7 +202,7 @@ void WebStatusService::mDNS_start() const {
|
||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||
if (networkSettings.enableMDNS) {
|
||||
if (!MDNS.begin(EMSESP::system_.hostname().c_str())) {
|
||||
EMSESP::logger().warning(("Failed to start mDNS responder service"));
|
||||
EMSESP::logger().warning("Failed to start mDNS responder service");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,13 +214,13 @@ void WebStatusService::mDNS_start() const {
|
||||
MDNS.addServiceTxt("http", "tcp", "version", EMSESP_APP_VERSION);
|
||||
MDNS.addServiceTxt("http", "tcp", "address", address_s.c_str());
|
||||
|
||||
EMSESP::logger().info(("mDNS responder service started"));
|
||||
EMSESP::logger().info("mDNS responder service started");
|
||||
}
|
||||
});
|
||||
#else
|
||||
EMSESP::esp8266React.getNetworkSettingsService()->read([&](NetworkSettings & networkSettings) {
|
||||
if (networkSettings.enableMDNS) {
|
||||
EMSESP::logger().info(("mDNS responder service started"));
|
||||
EMSESP::logger().info("mDNS responder service started");
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user