diff --git a/src/data/automation_i18n.ts b/src/data/automation_i18n.ts index 689561b30d..b0ab6bb9f4 100644 --- a/src/data/automation_i18n.ts +++ b/src/data/automation_i18n.ts @@ -602,7 +602,7 @@ export const describeTrigger = ( // Persistent Notification Trigger if (trigger.platform === "persistent_notification") { - return "When a persistent_notification is updated"; + return "When a persistent notification is updated"; } // Device Trigger diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification.ts index 4f1975a8c7..f2fcb10c86 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification.ts @@ -10,7 +10,31 @@ import { PersistentNotificationTrigger } from "../../../../../data/automation"; import { HomeAssistant } from "../../../../../types"; import { handleChangeEvent } from "../ha-automation-trigger-row"; -const SUPPORTED_UPDATE_TYPES = ["added", "removed", "current", "updated"]; +const SUPPORTED_UPDATE_TYPES: { + value: string; + label: string; +}[] = [ + { + value: "added", + label: + "ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.added", + }, + { + value: "removed", + label: + "ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.removed", + }, + { + value: "current", + label: + "ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.current", + }, + { + value: "updated", + label: + "ui.panel.config.automation.editor.triggers.type.persistent_notification.update_types.updated", + }, +]; const DEFAULT_UPDATE_TYPES = ["added", "removed"]; const DEFAULT_NOTIFICATION_ID = ""; @@ -30,10 +54,8 @@ export class HaPersistentNotificationTrigger extends LitElement { } protected render() { - const { - update_type: updateTypes, - notification_id: notificationId, - } = this.trigger; + const { update_type: updateTypes, notification_id: notificationId } = + this.trigger; return html`
@@ -55,16 +77,18 @@ export class HaPersistentNotificationTrigger extends LitElement { (update_type) => html` - ${update_type} + ${update_type.label}
` - )} + )} + + `; } @@ -80,9 +104,11 @@ export class HaPersistentNotificationTrigger extends LitElement { if (selected === this.trigger.update_type?.includes(updateType)) { return; } - + const updateTypes = this.trigger.update_type ?? []; - const newUpdateTypes = [...updateTypes]; + const newUpdateTypes = this.trigger.update_type + ? [...this.trigger.update_type] + : []; if (selected) { newUpdateTypes.push(updateType); diff --git a/src/translations/en.json b/src/translations/en.json index 44ff7399b6..310e681af0 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2328,7 +2328,13 @@ "persistent_notification": { "label": "Persistent notification", "notification_id": "Notification Id", - "update_type": "Update type" + "update_type": "Update type", + "update_types": { + "added": "added", + "removed": "removed", + "current": "current", + "updated": "updated" + } }, "sun": { "label": "Sun",