publish ha command

This commit is contained in:
proddy
2020-10-20 21:07:19 +02:00
parent 1d1e7f38b6
commit 73008bfe5f
26 changed files with 122 additions and 89 deletions

View File

@@ -121,12 +121,17 @@ void EMSESPShell::add_console_commands() {
commands->add_command(ShellContext::MAIN,
CommandFlags::ADMIN,
flash_string_vector{F_(publish)},
[&](Shell & shell, const std::vector<std::string> & arguments __attribute__((unused))) {
shell.printfln(F("Publishing all data to MQTT"));
EMSESP::publish_all();
flash_string_vector{F_(ha_optional)},
[&](Shell & shell, const std::vector<std::string> & arguments) {
if (arguments.empty()) {
EMSESP::publish_all();
shell.printfln(F("Published all data to MQTT"));
} else {
EMSESP::publish_all(true);
shell.printfln(F("Published all data to MQTT, including HA configs"));
}
});
commands->add_command(ShellContext::MAIN,
CommandFlags::USER,
flash_string_vector{F_(show)},