diff --git a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts index 7dd201d534..d7dc0d5cfa 100644 --- a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts @@ -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}` diff --git a/src/translations/en.json b/src/translations/en.json index 71b92ad59c..5bb542bf5a 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -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",