From 8c236746830236a808904846fcb32797a5450cee Mon Sep 17 00:00:00 2001 From: Victor Vostrikov <1998617+gorynychzmey@users.noreply.github.com> Date: Mon, 25 Feb 2019 21:01:18 +0100 Subject: [PATCH] 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 --- src/components/entity/ha-state-label-badge.ts | 5 +++-- src/translations/en.json | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index b8cf388d5c..5222f79adf 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -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}`) || diff --git a/src/translations/en.json b/src/translations/en.json index 2d89fa64ca..ee9cda1ee9 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -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": {