Show moon phase icon in state-label-badge (#7194)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Ian Richardson 2020-10-08 09:37:51 -05:00 committed by GitHub
parent 3bf6205ff7
commit 426a7ac8dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,7 +110,9 @@ export class HaStateLabelBadge extends LitElement {
return null;
case "sensor":
default:
return state.state === UNKNOWN
return state.attributes.device_class === "moon__phase"
? null
: state.state === UNKNOWN
? "-"
: state.attributes.unit_of_measurement
? state.state
@ -162,7 +164,9 @@ export class HaStateLabelBadge extends LitElement {
? "hass:timer-outline"
: "hass:timer-off-outline";
default:
return null;
return state?.attributes.device_class === "moon__phase"
? stateIcon(state)
: null;
}
}