show emsesp-devices in system info, add common fields to value_info #2033

This commit is contained in:
MichaelDvP
2024-09-25 18:47:09 +02:00
parent 9ca16bd2c8
commit 83d5b919d6
10 changed files with 57 additions and 35 deletions

View File

@@ -320,9 +320,10 @@ bool WebCustomEntityService::get_value_info(JsonObject output, const char * cmd)
// build the json for specific entity
void WebCustomEntityService::get_value_json(JsonObject output, const CustomEntityItem & entity) {
output["name"] = entity.name;
output["storage"] = entity.ram ? "ram" : "ems";
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
output["name"] = entity.name;
output["fullname"] = entity.name;
output["storage"] = entity.ram ? "ram" : "ems";
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
if (entity.uom > 0) {
output["uom"] = EMSdevice::uom_to_string(entity.uom);
}
@@ -471,15 +472,6 @@ uint8_t WebCustomEntityService::count_entities() {
return count;
}
uint8_t WebCustomEntityService::has_commands() {
uint8_t count = 0;
for (const CustomEntityItem & entity : *customEntityItems_) {
count += entity.writeable ? 1 : 0;
}
return count;
}
// send to dashboard, msgpack don't like serialized, use number
void WebCustomEntityService::generate_value_web(JsonObject output) {
JsonArray data = output["data"].to<JsonArray>();