Use proper constants for "unavailable" checks (#6922)

* Use proper constants for "unavailable"

* Additional usage of constants
This commit is contained in:
Philip Allgaier
2020-09-10 22:59:45 +02:00
committed by GitHub
parent aa4bc2ce03
commit 2139a80a7a
11 changed files with 31 additions and 22 deletions

View File

@@ -11,7 +11,7 @@ import "../../../components/ha-date-input";
import type { HaDateInput } from "../../../components/ha-date-input";
import "../../../components/paper-time-input";
import type { PaperTimeInput } from "../../../components/paper-time-input";
import { UNAVAILABLE_STATES } from "../../../data/entity";
import { UNAVAILABLE_STATES, UNKNOWN } from "../../../data/entity";
import { setInputDateTimeValue } from "../../../data/input_datetime";
import type { HomeAssistant } from "../../../types";
import { hasConfigOrEntityChanged } from "../common/has-changed";
@@ -70,10 +70,10 @@ class HuiInputDatetimeEntityRow extends LitElement implements LovelaceRow {
? html`
<paper-time-input
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
.hour=${stateObj.state === "unknown"
.hour=${stateObj.state === UNKNOWN
? ""
: ("0" + stateObj.attributes.hour).slice(-2)}
.min=${stateObj.state === "unknown"
.min=${stateObj.state === UNKNOWN
? ""
: ("0" + stateObj.attributes.minute).slice(-2)}
.amPm=${false}