mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-13 19:36:26 +03:00
one command function, to save on heap
This commit is contained in:
@@ -102,7 +102,7 @@ void AnalogSensor::start(const bool factory_settings) {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||||
F_(setvalue),
|
F_(setvalue),
|
||||||
[&](const char * value, const int8_t id) { return command_setvalue(value, id); },
|
[&](const char * value, const int8_t id, JsonObject output) { return command_setvalue(value, id); },
|
||||||
FL_(setiovalue_cmd),
|
FL_(setiovalue_cmd),
|
||||||
CommandFlag::ADMIN_ONLY);
|
CommandFlag::ADMIN_ONLY);
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ void AnalogSensor::reload(bool get_nvs) {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::ANALOGSENSOR,
|
EMSdevice::DeviceType::ANALOGSENSOR,
|
||||||
sensor.name,
|
sensor.name,
|
||||||
[&](const char * value, const int8_t id) { return command_setvalue(value, sensor.gpio); },
|
[&](const char * value, const int8_t id, JsonObject output) { return command_setvalue(value, sensor.gpio); },
|
||||||
sensor.type == AnalogType::COUNTER || (sensor.type >= AnalogType::CNT_0 && sensor.type <= AnalogType::CNT_2) ? FL_(counter)
|
sensor.type == AnalogType::COUNTER || (sensor.type >= AnalogType::CNT_0 && sensor.type <= AnalogType::CNT_2) ? FL_(counter)
|
||||||
: sensor.type == AnalogType::DIGITAL_OUT ? FL_(digital_out)
|
: sensor.type == AnalogType::DIGITAL_OUT ? FL_(digital_out)
|
||||||
: sensor.type == AnalogType::RGB ? FL_(RGB)
|
: sensor.type == AnalogType::RGB ? FL_(RGB)
|
||||||
|
|||||||
@@ -443,16 +443,13 @@ uint8_t Command::call(const uint8_t device_type, const char * command, const cha
|
|||||||
// call the function based on command function type
|
// call the function based on command function type
|
||||||
// commands return true or false only (bool)
|
// commands return true or false only (bool)
|
||||||
uint8_t return_code = CommandRet::OK;
|
uint8_t return_code = CommandRet::OK;
|
||||||
if (cf->cmdfunction_json_) {
|
if (cf->cmdfunction_) {
|
||||||
// handle commands that report back a JSON body
|
// JSON-output commands bypass the readonly check; for the rest, reject a write to a read-only entity
|
||||||
return_code = ((cf->cmdfunction_json_)(value, id, output)) ? CommandRet::OK : CommandRet::ERROR;
|
if (!cf->has_json_output_ && !single_command && EMSESP::cmd_is_readonly(device_type, device_id, cmd, id)) {
|
||||||
} else if (cf->cmdfunction_) {
|
|
||||||
// if it's a read only command and we're trying to set a value, return an error
|
|
||||||
if (!single_command && EMSESP::cmd_is_readonly(device_type, device_id, cmd, id)) {
|
|
||||||
return_code = CommandRet::INVALID; // error on readonly or invalid hc
|
return_code = CommandRet::INVALID; // error on readonly or invalid hc
|
||||||
} else {
|
} else {
|
||||||
// call the command...
|
// call the command (the output object is ignored by non-JSON commands)
|
||||||
return_code = ((cf->cmdfunction_)(value, id)) ? CommandRet::OK : CommandRet::ERROR;
|
return_code = ((cf->cmdfunction_)(value, id, output)) ? CommandRet::OK : CommandRet::ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +503,7 @@ void Command::add(const uint8_t device_type, const uint8_t device_id, const char
|
|||||||
flags |= CommandFlag::HIDDEN;
|
flags |= CommandFlag::HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdfunctions_.emplace_back(device_type, device_id, flags, cmd, cb, nullptr, description); // callback for json is nullptr
|
cmdfunctions_.emplace_back(device_type, device_id, flags, false, cmd, cb, description); // not a json-output command
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a command with no json output
|
// add a command with no json output
|
||||||
@@ -516,13 +513,14 @@ void Command::add(const uint8_t device_type, const char * cmd, const cmd_functio
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add a command to the list, which does return a json object as output
|
// add a command to the list, which does return a json object as output
|
||||||
void Command::add(const uint8_t device_type, const char * cmd, const cmd_json_function_p cb, const char * const * description, uint8_t flags) {
|
// these commands bypass the readonly check (they are actions, not entity setters)
|
||||||
|
void Command::add_json(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags) {
|
||||||
// if the command already exists for that device type don't add it
|
// if the command already exists for that device type don't add it
|
||||||
if (find_command(device_type, 0, cmd, flags) != nullptr) {
|
if (find_command(device_type, 0, cmd, flags) != nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdfunctions_.emplace_back(device_type, 0, flags, cmd, nullptr, cb, description); // callback for json is included
|
cmdfunctions_.emplace_back(device_type, 0, flags, true, cmd, cb, description); // json-output command
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if a command exists for that device type
|
// see if a command exists for that device type
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ enum CommandRet : uint8_t {
|
|||||||
NO_VALUE // 6 - no value
|
NO_VALUE // 6 - no value
|
||||||
};
|
};
|
||||||
|
|
||||||
using cmd_function_p = std::function<bool(const char * data, const int8_t id)>;
|
using cmd_function_p = std::function<bool(const char * data, const int8_t id, JsonObject output)>;
|
||||||
using cmd_json_function_p = std::function<bool(const char * data, const int8_t id, JsonObject output)>;
|
|
||||||
|
|
||||||
class Command {
|
class Command {
|
||||||
public:
|
public:
|
||||||
@@ -63,24 +62,24 @@ class Command {
|
|||||||
uint8_t device_type_; // DeviceType::
|
uint8_t device_type_; // DeviceType::
|
||||||
uint8_t device_id_;
|
uint8_t device_id_;
|
||||||
uint8_t flags_; // mqtt flags for command subscriptions
|
uint8_t flags_; // mqtt flags for command subscriptions
|
||||||
|
bool has_json_output_; // true if the command writes JSON output; such commands bypass the readonly check
|
||||||
const char * cmd_;
|
const char * cmd_;
|
||||||
cmd_function_p cmdfunction_;
|
cmd_function_p cmdfunction_;
|
||||||
cmd_json_function_p cmdfunction_json_;
|
|
||||||
const char * const * description_;
|
const char * const * description_;
|
||||||
|
|
||||||
CmdFunction(const uint8_t device_type,
|
CmdFunction(const uint8_t device_type,
|
||||||
const uint8_t device_id,
|
const uint8_t device_id,
|
||||||
const uint8_t flags,
|
const uint8_t flags,
|
||||||
|
const bool has_json_output,
|
||||||
const char * cmd,
|
const char * cmd,
|
||||||
const cmd_function_p cmdfunction,
|
const cmd_function_p cmdfunction,
|
||||||
const cmd_json_function_p cmdfunction_json,
|
|
||||||
const char * const * description)
|
const char * const * description)
|
||||||
: device_type_(device_type)
|
: device_type_(device_type)
|
||||||
, device_id_(device_id)
|
, device_id_(device_id)
|
||||||
, flags_(flags)
|
, flags_(flags)
|
||||||
|
, has_json_output_(has_json_output)
|
||||||
, cmd_(cmd)
|
, cmd_(cmd)
|
||||||
, cmdfunction_(cmdfunction)
|
, cmdfunction_(cmdfunction)
|
||||||
, cmdfunction_json_(cmdfunction_json)
|
|
||||||
, description_(description) {
|
, description_(description) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,12 +115,13 @@ class Command {
|
|||||||
// same for system/temperature/analog devices
|
// same for system/temperature/analog devices
|
||||||
static void
|
static void
|
||||||
add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
|
add(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
|
||||||
// callback function taking value, id and a json object for its output
|
// command that writes a JSON object as its output; bypasses the readonly check
|
||||||
static void add(const uint8_t device_type,
|
static void
|
||||||
const char * cmd,
|
add_json(const uint8_t device_type, const char * cmd, const cmd_function_p cb, const char * const * description, uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
|
||||||
const cmd_json_function_p cb,
|
|
||||||
const char * const * description,
|
static void reserve(size_t num) {
|
||||||
uint8_t flags = CommandFlag::CMD_FLAG_DEFAULT);
|
cmdfunctions_.reserve(num);
|
||||||
|
}
|
||||||
|
|
||||||
static void show_all(uuid::console::Shell & shell);
|
static void show_all(uuid::console::Shell & shell);
|
||||||
static Command::CmdFunction * find_command(const uint8_t device_type, const uint8_t device_id, const char * cmd, const uint8_t flag);
|
static Command::CmdFunction * find_command(const uint8_t device_type, const uint8_t device_id, const char * cmd, const uint8_t flag);
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ class Module {}; // forward declaration
|
|||||||
return +[](emsesp::EMSdevice * dev, const std::shared_ptr<const Telegram> & t) { static_cast<SelfT *>(dev)->__f(t); }; \
|
return +[](emsesp::EMSdevice * dev, const std::shared_ptr<const Telegram> & t) { static_cast<SelfT *>(dev)->__f(t); }; \
|
||||||
}())
|
}())
|
||||||
|
|
||||||
#define MAKE_CF_CB(__f) [&](const char * value, const int8_t id) { return __f(value, id); } // for Command Function callbacks Command::cmd_function_p
|
// for Command Function callbacks (Command::cmd_function_p). The unified callback takes a JsonObject
|
||||||
|
// output which entity/setter commands ignore.
|
||||||
|
#define MAKE_CF_CB(__f) [&](const char * value, const int8_t id, JsonObject output) { return __f(value, id); }
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ void Mqtt::start() {
|
|||||||
initialized_ = true;
|
initialized_ = true;
|
||||||
|
|
||||||
// add the 'publish' command ('call system publish' in console or via API)
|
// add the 'publish' command ('call system publish' in console or via API)
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, FL_(publish_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), MAKE_CF_CB(System::command_publish), FL_(publish_cmd));
|
||||||
|
|
||||||
#if defined(EMSESP_STANDALONE)
|
#if defined(EMSESP_STANDALONE)
|
||||||
Mqtt::on_connect(); // simulate an MQTT connection
|
Mqtt::on_connect(); // simulate an MQTT connection
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void Shower::start() {
|
|||||||
shower_min_duration_ = settings.shower_min_duration; // in seconds
|
shower_min_duration_ = settings.shower_min_duration; // in seconds
|
||||||
});
|
});
|
||||||
|
|
||||||
Command::add(
|
Command::add_json(
|
||||||
EMSdevice::DeviceType::BOILER,
|
EMSdevice::DeviceType::BOILER,
|
||||||
F_(coldshot),
|
F_(coldshot),
|
||||||
[&](const char * value, const int8_t id, JsonObject output) {
|
[&](const char * value, const int8_t id, JsonObject output) {
|
||||||
|
|||||||
@@ -990,22 +990,24 @@ void System::system_check() {
|
|||||||
// commands - takes static function pointers
|
// commands - takes static function pointers
|
||||||
// can be called via Console using 'call system <cmd>'
|
// can be called via Console using 'call system <cmd>'
|
||||||
void System::commands_init() {
|
void System::commands_init() {
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(read), System::command_read, FL_(read_cmd), CommandFlag::ADMIN_ONLY);
|
// Command::reserve(200);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, FL_(send_cmd), CommandFlag::ADMIN_ONLY);
|
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, FL_(fetch_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(read), MAKE_CF_CB(System::command_read), FL_(read_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(sendmail), System::command_sendmail, FL_(sendmail_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), MAKE_CF_CB(System::command_send), FL_(send_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, FL_(restart_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), MAKE_CF_CB(System::command_fetch), FL_(fetch_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(format), System::command_format, FL_(format_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(sendmail), MAKE_CF_CB(System::command_sendmail), FL_(sendmail_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(txpause), System::command_txpause, FL_(txpause_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), MAKE_CF_CB(System::command_restart), FL_(restart_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(led), System::command_led, FL_(led_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(format), MAKE_CF_CB(System::command_format), FL_(format_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), System::command_watch, FL_(watch_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(txpause), MAKE_CF_CB(System::command_txpause), FL_(txpause_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(message), System::command_message, FL_(message_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(led), MAKE_CF_CB(System::command_led), FL_(led_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(watch), MAKE_CF_CB(System::command_watch), FL_(watch_cmd));
|
||||||
|
Command::add_json(EMSdevice::DeviceType::SYSTEM, F_(message), System::command_message, FL_(message_cmd));
|
||||||
#if defined(EMSESP_TEST)
|
#if defined(EMSESP_TEST)
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), System::command_test, FL_(test_cmd));
|
Command::add(EMSdevice::DeviceType::SYSTEM, ("test"), MAKE_CF_CB(System::command_test), FL_(test_cmd));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// these commands will return data in JSON format
|
// these commands will return data in JSON format
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F("response"), System::command_response, FL_(commands_response));
|
Command::add_json(EMSdevice::DeviceType::SYSTEM, F("response"), System::command_response, FL_(commands_response));
|
||||||
|
|
||||||
// MQTT subscribe "ems-esp/system/#"
|
// MQTT subscribe "ems-esp/system/#"
|
||||||
Mqtt::subscribe(EMSdevice::DeviceType::SYSTEM, "system/#", nullptr); // use empty function callback
|
Mqtt::subscribe(EMSdevice::DeviceType::SYSTEM, "system/#", nullptr); // use empty function callback
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ StateUpdateResult WebCommands::update(JsonObject root, WebCommands & webCommands
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::COMMAND,
|
EMSdevice::DeviceType::COMMAND,
|
||||||
webCommands.commandItems.back().name,
|
webCommands.commandItems.back().name,
|
||||||
[name = std::string(webCommands.commandItems.back().name)](const char * value, const int8_t id) {
|
[name = std::string(webCommands.commandItems.back().name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webCommandService.dispatchCommand(name.c_str(), value); // value is optional
|
return EMSESP::webCommandService.dispatchCommand(name.c_str(), value); // value is optional
|
||||||
},
|
},
|
||||||
FL_(command_cmd),
|
FL_(command_cmd),
|
||||||
@@ -442,7 +442,7 @@ void WebCommandService::load_test_data() {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::COMMAND,
|
EMSdevice::DeviceType::COMMAND,
|
||||||
item.name,
|
item.name,
|
||||||
[name = std::string(item.name)](const char * value, const int8_t id) {
|
[name = std::string(item.name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webCommandService.dispatchCommand(name.c_str(), value);
|
return EMSESP::webCommandService.dispatchCommand(name.c_str(), value);
|
||||||
},
|
},
|
||||||
FL_(command_cmd),
|
FL_(command_cmd),
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#define EMSESP_COMMAND_RUNNING_CORE 1
|
#define EMSESP_COMMAND_RUNNING_CORE 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef EMSESP_COMMAND_STACKSIZE
|
#ifndef EMSESP_COMMAND_STACKSIZE
|
||||||
#define EMSESP_COMMAND_STACKSIZE 8192
|
#define EMSESP_COMMAND_STACKSIZE 8192 // needed for TLS
|
||||||
#endif
|
#endif
|
||||||
#ifndef EMSESP_COMMAND_PRIORITY
|
#ifndef EMSESP_COMMAND_PRIORITY
|
||||||
#define EMSESP_COMMAND_PRIORITY 1
|
#define EMSESP_COMMAND_PRIORITY 1
|
||||||
|
|||||||
@@ -145,8 +145,8 @@ StateUpdateResult WebCustomEntity::update(JsonObject root, WebCustomEntity & web
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::CUSTOM,
|
EMSdevice::DeviceType::CUSTOM,
|
||||||
webCustomEntity.customEntityItems.back().name,
|
webCustomEntity.customEntityItems.back().name,
|
||||||
[webCustomEntity](const char * value, const int8_t id) {
|
[name = std::string(webCustomEntity.customEntityItems.back().name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webCustomEntityService.command_setvalue(value, id, webCustomEntity.customEntityItems.back().name);
|
return EMSESP::webCustomEntityService.command_setvalue(value, id, name.c_str());
|
||||||
},
|
},
|
||||||
FL_(entity_cmd),
|
FL_(entity_cmd),
|
||||||
CommandFlag::ADMIN_ONLY);
|
CommandFlag::ADMIN_ONLY);
|
||||||
@@ -796,8 +796,8 @@ void WebCustomEntityService::load_test_data() {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::CUSTOM,
|
EMSdevice::DeviceType::CUSTOM,
|
||||||
webCustomEntity.customEntityItems.back().name,
|
webCustomEntity.customEntityItems.back().name,
|
||||||
[webCustomEntity](const char * value, const int8_t id) {
|
[name = std::string(webCustomEntity.customEntityItems.back().name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webCustomEntityService.command_setvalue(value, id, webCustomEntity.customEntityItems.back().name);
|
return EMSESP::webCustomEntityService.command_setvalue(value, id, name.c_str());
|
||||||
},
|
},
|
||||||
FL_(entity_cmd),
|
FL_(entity_cmd),
|
||||||
CommandFlag::ADMIN_ONLY);
|
CommandFlag::ADMIN_ONLY);
|
||||||
@@ -832,8 +832,8 @@ void WebCustomEntityService::load_test_data() {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::CUSTOM,
|
EMSdevice::DeviceType::CUSTOM,
|
||||||
webCustomEntity.customEntityItems.back().name,
|
webCustomEntity.customEntityItems.back().name,
|
||||||
[webCustomEntity](const char * value, const int8_t id) {
|
[name = std::string(webCustomEntity.customEntityItems.back().name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webCustomEntityService.command_setvalue(value, id, webCustomEntity.customEntityItems.back().name);
|
return EMSESP::webCustomEntityService.command_setvalue(value, id, name.c_str());
|
||||||
},
|
},
|
||||||
FL_(entity_cmd),
|
FL_(entity_cmd),
|
||||||
CommandFlag::ADMIN_ONLY);
|
CommandFlag::ADMIN_ONLY);
|
||||||
@@ -855,8 +855,8 @@ void WebCustomEntityService::load_test_data() {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::CUSTOM,
|
EMSdevice::DeviceType::CUSTOM,
|
||||||
webCustomEntity.customEntityItems.back().name,
|
webCustomEntity.customEntityItems.back().name,
|
||||||
[webCustomEntity](const char * value, const int8_t id) {
|
[name = std::string(webCustomEntity.customEntityItems.back().name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webCustomEntityService.command_setvalue(value, id, webCustomEntity.customEntityItems.back().name);
|
return EMSESP::webCustomEntityService.command_setvalue(value, id, name.c_str());
|
||||||
},
|
},
|
||||||
FL_(entity_cmd),
|
FL_(entity_cmd),
|
||||||
CommandFlag::ADMIN_ONLY);
|
CommandFlag::ADMIN_ONLY);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ StateUpdateResult WebScheduler::update(JsonObject root, WebScheduler & webSchedu
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::SCHEDULER,
|
EMSdevice::DeviceType::SCHEDULER,
|
||||||
webScheduler.scheduleItems.back().name,
|
webScheduler.scheduleItems.back().name,
|
||||||
[name = std::string(webScheduler.scheduleItems.back().name)](const char * value, const int8_t id) {
|
[name = std::string(webScheduler.scheduleItems.back().name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webSchedulerService.command_setvalue(value, id, name.c_str());
|
return EMSESP::webSchedulerService.command_setvalue(value, id, name.c_str());
|
||||||
},
|
},
|
||||||
FL_(schedule_cmd),
|
FL_(schedule_cmd),
|
||||||
@@ -466,7 +466,7 @@ void WebSchedulerService::load_test_data() {
|
|||||||
Command::add(
|
Command::add(
|
||||||
EMSdevice::DeviceType::SCHEDULER,
|
EMSdevice::DeviceType::SCHEDULER,
|
||||||
item.name,
|
item.name,
|
||||||
[name = std::string(item.name)](const char * value, const int8_t id) {
|
[name = std::string(item.name)](const char * value, const int8_t id, JsonObject output) {
|
||||||
return EMSESP::webSchedulerService.command_setvalue(value, id, name.c_str());
|
return EMSESP::webSchedulerService.command_setvalue(value, id, name.c_str());
|
||||||
},
|
},
|
||||||
FL_(schedule_cmd),
|
FL_(schedule_cmd),
|
||||||
|
|||||||
Reference in New Issue
Block a user