mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Fix logbook reporting unknown states as unavailable (#14359)
Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
This commit is contained in:
parent
681c745e84
commit
ae15dd678b
@ -10,7 +10,7 @@ import { computeStateDomain } from "../common/entity/compute_state_domain";
|
|||||||
import { LocalizeFunc } from "../common/translations/localize";
|
import { LocalizeFunc } from "../common/translations/localize";
|
||||||
import { HaEntityPickerEntityFilterFunc } from "../components/entity/ha-entity-picker";
|
import { HaEntityPickerEntityFilterFunc } from "../components/entity/ha-entity-picker";
|
||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant } from "../types";
|
||||||
import { UNAVAILABLE_STATES } from "./entity";
|
import { UNAVAILABLE, UNKNOWN } from "./entity";
|
||||||
|
|
||||||
const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages";
|
const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages";
|
||||||
export const CONTINUOUS_DOMAINS = ["counter", "proximity", "sensor", "zone"];
|
export const CONTINUOUS_DOMAINS = ["counter", "proximity", "sensor", "zone"];
|
||||||
@ -421,7 +421,11 @@ export const localizeStateMessage = (
|
|||||||
return localize(`${LOGBOOK_LOCALIZE_PATH}.turned_off`);
|
return localize(`${LOGBOOK_LOCALIZE_PATH}.turned_off`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNAVAILABLE_STATES.includes(state)) {
|
if (state === UNKNOWN) {
|
||||||
|
return localize(`${LOGBOOK_LOCALIZE_PATH}.became_unknown`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state === UNAVAILABLE) {
|
||||||
return localize(`${LOGBOOK_LOCALIZE_PATH}.became_unavailable`);
|
return localize(`${LOGBOOK_LOCALIZE_PATH}.became_unavailable`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +391,7 @@
|
|||||||
"turned_on": "turned on",
|
"turned_on": "turned on",
|
||||||
"changed_to_state": "changed to {state}",
|
"changed_to_state": "changed to {state}",
|
||||||
"became_unavailable": "became unavailable",
|
"became_unavailable": "became unavailable",
|
||||||
|
"became_unknown": "became unknown",
|
||||||
"detected_tampering": "detected tampering",
|
"detected_tampering": "detected tampering",
|
||||||
"cleared_tampering": "cleared tampering"
|
"cleared_tampering": "cleared tampering"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user