mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
rename endpoint to entities to be consistent
This commit is contained in:
@@ -36,7 +36,7 @@ void WebEntityService::begin() {
|
|||||||
// this creates the entity file, saving it to the FS
|
// this creates the entity file, saving it to the FS
|
||||||
// and also calls when the Entity web page is refreshed
|
// and also calls when the Entity web page is refreshed
|
||||||
void WebEntity::read(WebEntity & webEntity, JsonObject & root) {
|
void WebEntity::read(WebEntity & webEntity, JsonObject & root) {
|
||||||
JsonArray entity = root.createNestedArray("entity");
|
JsonArray entity = root.createNestedArray("entities");
|
||||||
uint8_t counter = 0;
|
uint8_t counter = 0;
|
||||||
for (const EntityItem & entityItem : webEntity.entityItems) {
|
for (const EntityItem & entityItem : webEntity.entityItems) {
|
||||||
JsonObject ei = entity.createNestedObject();
|
JsonObject ei = entity.createNestedObject();
|
||||||
@@ -61,8 +61,8 @@ StateUpdateResult WebEntity::update(JsonObject & root, WebEntity & webEntity) {
|
|||||||
}
|
}
|
||||||
webEntity.entityItems.clear();
|
webEntity.entityItems.clear();
|
||||||
|
|
||||||
if (root["entity"].is<JsonArray>()) {
|
if (root["entities"].is<JsonArray>()) {
|
||||||
for (const JsonObject ei : root["entity"].as<JsonArray>()) {
|
for (const JsonObject ei : root["entities"].as<JsonArray>()) {
|
||||||
auto entityItem = EntityItem();
|
auto entityItem = EntityItem();
|
||||||
entityItem.device_id = ei["device_id"]; // send as numeric, will be converted to string in web
|
entityItem.device_id = ei["device_id"]; // send as numeric, will be converted to string in web
|
||||||
entityItem.type_id = ei["type_id"];
|
entityItem.type_id = ei["type_id"];
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define WebEntityService_h
|
#define WebEntityService_h
|
||||||
|
|
||||||
#define EMSESP_ENTITY_FILE "/config/emsespEntity.json"
|
#define EMSESP_ENTITY_FILE "/config/emsespEntity.json"
|
||||||
#define EMSESP_ENTITY_SERVICE_PATH "/rest/entity" // GET and POST
|
#define EMSESP_ENTITY_SERVICE_PATH "/rest/entities" // GET and POST
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user