cleanup, adapt comments, packages

This commit is contained in:
MichaelDvP
2023-09-20 17:56:39 +02:00
parent 5c484d58dc
commit dcdd8d9e44
6 changed files with 9 additions and 15 deletions

View File

@@ -69,7 +69,7 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"rollup-plugin-visualizer": "^5.9.2", "rollup-plugin-visualizer": "^5.9.2",
"terser": "^5.19.4", "terser": "^5.20.0",
"vite": "^4.4.9", "vite": "^4.4.9",
"vite-plugin-svgr": "^4.0.0", "vite-plugin-svgr": "^4.0.0",
"vite-tsconfig-paths": "^4.2.1" "vite-tsconfig-paths": "^4.2.1"

View File

@@ -1869,7 +1869,7 @@ __metadata:
react-toastify: ^9.1.3 react-toastify: ^9.1.3
rollup-plugin-visualizer: ^5.9.2 rollup-plugin-visualizer: ^5.9.2
sockette: ^2.0.6 sockette: ^2.0.6
terser: ^5.19.4 terser: ^5.20.0
typesafe-i18n: ^5.26.2 typesafe-i18n: ^5.26.2
typescript: ^5.2.2 typescript: ^5.2.2
vite: ^4.4.9 vite: ^4.4.9
@@ -6056,9 +6056,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"terser@npm:^5.19.4": "terser@npm:^5.20.0":
version: 5.19.4 version: 5.20.0
resolution: "terser@npm:5.19.4" resolution: "terser@npm:5.20.0"
dependencies: dependencies:
"@jridgewell/source-map": ^0.3.3 "@jridgewell/source-map": ^0.3.3
acorn: ^8.8.2 acorn: ^8.8.2
@@ -6066,7 +6066,7 @@ __metadata:
source-map-support: ~0.5.20 source-map-support: ~0.5.20
bin: bin:
terser: bin/terser terser: bin/terser
checksum: 39c6687609f5b9061f2fb82bee02d2f9d7756fcb5bd50c67da1482f52cf5977e03e0c5df5cb4ce17e549428024c8859075137c461ec4a9ae8cf91a505759255a checksum: ab70d1009fc9d39b89b3fbe5be12d55ade4574df0978de53e046ce109f45d5623fcbbddcb70453e1d95d4967338dab9e41bcff94c1ec636a27c52ef7f6db3936
languageName: node languageName: node
linkType: hard linkType: hard

View File

@@ -625,7 +625,6 @@ void AnalogSensor::publish_values(const bool force) {
// searches by name // searches by name
bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) const { bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) const {
if (sensors_.empty()) { if (sensors_.empty()) {
// output["message"] = "no entries";
return true; return true;
} }
// make a copy of the string command for parsing // make a copy of the string command for parsing
@@ -684,10 +683,9 @@ bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const i
} }
// creates JSON doc from values // creates JSON doc from values
// returns false if there are no sensors // returns true if there are no sensors
bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject & output) const { bool AnalogSensor::command_info(const char * value, const int8_t id, JsonObject & output) const {
if (sensors_.empty()) { if (sensors_.empty()) {
// output["message"] = "no entries";
return true; return true;
} }

View File

@@ -360,10 +360,9 @@ bool TemperatureSensor::command_commands(const char * value, const int8_t id, Js
} }
// creates JSON doc from values // creates JSON doc from values
// returns false if there are no sensors // returns true if there are no sensors
bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonObject & output) { bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonObject & output) {
if (sensors_.empty()) { if (sensors_.empty()) {
// output["message"] = "no entries";
return true; return true;
} }
@@ -390,7 +389,6 @@ bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonOb
// called from emsesp.cpp, similar to the emsdevice->get_value_info // called from emsesp.cpp, similar to the emsdevice->get_value_info
bool TemperatureSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) { bool TemperatureSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) {
if (sensors_.empty()) { if (sensors_.empty()) {
// output["message"] = "no entries";
return true; return true;
} }
// make a copy of the string command for parsing // make a copy of the string command for parsing

View File

@@ -247,10 +247,9 @@ bool WebCustomEntityService::get_value_info(JsonObject & output, const char * cm
} }
return true; return true;
} }
// if no entries, return a message instead of an error // if no entries, return empty json
// https://github.com/emsesp/EMS-ESP32/issues/1297 // https://github.com/emsesp/EMS-ESP32/issues/1297
if (customEntityItems->size() == 0) { if (customEntityItems->size() == 0) {
// output["message"] = "no entries";
return true; return true;
} }
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) { if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {

View File

@@ -144,7 +144,6 @@ bool WebSchedulerService::get_value_info(JsonObject & output, const char * cmd)
return true; return true;
} }
if (scheduleItems->size() == 0) { if (scheduleItems->size() == 0) {
// output["message"] = "no entries";
return true; return true;
} }
if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) { if (strlen(cmd) == 0 || Helpers::toLower(cmd) == F_(values) || Helpers::toLower(cmd) == F_(info)) {