attributes for all entities

This commit is contained in:
MichaelDvP
2026-07-15 14:00:03 +02:00
parent a80ec9cf7e
commit 5397d5d33a
3 changed files with 10 additions and 11 deletions

View File

@@ -373,8 +373,8 @@ std::string WebCommandService::get_metrics_prometheus() {
void WebCommandService::get_value_json(JsonObject output, const CommandItem & ci) { void WebCommandService::get_value_json(JsonObject output, const CommandItem & ci) {
output["name"] = (const char *)ci.name; output["name"] = (const char *)ci.name;
// output["fullname"] = (const char *)ci.name; output["fullname"] = (const char *)ci.name;
output["type"] = "command"; output["type"] = "string";
output["command"] = ci.cmd; output["command"] = ci.cmd;
output["value"] = ci.value; output["value"] = ci.value;
output["readable"] = true; output["readable"] = true;

View File

@@ -421,9 +421,9 @@ void WebCustomEntityService::get_value_json(JsonObject output, CustomEntityItem
output["fullname"] = (const char *)entity.name; output["fullname"] = (const char *)entity.name;
output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems"; output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems";
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number); output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
// output["readable"] = true; output["readable"] = true;
output["writeable"] = entity.writeable; output["writeable"] = entity.writeable;
// output["visible"] = true; output["visible"] = true;
if (entity.ram == 0) { if (entity.ram == 0) {
output["device_id"] = Helpers::hextoa(entity.device_id); output["device_id"] = Helpers::hextoa(entity.device_id);

View File

@@ -214,10 +214,9 @@ void WebSchedulerService::get_value_json(JsonObject output, const ScheduleItem &
output["time"] = scheduleItem.time; output["time"] = scheduleItem.time;
} }
output["cmd_name"] = scheduleItem.cmd_name; output["cmd_name"] = scheduleItem.cmd_name;
// bool hasName = scheduleItem.name[0] != '\0'; output["readable"] = true;
// output["readable"] = hasName; output["writeable"] = true;
// output["writeable"] = hasName; output["visible"] = true;
// output["visible"] = hasName;
} }
// publish single value // publish single value