mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
remove unused brackets and inits
This commit is contained in:
@@ -25,9 +25,6 @@
|
||||
|
||||
#ifndef EMSESP_STANDALONE
|
||||
#include "driver/adc.h"
|
||||
#ifndef ARDUINO_LOLIN_S2_MINI
|
||||
#include <esp_bt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <uuid/log.h>
|
||||
|
||||
@@ -117,9 +117,9 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
// default to 'info' for SYSTEM, DALLASENSOR and ANALOGSENSOR, the other devices to 'values' for shortname version
|
||||
if (num_paths < (id_n > 0 ? 4 : 3)) {
|
||||
if (device_type < EMSdevice::DeviceType::BOILER) {
|
||||
command_p = "info";
|
||||
command_p = F_(info);
|
||||
} else {
|
||||
command_p = "values";
|
||||
command_p = F_(values);
|
||||
}
|
||||
} else {
|
||||
return message(CommandRet::NOT_FOUND, "missing or bad command", output);
|
||||
@@ -170,15 +170,15 @@ uint8_t Command::process(const char * path, const bool is_admin, const JsonObjec
|
||||
std::string Command::return_code_string(const uint8_t return_code) {
|
||||
switch (return_code) {
|
||||
case CommandRet::ERROR:
|
||||
return ("Error");
|
||||
return "Error";
|
||||
case CommandRet::OK:
|
||||
return ("OK");
|
||||
return "OK";
|
||||
case CommandRet::NOT_FOUND:
|
||||
return ("Not Found");
|
||||
return "Not Found";
|
||||
case CommandRet::NOT_ALLOWED:
|
||||
return ("Not Authorized");
|
||||
return "Not Authorized";
|
||||
case CommandRet::FAIL:
|
||||
return ("Failed");
|
||||
return "Failed";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -264,15 +264,15 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
||||
|
||||
if ((value == nullptr) || (strlen(value) == 0)) {
|
||||
if (EMSESP::system_.readonly_mode()) {
|
||||
LOG_INFO(("[readonly] Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_);
|
||||
LOG_INFO("[readonly] Calling command '%s/%s' (%s)", dname.c_str(), cmd, Helpers::translated_word(cf->description_).c_str());
|
||||
} else {
|
||||
LOG_DEBUG(("Calling command '%s/%s' (%s)"), dname.c_str(), cmd, cf->description_);
|
||||
LOG_DEBUG("Calling command '%s/%s' (%s)", dname.c_str(), cmd, Helpers::translated_word(cf->description_).c_str());
|
||||
}
|
||||
} else {
|
||||
if (EMSESP::system_.readonly_mode()) {
|
||||
LOG_INFO(("[readonly] Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_, value);
|
||||
LOG_INFO("[readonly] Calling command '%s/%s' (%s) with value %s", dname.c_str(), cmd, Helpers::translated_word(cf->description_).c_str(), value);
|
||||
} else {
|
||||
LOG_DEBUG(("Calling command '%s/%s' (%s) with value %s"), dname.c_str(), cmd, cf->description_, value);
|
||||
LOG_DEBUG("Calling command '%s/%s' (%s) with value %s", dname.c_str(), cmd, Helpers::translated_word(cf->description_).c_str(), value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
|
||||
}
|
||||
|
||||
// we didn't find the command and its not an endpoint, report error
|
||||
LOG_DEBUG("Command failed: invalid command '%s'", cmd);
|
||||
LOG_DEBUG("Command failed: invalid command '%s'", cmd ? cmd : "");
|
||||
return message(CommandRet::NOT_FOUND, "invalid command", output);
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ void Command::show_devices(uuid::console::Shell & shell) {
|
||||
// output list of all commands to console
|
||||
// calls show with verbose mode set
|
||||
void Command::show_all(uuid::console::Shell & shell) {
|
||||
shell.println(("Available commands (*=do not need authorization): "));
|
||||
shell.println("Available commands (*=do not need authorization): ");
|
||||
|
||||
// show system first
|
||||
shell.print(COLOR_BOLD_ON);
|
||||
|
||||
@@ -155,14 +155,7 @@ void EMSESPShell::add_console_commands() {
|
||||
}
|
||||
},
|
||||
[](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"),
|
||||
|
||||
};
|
||||
return std::vector<std::string>{"0B", "0D", "0A", "0F", "12"};
|
||||
});
|
||||
|
||||
commands->add_command(ShellContext::MAIN,
|
||||
@@ -403,7 +396,7 @@ void EMSESPShell::add_console_commands() {
|
||||
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);
|
||||
shell.printfln("Bad syntax (error code %d)", return_code);
|
||||
}
|
||||
},
|
||||
[&](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) -> std::vector<std::string> {
|
||||
@@ -424,7 +417,7 @@ void EMSESPShell::add_console_commands() {
|
||||
if (Command::device_has_commands(device_type)) {
|
||||
for (const auto & cf : Command::commands()) {
|
||||
if (cf.device_type_ == device_type) {
|
||||
command_list.emplace_back((cf.cmd_));
|
||||
command_list.emplace_back(cf.cmd_);
|
||||
}
|
||||
}
|
||||
return command_list;
|
||||
@@ -448,7 +441,7 @@ void Console::load_standard_commands(unsigned int context) {
|
||||
// create commands test and t
|
||||
EMSESPShell::commands->add_command(context,
|
||||
CommandFlags::USER,
|
||||
string_vector{("test")},
|
||||
string_vector{"test"},
|
||||
string_vector{F_(name_optional), F_(data_optional)},
|
||||
[](Shell & shell, const std::vector<std::string> & arguments) {
|
||||
if (arguments.empty()) {
|
||||
@@ -542,7 +535,7 @@ void Console::load_standard_commands(unsigned int context) {
|
||||
become_admin(shell);
|
||||
} else {
|
||||
shell.delay_until(now + INVALID_PASSWORD_DELAY_MS, [](Shell & shell) {
|
||||
shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, ("Invalid su password on console"));
|
||||
shell.logger().log(LogLevel::NOTICE, LogFacility::AUTH, "Invalid su password on console");
|
||||
shell.println("su: incorrect password");
|
||||
});
|
||||
}
|
||||
@@ -691,7 +684,7 @@ void Console::load_system_commands(unsigned int context) {
|
||||
std::vector<int8_t> data; // led, dallas, rx, tx, button, phy_type, eth_power, eth_phy_addr, eth_clock_mode
|
||||
std::string board_profile = Helpers::toUpper(arguments.front());
|
||||
if (!EMSESP::system_.load_board_profile(data, board_profile)) {
|
||||
shell.println(("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, CUSTOM)"));
|
||||
shell.println("Invalid board profile (S32, E32, MH-ET, NODEMCU, OLIMEX, OLIMEXPOE, C3MINI, S2MINI, CUSTOM)");
|
||||
return;
|
||||
}
|
||||
EMSESP::webSettingsService.update(
|
||||
@@ -730,7 +723,7 @@ std::string EMSESPShell::prompt_suffix() {
|
||||
}
|
||||
|
||||
void EMSESPShell::end_of_transmission() {
|
||||
invoke_command((F_(exit)));
|
||||
invoke_command(F_(exit));
|
||||
}
|
||||
|
||||
EMSESPStreamConsole::EMSESPStreamConsole(Stream & stream, bool local)
|
||||
|
||||
@@ -204,7 +204,7 @@ void DallasSensor::loop() {
|
||||
scancnt_ = 0;
|
||||
} else if (scancnt_ == SCAN_START + 1) { // startup
|
||||
firstscan_ = sensors_.size();
|
||||
// LOG_DEBUG(("Adding %d dallas sensor(s) from first scan"), firstscan_);
|
||||
// LOG_DEBUG("Adding %d dallas sensor(s) from first scan", firstscan_);
|
||||
} else if ((scancnt_ <= 0) && (firstscan_ != sensors_.size())) { // check 2 times for no change of sensor #
|
||||
scancnt_ = SCAN_START;
|
||||
sensors_.clear(); // restart scaning and clear to get correct numbering
|
||||
@@ -399,8 +399,8 @@ bool DallasSensor::get_value_info(JsonObject & output, const char * cmd, const i
|
||||
}
|
||||
|
||||
output["type"] = F_(number);
|
||||
output["min"] = serialized(Helpers::render_value(val, -55, 0, EMSESP::system_.fahrenheit() ? 2 : 0));
|
||||
output["max"] = serialized(Helpers::render_value(val, 125, 0, EMSESP::system_.fahrenheit() ? 2 : 0));
|
||||
output["min"] = serialized(Helpers::render_value(val, (int8_t)-55, 0, EMSESP::system_.fahrenheit() ? (uint8_t)2 : (uint8_t)0));
|
||||
output["max"] = serialized(Helpers::render_value(val, (int8_t)125, 0, EMSESP::system_.fahrenheit() ? (uint8_t)2 : (uint8_t)0));
|
||||
output["uom"] = EMSdevice::uom_to_string(DeviceValueUOM::DEGREES);
|
||||
output["writeable"] = false;
|
||||
|
||||
|
||||
@@ -1693,7 +1693,7 @@ bool Boiler::set_tempDiffBoiler(const char * value, const int8_t id) {
|
||||
|
||||
// Set the dhw temperature 0x33/0x35 or 0xEA
|
||||
bool Boiler::set_ww_temp(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1713,7 +1713,7 @@ bool Boiler::set_ww_temp(const char * value, const int8_t id) {
|
||||
|
||||
// Set the lower dhw temperature 0xEA
|
||||
bool Boiler::set_ww_temp_low(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1735,7 +1735,7 @@ bool Boiler::set_ww_temp_single(const char * value, const int8_t id) {
|
||||
|
||||
// Set the dhw disinfection temperature
|
||||
bool Boiler::set_ww_disinfect_temp(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1751,7 +1751,7 @@ bool Boiler::set_ww_disinfect_temp(const char * value, const int8_t id) {
|
||||
|
||||
// flow temp
|
||||
bool Boiler::set_flow_temp(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1766,7 +1766,7 @@ bool Boiler::set_flow_temp(const char * value, const int8_t id) {
|
||||
|
||||
// set selected burner power
|
||||
bool Boiler::set_burn_power(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1778,7 +1778,7 @@ bool Boiler::set_burn_power(const char * value, const int8_t id) {
|
||||
|
||||
// Set the dhw flow temperature offset 0x33
|
||||
bool Boiler::set_ww_flowTempOffset(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1794,7 +1794,7 @@ bool Boiler::set_ww_flowTempOffset(const char * value, const int8_t id) {
|
||||
|
||||
// set heating activated
|
||||
bool Boiler::set_heating_activated(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1810,7 +1810,7 @@ bool Boiler::set_heating_activated(const char * value, const int8_t id) {
|
||||
|
||||
// set heating maximum temperature
|
||||
bool Boiler::set_heating_temp(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1826,7 +1826,7 @@ bool Boiler::set_heating_temp(const char * value, const int8_t id) {
|
||||
|
||||
// set min boiler output
|
||||
bool Boiler::set_min_power(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1842,7 +1842,7 @@ bool Boiler::set_min_power(const char * value, const int8_t id) {
|
||||
|
||||
// set max boiler output
|
||||
bool Boiler::set_max_power(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1858,7 +1858,7 @@ bool Boiler::set_max_power(const char * value, const int8_t id) {
|
||||
|
||||
// set ww on hysteresis
|
||||
bool Boiler::set_ww_hyst_on(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1874,7 +1874,7 @@ bool Boiler::set_ww_hyst_on(const char * value, const int8_t id) {
|
||||
|
||||
// set ww off hysteresis
|
||||
bool Boiler::set_ww_hyst_off(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1890,7 +1890,7 @@ bool Boiler::set_ww_hyst_off(const char * value, const int8_t id) {
|
||||
|
||||
// set ww charge optimization
|
||||
bool Boiler::set_ww_chargeOptimization(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1907,7 +1907,7 @@ bool Boiler::set_ww_chargeOptimization(const char * value, const int8_t id) {
|
||||
|
||||
// set dhw max power
|
||||
bool Boiler::set_ww_maxpower(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1919,7 +1919,7 @@ bool Boiler::set_ww_maxpower(const char * value, const int8_t id) {
|
||||
|
||||
// set dhw maximum temperature
|
||||
bool Boiler::set_ww_maxtemp(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1931,7 +1931,7 @@ bool Boiler::set_ww_maxtemp(const char * value, const int8_t id) {
|
||||
|
||||
// set min pump modulation
|
||||
bool Boiler::set_min_pump(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1947,7 +1947,7 @@ bool Boiler::set_min_pump(const char * value, const int8_t id) {
|
||||
|
||||
// set max pump modulation
|
||||
bool Boiler::set_max_pump(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1963,7 +1963,7 @@ bool Boiler::set_max_pump(const char * value, const int8_t id) {
|
||||
|
||||
// set boiler on hysteresis
|
||||
bool Boiler::set_hyst_on(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1979,7 +1979,7 @@ bool Boiler::set_hyst_on(const char * value, const int8_t id) {
|
||||
|
||||
// set boiler off hysteresis
|
||||
bool Boiler::set_hyst_off(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1995,7 +1995,7 @@ bool Boiler::set_hyst_off(const char * value, const int8_t id) {
|
||||
|
||||
// set min burner period
|
||||
bool Boiler::set_burn_period(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2011,7 +2011,7 @@ bool Boiler::set_burn_period(const char * value, const int8_t id) {
|
||||
|
||||
// set pump delay
|
||||
bool Boiler::set_pump_delay(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2047,7 +2047,7 @@ bool Boiler::set_ww_mode(const char * value, const int8_t id) {
|
||||
|
||||
// turn on/off dhw
|
||||
bool Boiler::set_ww_activated(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2071,7 +2071,7 @@ bool Boiler::set_tapwarmwater_activated(const char * value, const int8_t id) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2106,7 +2106,7 @@ bool Boiler::set_tapwarmwater_activated(const char * value, const int8_t id) {
|
||||
// true = on, false = off
|
||||
// See also https://github.com/emsesp/EMS-ESP/issues/341#issuecomment-596245458 for Junkers
|
||||
bool Boiler::set_ww_onetime(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2122,7 +2122,7 @@ bool Boiler::set_ww_onetime(const char * value, const int8_t id) {
|
||||
|
||||
// starting dhw disinfect, set to off seems not working
|
||||
bool Boiler::set_ww_disinfect(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2139,7 +2139,7 @@ bool Boiler::set_ww_disinfect(const char * value, const int8_t id) {
|
||||
// Activate / De-activate circulation of dhw 0x35
|
||||
// true = on, false = off
|
||||
bool Boiler::set_ww_circulation(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2155,7 +2155,7 @@ bool Boiler::set_ww_circulation(const char * value, const int8_t id) {
|
||||
|
||||
// configuration of dhw circulation pump
|
||||
bool Boiler::set_ww_circulation_pump(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2172,7 +2172,7 @@ bool Boiler::set_ww_circulation_pump(const char * value, const int8_t id) {
|
||||
// Set the mode of circulation, 1x3min, ... 6x3min, continuous
|
||||
// true = on, false = off
|
||||
bool Boiler::set_ww_circulation_mode(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2number(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2307,7 +2307,7 @@ bool Boiler::set_maintenancedate(const char * value, const int8_t id) {
|
||||
|
||||
// Set the pool temperature 0x48A
|
||||
bool Boiler::set_pool_temp(const char * value, const int8_t id) {
|
||||
float v = 0;
|
||||
float v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2319,7 +2319,7 @@ bool Boiler::set_pool_temp(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Boiler::set_emergency_temp(const char * value, const int8_t id) {
|
||||
int v = 0;
|
||||
int v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2330,7 +2330,7 @@ bool Boiler::set_emergency_temp(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Boiler::set_emergency_ops(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ bool Mixer::set_setValveTime(const char * value, const int8_t id) {
|
||||
|
||||
bool Mixer::set_wwMaxTemp(const char * value, const int8_t id) {
|
||||
uint8_t wwc = device_id() - 0x28;
|
||||
float v = 0;
|
||||
float v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -399,7 +399,7 @@ bool Mixer::set_wwMaxTemp(const char * value, const int8_t id) {
|
||||
|
||||
bool Mixer::set_wwDiffTemp(const char * value, const int8_t id) {
|
||||
uint8_t wwc = device_id() - 0x28;
|
||||
float v = 0;
|
||||
float v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ bool Mixer::set_wwDiffTemp(const char * value, const int8_t id) {
|
||||
|
||||
bool Mixer::set_wwReducedTemp(const char * value, const int8_t id) {
|
||||
uint8_t wwc = device_id() - 0x28;
|
||||
float v = 0;
|
||||
float v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -419,7 +419,7 @@ bool Mixer::set_wwReducedTemp(const char * value, const int8_t id) {
|
||||
|
||||
bool Mixer::set_wwRequiredTemp(const char * value, const int8_t id) {
|
||||
uint8_t wwc = device_id() - 0x28;
|
||||
float v = 0;
|
||||
float v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -428,7 +428,7 @@ bool Mixer::set_wwRequiredTemp(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Mixer::set_wwDisinfectionTemp(const char * value, const int8_t id) {
|
||||
float v = 0;
|
||||
float v;
|
||||
if (!Helpers::value2temperature(value, v)) {
|
||||
return false;
|
||||
}
|
||||
@@ -442,7 +442,7 @@ bool Mixer::set_wwDisinfectionTemp(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Mixer::set_wwCircPump(const char * value, const int8_t id) {
|
||||
bool v = false;
|
||||
bool v;
|
||||
if (!Helpers::value2bool(value, v)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -680,12 +680,6 @@ void Thermostat::process_JunkersSet(std::shared_ptr<const Telegram> telegram) {
|
||||
return;
|
||||
}
|
||||
|
||||
has_update(telegram, hc->daytemp, 17); // is * 2
|
||||
has_update(telegram, hc->nighttemp, 16); // is * 2
|
||||
has_update(telegram, hc->nofrosttemp, 15); // is * 2
|
||||
has_update(telegram, hc->control, 1); // remote: 0-off, 1-FB10, 2-FB100
|
||||
has_enumupdate(telegram, hc->program, 13, 1); // 1-6: 1 = A, 2 = B,...
|
||||
has_enumupdate(telegram, hc->mode, 14, 1); // 0 = nofrost, 1 = eco, 2 = heat, 3 = auto
|
||||
has_update(telegram, hc->daytemp, 17); // is * 2
|
||||
has_update(telegram, hc->nighttemp, 16); // is * 2
|
||||
has_update(telegram, hc->nofrosttemp, 15); // is * 2
|
||||
@@ -1517,7 +1511,7 @@ bool Thermostat::set_tempDiffBoiler(const char * value, const int8_t id) {
|
||||
|
||||
// 0xA5 - Set minimum external temperature
|
||||
bool Thermostat::set_minexttemp(const char * value, const int8_t id) {
|
||||
int mt = 0;
|
||||
int mt;
|
||||
if (!Helpers::value2temperature(value, mt)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1535,7 +1529,7 @@ bool Thermostat::set_minexttemp(const char * value, const int8_t id) {
|
||||
|
||||
// 0xA5/0xA7 - Clock offset
|
||||
bool Thermostat::set_clockoffset(const char * value, const int8_t id) {
|
||||
int co = 0;
|
||||
int co;
|
||||
if (!Helpers::value2number(value, co)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1551,7 +1545,7 @@ bool Thermostat::set_clockoffset(const char * value, const int8_t id) {
|
||||
|
||||
// 0xA5/0xA7 - Calibrate internal temperature
|
||||
bool Thermostat::set_calinttemp(const char * value, const int8_t id) {
|
||||
float ct = 0;
|
||||
float ct;
|
||||
if (!Helpers::value2temperature(value, ct, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1588,7 +1582,7 @@ bool Thermostat::set_display(const char * value, const int8_t id) {
|
||||
|
||||
// 0xA7 - Set Screen brightness
|
||||
bool Thermostat::set_brightness(const char * value, const int8_t id) {
|
||||
int bo = 0;
|
||||
int bo;
|
||||
if (!Helpers::value2number(value, bo, -15, 15)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1599,7 +1593,7 @@ bool Thermostat::set_brightness(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_remotetemp(const char * value, const int8_t id) {
|
||||
float f = 0;
|
||||
float f;
|
||||
if (!Helpers::value2temperature(value, f)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1623,7 +1617,7 @@ bool Thermostat::set_remotetemp(const char * value, const int8_t id) {
|
||||
|
||||
// 0xA5/0xA7 - Set the building settings
|
||||
bool Thermostat::set_building(const char * value, const int8_t id) {
|
||||
uint8_t bd = 0;
|
||||
uint8_t bd;
|
||||
if (!Helpers::value2enum(value, bd, FL_(enum_ibaBuildingType))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1641,7 +1635,7 @@ bool Thermostat::set_building(const char * value, const int8_t id) {
|
||||
|
||||
// 0xB0/0xA7 - Set RC10 heating pid
|
||||
bool Thermostat::set_heatingpid(const char * value, const int8_t id) {
|
||||
uint8_t pid = 0;
|
||||
uint8_t pid;
|
||||
if (!Helpers::value2enum(value, pid, FL_(enum_PID))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1674,7 +1668,7 @@ bool Thermostat::set_damping(const char * value, const int8_t id) {
|
||||
|
||||
// 0xA5/0xA7 Set the language settings
|
||||
bool Thermostat::set_language(const char * value, const int8_t id) {
|
||||
uint8_t lg = 0;
|
||||
uint8_t lg;
|
||||
|
||||
if (model() == EMS_DEVICE_FLAG_RC30) {
|
||||
if (!Helpers::value2enum(value, lg, FL_(enum_ibaLanguage_RC30))) {
|
||||
@@ -1699,7 +1693,7 @@ bool Thermostat::set_control(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t ctrl = 0;
|
||||
uint8_t ctrl;
|
||||
if (model() == EMS_DEVICE_FLAG_JUNKERS && !has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) {
|
||||
if (Helpers::value2enum(value, ctrl, FL_(enum_j_control))) {
|
||||
write_command(set_typeids[hc->hc()], 1, ctrl);
|
||||
@@ -1721,7 +1715,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t ctrl = 0;
|
||||
uint8_t ctrl;
|
||||
if (model() == EMS_DEVICE_FLAG_JUNKERS && !has_flags(EMS_DEVICE_FLAG_JUNKERS_OLD)) {
|
||||
if (Helpers::value2enum(value, ctrl, FL_(enum_roomsensor))) {
|
||||
write_command(set_typeids[hc->hc()], 9, ctrl + 1);
|
||||
@@ -1733,7 +1727,7 @@ bool Thermostat::set_roomsensor(const char * value, const int8_t id) {
|
||||
|
||||
// sets the thermostat ww working mode, where mode is a string, ems and ems+
|
||||
bool Thermostat::set_wwmode(const char * value, const int8_t id) {
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
|
||||
if (model() == EMS_DEVICE_FLAG_RC10) {
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_wwMode3))) {
|
||||
@@ -1762,7 +1756,7 @@ bool Thermostat::set_wwmode(const char * value, const int8_t id) {
|
||||
|
||||
//Set ww when thermostat mode is off (RC30)
|
||||
bool Thermostat::set_wwwhenmodeoff(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1786,7 +1780,7 @@ bool Thermostat::set_wwtemp(const char * value, const int8_t id) {
|
||||
|
||||
// Set ww low temperature, ems+
|
||||
bool Thermostat::set_wwtemplow(const char * value, const int8_t id) {
|
||||
int t = 0;
|
||||
int t;
|
||||
if (!Helpers::value2temperature(value, t)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1798,7 +1792,7 @@ bool Thermostat::set_wwtemplow(const char * value, const int8_t id) {
|
||||
|
||||
// Set ww charge RC300, ems+
|
||||
bool Thermostat::set_wwcharge(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1814,7 +1808,7 @@ bool Thermostat::set_wwcharge(const char * value, const int8_t id) {
|
||||
|
||||
// Set ww charge duration in steps of 15 min, ems+
|
||||
bool Thermostat::set_wwchargeduration(const char * value, const int8_t id) {
|
||||
int t = 0xFF;
|
||||
int t;
|
||||
if (!Helpers::value2number(value, t)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1848,7 +1842,7 @@ bool Thermostat::set_wwprio(const char * value, const int8_t id) {
|
||||
|
||||
// sets the thermostat ww circulation working mode, where mode is a string
|
||||
bool Thermostat::set_wwcircmode(const char * value, const int8_t id) {
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
|
||||
if ((model() == EMS_DEVICE_FLAG_RC300) || (model() == EMS_DEVICE_FLAG_RC100)) {
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_wwCircMode))) {
|
||||
@@ -1867,7 +1861,7 @@ bool Thermostat::set_wwcircmode(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_wwDailyHeating(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1894,7 +1888,7 @@ bool Thermostat::set_wwDailyHeatTime(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1911,7 +1905,7 @@ bool Thermostat::set_wwDisinfect(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_wwDisinfectDay(const char * value, const int8_t id) {
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_dayOfWeek))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1950,7 +1944,7 @@ bool Thermostat::set_wwDisinfectHour(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_wwMaxTemp(const char * value, const int8_t id) {
|
||||
int t = 0;
|
||||
int t;
|
||||
if (!Helpers::value2temperature(value, t, false, 0, 90)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1973,7 +1967,7 @@ bool Thermostat::set_wwOneTimeKey(const char * value, const int8_t id) {
|
||||
|
||||
// for RC10, 0xB0 or RC30, 0xA7
|
||||
bool Thermostat::set_backlight(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1988,7 +1982,7 @@ bool Thermostat::set_backlight(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_autodst(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1999,7 +1993,7 @@ bool Thermostat::set_autodst(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_preheating(const char * value, const int8_t id) {
|
||||
bool b = false;
|
||||
bool b;
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2010,7 +2004,7 @@ bool Thermostat::set_preheating(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_offtemp(const char * value, const int8_t id) {
|
||||
int ot = 0;
|
||||
int ot;
|
||||
if (!Helpers::value2temperature(value, ot, true)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2022,7 +2016,7 @@ bool Thermostat::set_offtemp(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_mixingvalves(const char * value, const int8_t id) {
|
||||
int m = 0;
|
||||
int m;
|
||||
if (!Helpers::value2number(value, m, 0, 2)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2033,7 +2027,7 @@ bool Thermostat::set_mixingvalves(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_wwProgMode(const char * value, const int8_t id) {
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_wwProgMode))) {
|
||||
return false;
|
||||
}
|
||||
@@ -2044,7 +2038,7 @@ bool Thermostat::set_wwProgMode(const char * value, const int8_t id) {
|
||||
}
|
||||
|
||||
bool Thermostat::set_wwCircProg(const char * value, const int8_t id) {
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_wwProgMode))) {
|
||||
return false;
|
||||
}
|
||||
@@ -2210,7 +2204,7 @@ bool Thermostat::set_roominfl_factor(const char * value, const int8_t id) {
|
||||
if (hc == nullptr) {
|
||||
return false;
|
||||
}
|
||||
float val = 0;
|
||||
float val;
|
||||
if (!Helpers::value2float(value, val)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2418,7 +2412,7 @@ bool Thermostat::set_summermode(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
|
||||
if (is_fetch(summer2_typeids[hc->hc()])) {
|
||||
if ((hc->statusbyte & 1) && Helpers::value2enum(value, set, FL_(enum_summermode))) {
|
||||
@@ -2444,7 +2438,7 @@ bool Thermostat::set_fastheatup(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int set = 0;
|
||||
int set;
|
||||
|
||||
if (!Helpers::value2number(value, set)) {
|
||||
return false;
|
||||
@@ -2462,7 +2456,7 @@ bool Thermostat::set_switchonoptimization(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool b = false;
|
||||
bool b;
|
||||
|
||||
if (!Helpers::value2bool(value, b)) {
|
||||
return false;
|
||||
@@ -2480,7 +2474,7 @@ bool Thermostat::set_reducemode(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_reducemode1))) {
|
||||
write_command(set_typeids[hc->hc()], 5, set + 1, set_typeids[hc->hc()]);
|
||||
@@ -2504,7 +2498,7 @@ bool Thermostat::set_vacreducemode(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (!Helpers::value2enum(value, set, FL_(enum_reducemode))) {
|
||||
return false;
|
||||
}
|
||||
@@ -2520,7 +2514,7 @@ bool Thermostat::set_nofrostmode(const char * value, const int8_t id) {
|
||||
if (hc == nullptr) {
|
||||
return false;
|
||||
}
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (model() == EMS_DEVICE_FLAG_RC300 || model() == EMS_DEVICE_FLAG_RC100) {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_nofrostmode1))) {
|
||||
write_command(curve_typeids[hc->hc()], 5, set + 1, curve_typeids[hc->hc()]);
|
||||
@@ -2543,7 +2537,7 @@ bool Thermostat::set_heatingtype(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (Helpers::value2enum(value, set, FL_(enum_heatingtype))) {
|
||||
if ((model() == EMS_DEVICE_FLAG_RC20_N) || (model() == EMS_DEVICE_FLAG_RC25)) {
|
||||
write_command(set_typeids[hc->hc()], 0, set, set_typeids[hc->hc()]);
|
||||
@@ -2568,7 +2562,7 @@ bool Thermostat::set_controlmode(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if (model() == EMS_DEVICE_FLAG_RC100) {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_controlmode))) {
|
||||
write_command(curve_typeids[hc->hc()], 0, set, curve_typeids[hc->hc()]);
|
||||
@@ -2820,7 +2814,7 @@ bool Thermostat::set_program(const char * value, const int8_t id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t set = 0xFF;
|
||||
uint8_t set;
|
||||
if ((model() == EMS_DEVICE_FLAG_RC20_N) || (model() == EMS_DEVICE_FLAG_RC25)) {
|
||||
if (Helpers::value2enum(value, set, FL_(enum_progMode3))) {
|
||||
write_command(set_typeids[hc->hc()], 11, set + 1, set_typeids[hc->hc()]);
|
||||
@@ -3258,7 +3252,7 @@ bool Thermostat::set_temperature(const float temperature, const uint8_t mode, co
|
||||
}
|
||||
|
||||
bool Thermostat::set_temperature_value(const char * value, const int8_t id, const uint8_t mode, bool relative) {
|
||||
float f = 0;
|
||||
float f;
|
||||
uint8_t hc_num = (id == -1) ? AUTO_HEATING_CIRCUIT : id;
|
||||
if (Helpers::value2temperature(value, f, relative)) {
|
||||
return set_temperature(f, mode, hc_num);
|
||||
|
||||
@@ -62,21 +62,21 @@ 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 ("");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,29 +84,29 @@ std::string EMSdevice::brand_to_string() const {
|
||||
std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
||||
switch (device_type) {
|
||||
case DeviceType::SYSTEM:
|
||||
return (F_(system));
|
||||
return F_(system);
|
||||
case DeviceType::BOILER:
|
||||
return (F_(boiler));
|
||||
return F_(boiler);
|
||||
case DeviceType::THERMOSTAT:
|
||||
return (F_(thermostat));
|
||||
return F_(thermostat);
|
||||
case DeviceType::HEATPUMP:
|
||||
return (F_(heatpump));
|
||||
return F_(heatpump);
|
||||
case DeviceType::SOLAR:
|
||||
return (F_(solar));
|
||||
return F_(solar);
|
||||
case DeviceType::CONNECT:
|
||||
return (F_(connect));
|
||||
return F_(connect);
|
||||
case DeviceType::MIXER:
|
||||
return (F_(mixer));
|
||||
return F_(mixer);
|
||||
case DeviceType::DALLASSENSOR:
|
||||
return (F_(dallassensor));
|
||||
return F_(dallassensor);
|
||||
case DeviceType::ANALOGSENSOR:
|
||||
return (F_(analogsensor));
|
||||
return F_(analogsensor);
|
||||
case DeviceType::CONTROLLER:
|
||||
return (F_(controller));
|
||||
return F_(controller);
|
||||
case DeviceType::SWITCH:
|
||||
return (F_(switch));
|
||||
return F_(switch);
|
||||
case DeviceType::GATEWAY:
|
||||
return (F_(gateway));
|
||||
return F_(gateway);
|
||||
default:
|
||||
return Helpers::translated_word(FL_(unknown));
|
||||
}
|
||||
@@ -125,35 +125,35 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
||||
*p = tolower(*p);
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(boiler)))) {
|
||||
if (!strcmp(lowtopic, F_(boiler))) {
|
||||
return DeviceType::BOILER;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(thermostat)))) {
|
||||
if (!strcmp(lowtopic, F_(thermostat))) {
|
||||
return DeviceType::THERMOSTAT;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(system)))) {
|
||||
if (!strcmp(lowtopic, F_(system))) {
|
||||
return DeviceType::SYSTEM;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(heatpump)))) {
|
||||
if (!strcmp(lowtopic, F_(heatpump))) {
|
||||
return DeviceType::HEATPUMP;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(solar)))) {
|
||||
if (!strcmp(lowtopic, F_(solar))) {
|
||||
return DeviceType::SOLAR;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(mixer)))) {
|
||||
if (!strcmp(lowtopic, F_(mixer))) {
|
||||
return DeviceType::MIXER;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(dallassensor)))) {
|
||||
if (!strcmp(lowtopic, F_(dallassensor))) {
|
||||
return DeviceType::DALLASSENSOR;
|
||||
}
|
||||
|
||||
if (!strcmp(lowtopic, reinterpret_cast<PGM_P>(F_(analogsensor)))) {
|
||||
if (!strcmp(lowtopic, F_(analogsensor))) {
|
||||
return DeviceType::ANALOGSENSOR;
|
||||
}
|
||||
|
||||
@@ -264,9 +264,9 @@ void EMSdevice::list_device_entries(JsonObject & output) const {
|
||||
// if we have a tag prefix it
|
||||
char key[50];
|
||||
if (!EMSdevice::tag_to_mqtt(dv.tag).empty()) {
|
||||
snprintf(key, sizeof(key), "%s.%s", EMSdevice::tag_to_mqtt(dv.tag).c_str(), (dv.short_name));
|
||||
snprintf(key, sizeof(key), "%s.%s", EMSdevice::tag_to_mqtt(dv.tag).c_str(), dv.short_name);
|
||||
} else {
|
||||
snprintf(key, sizeof(key), "%s", (dv.short_name));
|
||||
snprintf(key, sizeof(key), "%s", dv.short_name);
|
||||
}
|
||||
|
||||
JsonArray details = output.createNestedArray(key);
|
||||
@@ -446,7 +446,7 @@ void EMSdevice::add_device_value(uint8_t tag,
|
||||
EMSESP::webCustomizationService.read([&](WebCustomization & settings) {
|
||||
for (EntityCustomization entityCustomization : settings.entityCustomizations) {
|
||||
if ((entityCustomization.product_id == product_id()) && (entityCustomization.device_id == device_id())) {
|
||||
std::string entity = tag < DeviceValueTAG::TAG_HC1 ? (short_name) : tag_to_string(tag) + "/" + (short_name);
|
||||
std::string entity = tag < DeviceValueTAG::TAG_HC1 ? short_name : tag_to_mqtt(tag) + "/" + short_name;
|
||||
for (std::string entity_id : entityCustomization.entity_ids) {
|
||||
// if there is an appended custom name, strip it to get the true entity name
|
||||
// and extract the new custom name
|
||||
@@ -637,14 +637,14 @@ void EMSdevice::publish_value(void * value_p) const {
|
||||
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
|
||||
if (Mqtt::publish_single2cmd()) {
|
||||
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", device_type_2_device_name(device_type_).c_str(), tag_to_mqtt(dv.tag).c_str(), (dv.short_name));
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", device_type_2_device_name(device_type_).c_str(), tag_to_mqtt(dv.tag).c_str(), dv.short_name);
|
||||
} else {
|
||||
snprintf(topic, sizeof(topic), "%s/%s", device_type_2_device_name(device_type_).c_str(), (dv.short_name));
|
||||
snprintf(topic, sizeof(topic), "%s/%s", device_type_2_device_name(device_type_).c_str(), dv.short_name);
|
||||
}
|
||||
} else if (Mqtt::is_nested() && dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), tag_to_mqtt(dv.tag).c_str(), (dv.short_name));
|
||||
snprintf(topic, sizeof(topic), "%s/%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), tag_to_mqtt(dv.tag).c_str(), dv.short_name);
|
||||
} else {
|
||||
snprintf(topic, sizeof(topic), "%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), (dv.short_name));
|
||||
snprintf(topic, sizeof(topic), "%s/%s", Mqtt::tag_to_topic(device_type_, dv.tag).c_str(), dv.short_name);
|
||||
}
|
||||
|
||||
int8_t num_op = dv.numeric_operator;
|
||||
@@ -908,9 +908,9 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) {
|
||||
|
||||
// id holds the shortname and must always have a value for the WebUI table to work
|
||||
if (dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
obj["id"] = tag_to_string(dv.tag) + "/" + (dv.short_name);
|
||||
obj["id"] = tag_to_mqtt(dv.tag) + "/" + dv.short_name;
|
||||
} else {
|
||||
obj["id"] = (dv.short_name);
|
||||
obj["id"] = dv.short_name;
|
||||
}
|
||||
|
||||
// n is the fullname, and can be optional
|
||||
@@ -936,11 +936,6 @@ void EMSdevice::generate_values_web_customization(JsonArray & output) {
|
||||
obj["n"] = "!" + fullname; // prefix commands with a !
|
||||
}
|
||||
|
||||
// add the custom name, is optional
|
||||
if (!dv.custom_fullname.empty()) {
|
||||
obj["cn"] = dv.custom_fullname;
|
||||
}
|
||||
|
||||
obj["m"] = dv.state >> 4; // send back the mask state. We're only interested in the high nibble
|
||||
obj["w"] = dv.has_cmd; // if writable
|
||||
|
||||
@@ -976,7 +971,7 @@ void EMSdevice::set_climate_minmax(uint8_t tag, int16_t min, uint16_t max) {
|
||||
// returns true if the entity has a mask set (not 0 the default)
|
||||
void EMSdevice::setCustomEntity(const std::string & entity_id) {
|
||||
for (auto & dv : devicevalues_) {
|
||||
std::string entity_name = dv.tag < DeviceValueTAG::TAG_HC1 ? (dv.short_name) : tag_to_string(dv.tag) + "/" + (dv.short_name);
|
||||
std::string entity_name = dv.tag < DeviceValueTAG::TAG_HC1 ? dv.short_name : tag_to_mqtt(dv.tag) + "/" + dv.short_name;
|
||||
|
||||
// extra shortname
|
||||
std::string shortname;
|
||||
@@ -1028,7 +1023,7 @@ void EMSdevice::setCustomEntity(const std::string & entity_id) {
|
||||
// populate a string vector with entities that have masks set or have a custom name
|
||||
void EMSdevice::getCustomEntities(std::vector<std::string> & entity_ids) {
|
||||
for (const auto & dv : devicevalues_) {
|
||||
std::string entity_name = dv.tag < DeviceValueTAG::TAG_HC1 ? (dv.short_name) : tag_to_string(dv.tag) + "/" + (dv.short_name);
|
||||
std::string entity_name = dv.tag < DeviceValueTAG::TAG_HC1 ? dv.short_name : tag_to_mqtt(dv.tag) + "/" + dv.short_name;
|
||||
uint8_t mask = dv.state >> 4;
|
||||
|
||||
if (mask || !dv.custom_fullname.empty()) {
|
||||
@@ -1293,7 +1288,7 @@ bool EMSdevice::generate_values(JsonObject & output, const uint8_t tag_filter, c
|
||||
if (dv.tag != old_tag) {
|
||||
old_tag = dv.tag;
|
||||
if (nested && have_tag && dv.tag >= DeviceValueTAG::TAG_HC1) {
|
||||
json = output.createNestedObject(tag_to_string(dv.tag));
|
||||
json = output.createNestedObject(tag_to_mqtt(dv.tag));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1473,14 +1468,14 @@ 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_) {
|
||||
if ((tf.telegram_type_id_ == telegram->type_id) && (telegram->type_id != 0xFF)) {
|
||||
return (tf.telegram_type_name_);
|
||||
return tf.telegram_type_name_;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1495,7 +1490,7 @@ bool EMSdevice::handle_telegram(std::shared_ptr<const Telegram> telegram) {
|
||||
// if the data block is empty and we have not received data before, assume that this telegram
|
||||
// is not recognized by the bus master. So remove it from the automatic fetch list
|
||||
if (telegram->message_length == 0 && telegram->offset == 0 && !tf.received_) {
|
||||
EMSESP::logger().debug(("This telegram (%s) is not recognized by the EMS bus"), (tf.telegram_type_name_));
|
||||
EMSESP::logger().debug("This telegram (%s) is not recognized by the EMS bus", tf.telegram_type_name_);
|
||||
tf.fetch_ = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -249,14 +249,14 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
if (bus_status() != BUS_STATUS_OFFLINE) {
|
||||
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(" Bus protocol: %s", EMSbus::is_ht3() ? "HT3" : "Buderus");
|
||||
shell.printfln(" #recognized EMS devices: %d", EMSESP::emsdevices.size());
|
||||
shell.printfln(" #telegrams received: %d", rxservice_.telegram_count());
|
||||
shell.printfln(" #read requests sent: %d", txservice_.telegram_read_count());
|
||||
shell.printfln(" #write requests sent: %d", txservice_.telegram_write_count());
|
||||
shell.printfln(" #incomplete telegrams: %d", rxservice_.telegram_error_count());
|
||||
shell.printfln((" #read fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_read_fail_count());
|
||||
shell.printfln((" #write fails (after %d retries): %d"), TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_write_fail_count());
|
||||
shell.printfln(" #read fails (after %d retries): %d", TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_read_fail_count());
|
||||
shell.printfln(" #write fails (after %d retries): %d", TxService::MAXIMUM_TX_RETRIES, txservice_.telegram_write_fail_count());
|
||||
shell.printfln(" Rx line quality: %d%%", rxservice_.quality());
|
||||
shell.printfln(" Tx line quality: %d%%", (txservice_.read_quality() + txservice_.read_quality()) / 2);
|
||||
shell.println();
|
||||
@@ -267,7 +267,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
if (rx_telegrams.empty()) {
|
||||
shell.printfln("Rx Queue is empty");
|
||||
} else {
|
||||
shell.printfln(("Rx Queue (%ld telegram%s):"), rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s");
|
||||
shell.printfln("Rx Queue (%ld telegram%s):", rx_telegrams.size(), rx_telegrams.size() == 1 ? "" : "s");
|
||||
for (const auto & it : rx_telegrams) {
|
||||
shell.printfln(" [%02d] %s", it.id_, pretty_telegram(it.telegram_).c_str());
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void EMSESP::show_ems(uuid::console::Shell & shell) {
|
||||
if (tx_telegrams.empty()) {
|
||||
shell.printfln("Tx Queue is empty");
|
||||
} else {
|
||||
shell.printfln(("Tx Queue (%ld telegram%s):"), tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s");
|
||||
shell.printfln("Tx Queue (%ld telegram%s):", tx_telegrams.size(), tx_telegrams.size() == 1 ? "" : "s");
|
||||
|
||||
std::string op;
|
||||
for (const auto & it : tx_telegrams) {
|
||||
@@ -311,7 +311,7 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) {
|
||||
for (const auto & emsdevice : emsdevices) {
|
||||
if (emsdevice && (emsdevice->device_type() == device_class.first)) {
|
||||
// print header
|
||||
shell.printfln(("%s: %s (%d)"), emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str(), emsdevice->count_entities());
|
||||
shell.printfln("%s: %s (%d)", emsdevice->device_type_name().c_str(), emsdevice->to_string().c_str(), emsdevice->count_entities());
|
||||
|
||||
DynamicJsonDocument doc(EMSESP_JSON_SIZE_XXLARGE_DYN); // use max size
|
||||
JsonObject json = doc.to<JsonObject>();
|
||||
@@ -366,7 +366,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
|
||||
for (const auto & sensor : dallassensor_.sensors()) {
|
||||
if (Helpers::hasValue(sensor.temperature_c)) {
|
||||
shell.printfln((" %s: %s%s °%c%s (offset %s, ID: %s)"),
|
||||
shell.printfln(" %s: %s%s °%c%s (offset %s, ID: %s)",
|
||||
sensor.name().c_str(),
|
||||
COLOR_BRIGHT_GREEN,
|
||||
Helpers::render_value(s, sensor.temperature_c, 10, fahrenheit),
|
||||
@@ -375,7 +375,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
Helpers::render_value(s2, sensor.offset(), 10, fahrenheit),
|
||||
sensor.id().c_str());
|
||||
} else {
|
||||
shell.printfln((" %s (offset %s, ID: %s)"), sensor.name().c_str(), Helpers::render_value(s, sensor.offset(), 10, fahrenheit), sensor.id().c_str());
|
||||
shell.printfln(" %s (offset %s, ID: %s)", sensor.name().c_str(), Helpers::render_value(s, sensor.offset(), 10, fahrenheit), sensor.id().c_str());
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
@@ -388,7 +388,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
for (const auto & sensor : analogsensor_.sensors()) {
|
||||
switch (sensor.type()) {
|
||||
case AnalogSensor::AnalogType::ADC:
|
||||
shell.printfln((" %s: %s%s %s%s (Type: ADC, Factor: %s, Offset: %d)"),
|
||||
shell.printfln(" %s: %s%s %s%s (Type: ADC, Factor: %s, Offset: %d)",
|
||||
sensor.name().c_str(),
|
||||
COLOR_BRIGHT_GREEN,
|
||||
Helpers::render_value(s, sensor.value(), 2),
|
||||
@@ -400,7 +400,7 @@ void EMSESP::show_sensor_values(uuid::console::Shell & shell) {
|
||||
default:
|
||||
// case AnalogSensor::AnalogType::DIGITAL_IN:
|
||||
// case AnalogSensor::AnalogType::COUNTER:
|
||||
shell.printfln((" %s: %s%d%s (Type: %s)"),
|
||||
shell.printfln(" %s: %s%d%s (Type: %s)",
|
||||
sensor.name().c_str(),
|
||||
COLOR_BRIGHT_GREEN,
|
||||
(uint16_t)sensor.value(), // as int
|
||||
@@ -523,7 +523,7 @@ void EMSESP::publish_device_values(uint8_t device_type) {
|
||||
for (const auto & emsdevice : emsdevices) {
|
||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||
if (nested && !nest_created && emsdevice->has_tag(tag)) {
|
||||
json_hc = doc.createNestedObject(EMSdevice::tag_to_string(tag));
|
||||
json_hc = doc.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
||||
nest_created = true;
|
||||
}
|
||||
need_publish |= emsdevice->generate_values(json_hc, tag, false, EMSdevice::OUTPUT_TARGET::MQTT);
|
||||
@@ -858,7 +858,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
LOG_DEBUG(("No telegram type handler found for ID 0x%02X (src 0x%02X)"), telegram->type_id, telegram->src);
|
||||
LOG_DEBUG("No telegram type handler found for ID 0x%02X (src 0x%02X)", telegram->type_id, telegram->src);
|
||||
if (watch() == WATCH_UNKNOWN) {
|
||||
LOG_NOTICE("%s", pretty_telegram(telegram).c_str());
|
||||
}
|
||||
@@ -973,7 +973,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
|
||||
// if we don't recognize the productID report it and add as a generic device
|
||||
if (device_p == nullptr) {
|
||||
LOG_NOTICE(("Unrecognized EMS device (deviceID 0x%02X, productID %d). Please report on GitHub."), device_id, product_id);
|
||||
LOG_NOTICE("Unrecognized EMS device (deviceID 0x%02X, productID %d). Please report on GitHub.", device_id, product_id);
|
||||
emsdevices.push_back(
|
||||
EMSFactory::add(DeviceType::GENERIC, device_id, product_id, version, "unknown", DeviceFlags::EMS_DEVICE_FLAG_NONE, EMSdevice::Brand::NO_BRAND));
|
||||
return false; // not found
|
||||
@@ -1020,12 +1020,12 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
flags = DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP;
|
||||
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);
|
||||
LOG_WARNING("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub.", device_id);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DEBUG(("Adding new device %s (deviceID 0x%02X, productID %d, version %s)"), name, device_id, product_id, version);
|
||||
LOG_DEBUG("Adding new device %s (deviceID 0x%02X, productID %d, version %s)", name, device_id, product_id, version);
|
||||
emsdevices.push_back(EMSFactory::add(device_type, device_id, product_id, version, name, flags, brand));
|
||||
|
||||
// assign a unique ID. Note that this is not actual unique after a restart as it's dependent on the order that devices are found
|
||||
@@ -1055,7 +1055,7 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
|
||||
FL_(info_cmd));
|
||||
Command::add(
|
||||
device_type,
|
||||
("values"),
|
||||
F_(values),
|
||||
[device_type](const char * value, const int8_t id, JsonObject & output) {
|
||||
return command_info(device_type, output, id, EMSdevice::OUTPUT_TARGET::API_SHORTNAMES); // HIDDEN command showing short names, used in e.g. /api/boiler
|
||||
},
|
||||
@@ -1124,7 +1124,7 @@ bool EMSESP::command_info(uint8_t device_type, JsonObject & output, const int8_t
|
||||
for (const auto & emsdevice : emsdevices) {
|
||||
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||
if (!nest_created && emsdevice->has_tag(tag)) {
|
||||
output_hc = output.createNestedObject(EMSdevice::tag_to_string(tag));
|
||||
output_hc = output.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
||||
nest_created = true;
|
||||
}
|
||||
has_value |= emsdevice->generate_values(output_hc, tag, true, output_target); // use nested for id -1 and 0
|
||||
@@ -1323,7 +1323,7 @@ void EMSESP::start() {
|
||||
device_library_ = {
|
||||
#include "device_library.h"
|
||||
};
|
||||
LOG_INFO(("Loaded EMS device library (%d records)"), device_library_.size());
|
||||
LOG_INFO("Loaded EMS device library (%d records)", device_library_.size());
|
||||
|
||||
#if defined(EMSESP_STANDALONE)
|
||||
Mqtt::on_connect(); // simulate an MQTT connection
|
||||
|
||||
30
src/mqtt.cpp
30
src/mqtt.cpp
@@ -205,7 +205,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
return;
|
||||
}
|
||||
|
||||
shell.printfln(("MQTT queue (%d/%d messages):"), mqtt_messages_.size(), MAX_MQTT_MESSAGES);
|
||||
shell.printfln("MQTT queue (%d/%d messages):", mqtt_messages_.size(), MAX_MQTT_MESSAGES);
|
||||
|
||||
for (const auto & message : mqtt_messages_) {
|
||||
auto content = message.content_;
|
||||
@@ -222,12 +222,12 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
// Publish messages
|
||||
if (message.retry_count_ == 0) {
|
||||
if (message.packet_id_ == 0) {
|
||||
shell.printfln((" [%02d] (Pub) topic=%s payload=%s"), message.id_, topic, content->payload.c_str());
|
||||
shell.printfln(" [%02d] (Pub) topic=%s payload=%s", message.id_, topic, content->payload.c_str());
|
||||
} else {
|
||||
shell.printfln((" [%02d] (Pub) topic=%s payload=%s (pid %d)"), message.id_, topic, content->payload.c_str(), message.packet_id_);
|
||||
shell.printfln(" [%02d] (Pub) topic=%s payload=%s (pid %d)", message.id_, topic, content->payload.c_str(), message.packet_id_);
|
||||
}
|
||||
} else {
|
||||
shell.printfln((" [%02d] (Pub) topic=%s payload=%s (pid %d, retry #%d)"),
|
||||
shell.printfln(" [%02d] (Pub) topic=%s payload=%s (pid %d, retry #%d)",
|
||||
message.id_,
|
||||
topic,
|
||||
content->payload.c_str(),
|
||||
@@ -236,7 +236,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
|
||||
}
|
||||
} else {
|
||||
// Subscribe messages
|
||||
shell.printfln((" [%02d] (Sub) topic=%s"), message.id_, topic);
|
||||
shell.printfln(" [%02d] (Sub) topic=%s", message.id_, topic);
|
||||
}
|
||||
}
|
||||
shell.println();
|
||||
@@ -264,7 +264,7 @@ void Mqtt::on_message(const char * topic, const char * payload, size_t len) cons
|
||||
|
||||
#if defined(EMSESP_DEBUG)
|
||||
if (len) {
|
||||
LOG_DEBUG(("Received topic `%s` => payload `%s` (length %d)"), topic, message, len);
|
||||
LOG_DEBUG("Received topic `%s` => payload `%s` (length %d)", topic, message, len);
|
||||
} else {
|
||||
LOG_DEBUG("Received topic `%s`", topic);
|
||||
}
|
||||
@@ -554,7 +554,7 @@ void Mqtt::on_connect() {
|
||||
doc["version"] = EMSESP_APP_VERSION;
|
||||
#ifndef EMSESP_STANDALONE
|
||||
if (WiFi.status() == WL_CONNECTED) {
|
||||
doc["connection"] = ("WiFi");
|
||||
doc["connection"] = "WiFi";
|
||||
doc["hostname"] = WiFi.getHostname();
|
||||
doc["SSID"] = WiFi.SSID();
|
||||
doc["BSSID"] = WiFi.BSSIDstr();
|
||||
@@ -567,7 +567,7 @@ void Mqtt::on_connect() {
|
||||
doc["IPv6 address"] = uuid::printable_to_string(WiFi.localIPv6());
|
||||
}
|
||||
} else if (EMSESP::system_.ethernet_connected()) {
|
||||
doc["connection"] = ("Ethernet");
|
||||
doc["connection"] = "Ethernet";
|
||||
doc["hostname"] = ETH.getHostname();
|
||||
doc["MAC"] = ETH.macAddress();
|
||||
doc["IPv4 address"] = uuid::printable_to_string(ETH.localIP()) + "/" + uuid::printable_to_string(ETH.subnetMask());
|
||||
@@ -609,7 +609,7 @@ void Mqtt::on_connect() {
|
||||
LOG_INFO("Queue size: %d", mqtt_messages_.size());
|
||||
for (const auto & message : mqtt_messages_) {
|
||||
auto content = message.content_;
|
||||
LOG_INFO((" [%02d] (%d) topic=%s payload=%s"), message.id_, content->operation, content->topic.c_str(), content->payload.c_str());
|
||||
LOG_INFO(" [%02d] (%d) topic=%s payload=%s", message.id_, content->operation, content->topic.c_str(), content->payload.c_str());
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -857,7 +857,7 @@ void Mqtt::process_queue() {
|
||||
|
||||
// else try and publish it
|
||||
uint16_t packet_id = mqttClient_->publish(topic, mqtt_qos_, message->retain, message->payload.c_str(), message->payload.size(), false, mqtt_message.id_);
|
||||
LOG_DEBUG(("Publishing topic %s (#%02d, retain=%d, retry=%d, size=%d, pid=%d)"),
|
||||
LOG_DEBUG("Publishing topic %s (#%02d, retain=%d, retry=%d, size=%d, pid=%d)",
|
||||
topic,
|
||||
mqtt_message.id_,
|
||||
message->retain,
|
||||
@@ -978,9 +978,9 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice
|
||||
// create entity by add the hc/wwc tag if present, separating with a .
|
||||
char new_entity[50];
|
||||
if (tag >= DeviceValueTAG::TAG_HC1) {
|
||||
snprintf(new_entity, sizeof(new_entity), "%s.%s", EMSdevice::tag_to_string(tag).c_str(), (entity));
|
||||
snprintf(new_entity, sizeof(new_entity), "%s.%s", EMSdevice::tag_to_mqtt(tag).c_str(), entity);
|
||||
} else {
|
||||
snprintf(new_entity, sizeof(new_entity), "%s", (entity));
|
||||
snprintf(new_entity, sizeof(new_entity), "%s", entity);
|
||||
}
|
||||
|
||||
// build unique identifier which will be used in the topic, replacing all . with _ as not to break HA
|
||||
@@ -1140,9 +1140,9 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice
|
||||
// and has no unit of measure or icon
|
||||
if (type == DeviceValueType::BOOL) {
|
||||
char result[10];
|
||||
doc[("payload_on")] = Helpers::render_boolean(result, true);
|
||||
doc[("payload_off")] = Helpers::render_boolean(result, false);
|
||||
doc[sc_ha] = F_(measurement);
|
||||
doc["payload_on"] = Helpers::render_boolean(result, true);
|
||||
doc["payload_off"] = Helpers::render_boolean(result, false);
|
||||
doc[sc_ha] = F_(measurement);
|
||||
} else {
|
||||
// always set the uom
|
||||
if (uom != DeviceValueUOM::NONE) {
|
||||
|
||||
@@ -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);
|
||||
@@ -141,7 +141,7 @@ void RxService::loop() {
|
||||
// length includes the CRC
|
||||
// for EMS+ the type_id has the value + 256. We look for these type of telegrams with F7, F9 and FF in 3rd byte
|
||||
void RxService::add(uint8_t * data, uint8_t length) {
|
||||
if (length < 2) {
|
||||
if (length < 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
|
||||
}
|
||||
|
||||
LOG_ERROR("Last Tx %s operation failed after %d retries. Ignoring request: %s",
|
||||
(operation == Telegram::Operation::TX_WRITE) ? ("Write") : ("Read"),
|
||||
(operation == Telegram::Operation::TX_WRITE) ? "Write" : "Read",
|
||||
MAXIMUM_TX_RETRIES,
|
||||
telegram_last_->to_string().c_str());
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ WebDataService::WebDataService(AsyncWebServer * server, SecurityManager * securi
|
||||
|
||||
// scan devices service
|
||||
void WebDataService::scan_devices(AsyncWebServerRequest * request) {
|
||||
EMSESP::logger().info(F("Scanning devices..."));
|
||||
EMSESP::logger().info("Scanning devices...");
|
||||
EMSESP::scan_devices();
|
||||
request->send(200);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ void WebDataService::write_value(AsyncWebServerRequest * request, JsonVariant &
|
||||
|
||||
// write debug
|
||||
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());
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user