Add labels to Person (#2844)

* Added label for Person

* Added icon for Person

* Changed comment for label

* Added translation for person

* Updated translation for person
This commit is contained in:
Victor Vostrikov 2019-02-25 21:01:18 +01:00 committed by Paulus Schoutsen
parent 3e28b6f2e2
commit 8c23674683
2 changed files with 12 additions and 2 deletions

View File

@ -143,6 +143,7 @@ export class HaStateLabelBadge extends LitElement {
case "binary_sensor":
case "device_tracker":
case "updater":
case "person":
return stateIcon(state);
case "sun":
return state.state === "above_horizon"
@ -158,11 +159,11 @@ export class HaStateLabelBadge extends LitElement {
private _computeLabel(domain, state, _timerTimeRemaining) {
if (
state.state === "unavailable" ||
["device_tracker", "alarm_control_panel"].includes(domain)
["device_tracker", "alarm_control_panel", "person"].includes(domain)
) {
// Localize the state with a special state_badge namespace, which has variations of
// the state translations that are truncated to fit within the badge label. Translations
// are only added for device_tracker and alarm_control_panel.
// are only added for device_tracker, alarm_control_panel and person.
return (
this.hass!.localize(`state_badge.${domain}.${state.state}`) ||
this.hass!.localize(`state_badge.default.${state.state}`) ||

View File

@ -27,6 +27,7 @@
"mailbox": "Mailbox",
"media_player": "Media player",
"notify": "Notify",
"person": "Person",
"plant": "Plant",
"proximity": "Proximity",
"remote": "Remote",
@ -244,6 +245,10 @@
"idle": "Idle",
"standby": "Standby"
},
"person": {
"home": "Home",
"not_home": "Away"
},
"plant": {
"ok": "[%key:state::binary_sensor::problem::off%]",
"problem": "[%key:state::binary_sensor::problem::on%]"
@ -344,6 +349,10 @@
"device_tracker": {
"home": "[%key:state::device_tracker::home%]",
"not_home": "[%key:state::device_tracker::not_home%]"
},
"person": {
"home": "[%key:state::person::home%]",
"not_home": "[%key:state::person::not_home%]"
}
},
"ui": {