mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-08 10:29:37 +00:00
Fix localize key type errors for states (#14691)
* Replace unavailable state checks with type predicate * Remove localize exceptions related to state * Use literal types for climate attributes * Add fan action to climate tile badge * Use literal types for truncated states in badges * Use literal type for humidifier state * Replace unavailable state checks in calendar and tile card * Avoid string split for truncated key
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { css, html, LitElement, PropertyValues, TemplateResult } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { UNAVAILABLE, UNAVAILABLE_STATES } from "../../../data/entity";
|
||||
import { isUnavailableState, UNAVAILABLE } from "../../../data/entity";
|
||||
import { TextEntity, setValue } from "../../../data/text";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||
@@ -71,7 +71,7 @@ class HuiTextEntityRow extends LitElement implements LovelaceRow {
|
||||
const newValue = ev.target.value;
|
||||
|
||||
// Filter out invalid text states
|
||||
if (newValue && UNAVAILABLE_STATES.includes(newValue)) {
|
||||
if (newValue && isUnavailableState(newValue)) {
|
||||
ev.target.value = stateObj.state;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user