show commands always include internal devices.

This commit is contained in:
MichaelDvP
2023-09-19 14:40:59 +02:00
parent e6bcdede73
commit 6ab2135cea

View File

@@ -540,25 +540,21 @@ bool Command::device_has_commands(const uint8_t device_type) {
return true; // we always have System return true; // we always have System
} }
// if there are no entries to scheduler/custom/temperaturesensor/analogsensor, don't error but return a message
if (device_type == EMSdevice::DeviceType::SCHEDULER) { if (device_type == EMSdevice::DeviceType::SCHEDULER) {
return true; // we always have info return true;
// return EMSESP::webSchedulerService.has_commands();
} }
if (device_type == EMSdevice::DeviceType::CUSTOM) { if (device_type == EMSdevice::DeviceType::CUSTOM) {
// if there are no custom entities, don't error but return a message
return true; return true;
// return (EMSESP::webCustomEntityService.count_entities() != 0);
} }
if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR) { if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR) {
return true; // we always have info return true;
// return (EMSESP::temperaturesensor_.have_sensors());
} }
if (device_type == EMSdevice::DeviceType::ANALOGSENSOR) { if (device_type == EMSdevice::DeviceType::ANALOGSENSOR) {
return EMSESP::system_.analog_enabled(); return EMSESP::system_.analog_enabled();
// return (EMSESP::analogsensor_.have_sensors());
} }
for (const auto & emsdevice : EMSESP::emsdevices) { for (const auto & emsdevice : EMSESP::emsdevices) {
@@ -613,7 +609,6 @@ void Command::show_all(uuid::console::Shell & shell) {
show(shell, EMSdevice::DeviceType::SYSTEM, true); show(shell, EMSdevice::DeviceType::SYSTEM, true);
// show Custom // show Custom
// if (EMSESP::webCustomEntityService.has_commands()) {
shell.print(COLOR_BOLD_ON); shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW); shell.print(COLOR_YELLOW);
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::CUSTOM)); shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::CUSTOM));
@@ -623,10 +618,8 @@ void Command::show_all(uuid::console::Shell & shell) {
shell.printf(" commands: %slists all commands %s*", COLOR_BRIGHT_CYAN, COLOR_BRIGHT_RED); shell.printf(" commands: %slists all commands %s*", COLOR_BRIGHT_CYAN, COLOR_BRIGHT_RED);
shell.print(COLOR_RESET); shell.print(COLOR_RESET);
show(shell, EMSdevice::DeviceType::CUSTOM, true); show(shell, EMSdevice::DeviceType::CUSTOM, true);
// }
// show scheduler // show scheduler
// if (EMSESP::webSchedulerService.has_commands()) {
shell.print(COLOR_BOLD_ON); shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW); shell.print(COLOR_YELLOW);
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SCHEDULER)); shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::SCHEDULER));
@@ -636,16 +629,14 @@ void Command::show_all(uuid::console::Shell & shell) {
shell.printf(" commands: %slists all commands %s*", COLOR_BRIGHT_CYAN, COLOR_BRIGHT_RED); shell.printf(" commands: %slists all commands %s*", COLOR_BRIGHT_CYAN, COLOR_BRIGHT_RED);
shell.print(COLOR_RESET); shell.print(COLOR_RESET);
show(shell, EMSdevice::DeviceType::SCHEDULER, true); show(shell, EMSdevice::DeviceType::SCHEDULER, true);
// }
// show sensors // show sensors
// if (EMSESP::temperaturesensor_.have_sensors()) {
shell.print(COLOR_BOLD_ON); shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW); shell.print(COLOR_YELLOW);
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::TEMPERATURESENSOR)); shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::TEMPERATURESENSOR));
shell.print(COLOR_RESET); shell.print(COLOR_RESET);
show(shell, EMSdevice::DeviceType::TEMPERATURESENSOR, true); show(shell, EMSdevice::DeviceType::TEMPERATURESENSOR, true);
// }
if (EMSESP::analogsensor_.analog_enabled()) { if (EMSESP::analogsensor_.analog_enabled()) {
shell.print(COLOR_BOLD_ON); shell.print(COLOR_BOLD_ON);
shell.print(COLOR_YELLOW); shell.print(COLOR_YELLOW);