mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Support limits
in sensor card editor (#24358)
* Support `limits` in sensor card editor * Add new translation keys for limit min/max
This commit is contained in:
parent
bb672d0272
commit
db5036aed3
@ -32,6 +32,12 @@ const cardConfigStruct = assign(
|
||||
detail: optional(number()),
|
||||
theme: optional(string()),
|
||||
hours_to_show: optional(number()),
|
||||
limits: optional(
|
||||
object({
|
||||
min: optional(number()),
|
||||
max: optional(number()),
|
||||
})
|
||||
),
|
||||
})
|
||||
);
|
||||
|
||||
@ -83,6 +89,20 @@ const SCHEMA = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "grid",
|
||||
name: "limits",
|
||||
schema: [
|
||||
{
|
||||
name: "min",
|
||||
selector: { number: { mode: "box" } },
|
||||
},
|
||||
{
|
||||
name: "max",
|
||||
selector: { number: { mode: "box" } },
|
||||
},
|
||||
],
|
||||
},
|
||||
] as const;
|
||||
|
||||
@customElement("hui-sensor-card-editor")
|
||||
@ -143,6 +163,14 @@ export class HuiSensorCardEditor
|
||||
return this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.sensor.graph_type"
|
||||
);
|
||||
case "min":
|
||||
return this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.sensor.limit_min"
|
||||
);
|
||||
case "max":
|
||||
return this.hass!.localize(
|
||||
"ui.panel.lovelace.editor.card.sensor.limit_max"
|
||||
);
|
||||
default:
|
||||
return this.hass!.localize(
|
||||
`ui.panel.lovelace.editor.card.generic.${schema.name}`
|
||||
|
@ -7120,7 +7120,9 @@
|
||||
"name": "Sensor",
|
||||
"show_more_detail": "Show more detail",
|
||||
"graph_type": "Graph type",
|
||||
"description": "The Sensor card gives you a quick overview of your sensors state with an optional graph to visualize change over time."
|
||||
"description": "The Sensor card gives you a quick overview of your sensors state with an optional graph to visualize change over time.",
|
||||
"limit_min": "Minimum value",
|
||||
"limit_max": "Maximum value"
|
||||
},
|
||||
"todo-list": {
|
||||
"name": "To-do list",
|
||||
|
Loading…
x
Reference in New Issue
Block a user