Add condition description for trigger condition (#13941)

This commit is contained in:
Franck Nijhof 2022-10-02 17:39:15 +02:00 committed by GitHub
parent 4f4a95c04e
commit 176d8567f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,7 @@ const conditions = [
{ condition: "sun", after: "sunset" },
{ condition: "sun", after: "sunrise", offset: "-01:00" },
{ condition: "zone", entity_id: "device_tracker.person", zone: "zone.home" },
{ condition: "trigger", id: "motion" },
{ condition: "time" },
{ condition: "template" },
];

View File

@ -572,6 +572,13 @@ export const describeCondition = (
}`;
}
if (condition.condition === "trigger") {
if (!condition.id) {
return "Trigger condition";
}
return `When triggered by ${condition.id}`;
}
return `${
condition.condition ? condition.condition.replace(/_/g, " ") : "Unknown"
} condition`;