mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-29 12:16:39 +00:00
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:
parent
3e28b6f2e2
commit
8c23674683
@ -143,6 +143,7 @@ export class HaStateLabelBadge extends LitElement {
|
|||||||
case "binary_sensor":
|
case "binary_sensor":
|
||||||
case "device_tracker":
|
case "device_tracker":
|
||||||
case "updater":
|
case "updater":
|
||||||
|
case "person":
|
||||||
return stateIcon(state);
|
return stateIcon(state);
|
||||||
case "sun":
|
case "sun":
|
||||||
return state.state === "above_horizon"
|
return state.state === "above_horizon"
|
||||||
@ -158,11 +159,11 @@ export class HaStateLabelBadge extends LitElement {
|
|||||||
private _computeLabel(domain, state, _timerTimeRemaining) {
|
private _computeLabel(domain, state, _timerTimeRemaining) {
|
||||||
if (
|
if (
|
||||||
state.state === "unavailable" ||
|
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
|
// 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
|
// 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 (
|
return (
|
||||||
this.hass!.localize(`state_badge.${domain}.${state.state}`) ||
|
this.hass!.localize(`state_badge.${domain}.${state.state}`) ||
|
||||||
this.hass!.localize(`state_badge.default.${state.state}`) ||
|
this.hass!.localize(`state_badge.default.${state.state}`) ||
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
"mailbox": "Mailbox",
|
"mailbox": "Mailbox",
|
||||||
"media_player": "Media player",
|
"media_player": "Media player",
|
||||||
"notify": "Notify",
|
"notify": "Notify",
|
||||||
|
"person": "Person",
|
||||||
"plant": "Plant",
|
"plant": "Plant",
|
||||||
"proximity": "Proximity",
|
"proximity": "Proximity",
|
||||||
"remote": "Remote",
|
"remote": "Remote",
|
||||||
@ -244,6 +245,10 @@
|
|||||||
"idle": "Idle",
|
"idle": "Idle",
|
||||||
"standby": "Standby"
|
"standby": "Standby"
|
||||||
},
|
},
|
||||||
|
"person": {
|
||||||
|
"home": "Home",
|
||||||
|
"not_home": "Away"
|
||||||
|
},
|
||||||
"plant": {
|
"plant": {
|
||||||
"ok": "[%key:state::binary_sensor::problem::off%]",
|
"ok": "[%key:state::binary_sensor::problem::off%]",
|
||||||
"problem": "[%key:state::binary_sensor::problem::on%]"
|
"problem": "[%key:state::binary_sensor::problem::on%]"
|
||||||
@ -344,6 +349,10 @@
|
|||||||
"device_tracker": {
|
"device_tracker": {
|
||||||
"home": "[%key:state::device_tracker::home%]",
|
"home": "[%key:state::device_tracker::home%]",
|
||||||
"not_home": "[%key:state::device_tracker::not_home%]"
|
"not_home": "[%key:state::device_tracker::not_home%]"
|
||||||
|
},
|
||||||
|
"person": {
|
||||||
|
"home": "[%key:state::person::home%]",
|
||||||
|
"not_home": "[%key:state::person::not_home%]"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ui": {
|
"ui": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user