Fix unknown event type bug (#17426)

* Fix unknown event type bug

* Update src/data/logbook.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Joost Lekkerkerker 2023-07-31 13:31:39 +02:00 committed by GitHub
parent 0ee231ee85
commit a5cd350d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -346,16 +346,18 @@ export const localizeStateMessage = (
break; break;
case "event": { case "event": {
const event_type = const event_type = computeAttributeValueDisplay(
computeAttributeValueDisplay(
hass!.localize, hass!.localize,
stateObj, stateObj,
hass.locale, hass.locale,
hass.config, hass.config,
hass.entities, hass.entities,
"event_type" "event_type"
)?.toString() || )?.toString();
localize(`${LOGBOOK_LOCALIZE_PATH}.detected_unknown_event`);
if (!event_type) {
return localize(`${LOGBOOK_LOCALIZE_PATH}.detected_unknown_event`);
}
return localize(`${LOGBOOK_LOCALIZE_PATH}.detected_event`, { return localize(`${LOGBOOK_LOCALIZE_PATH}.detected_event`, {
event_type: autoCaseNoun(event_type, hass.language), event_type: autoCaseNoun(event_type, hass.language),