Skip to content

Commit a3f05cb

Browse files
committed
/api/custom show {} if no Custom Entities configured instead of an error #1297
1 parent 0ab5732 commit a3f05cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/command.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ uint8_t Command::call(const uint8_t device_type, const char * cmd, const char *
300300
// see if there is a command registered
301301
auto cf = find_command(device_type, device_id, cmd);
302302

303-
// check if its a call to and end-point to a device
303+
// check if its a call to an end-point of a device
304304
// this is used to fetch the attributes of the device entity, or call a command directly
305305
bool single_command = (!value || !strlen(value));
306306
if (single_command) {
@@ -545,7 +545,9 @@ bool Command::device_has_commands(const uint8_t device_type) {
545545
}
546546

547547
if (device_type == EMSdevice::DeviceType::CUSTOM) {
548-
return (EMSESP::webEntityService.count_entities() != 0);
548+
// if there are no custom entities, don't error but return a message
549+
return true;
550+
// return (EMSESP::webCustomEntityService.count_entities() != 0);
549551
}
550552

551553
if (device_type == EMSdevice::DeviceType::TEMPERATURESENSOR) {
@@ -608,7 +610,7 @@ void Command::show_all(uuid::console::Shell & shell) {
608610
show(shell, EMSdevice::DeviceType::SYSTEM, true);
609611

610612
// show Custom
611-
if (EMSESP::webEntityService.has_commands()) {
613+
if (EMSESP::webCustomEntityService.has_commands()) {
612614
shell.print(COLOR_BOLD_ON);
613615
shell.print(COLOR_YELLOW);
614616
shell.printf(" %s: ", EMSdevice::device_type_2_device_name(EMSdevice::DeviceType::CUSTOM));

0 commit comments

Comments
 (0)