From 8222b783a310f72e71250c9cdc4cfca55ac9d21e Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Mon, 4 Apr 2022 17:55:09 +0200 Subject: [PATCH] Improve min_max translation strings (#69248) Co-authored-by: Martin Hjelmare --- homeassistant/components/min_max/config_flow.py | 9 ++++++++- homeassistant/components/min_max/strings.json | 12 +++++++++--- .../components/min_max/translations/en.json | 12 +++++++++--- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/min_max/config_flow.py b/homeassistant/components/min_max/config_flow.py index 64d982dec92..6dab7cc000c 100644 --- a/homeassistant/components/min_max/config_flow.py +++ b/homeassistant/components/min_max/config_flow.py @@ -16,7 +16,14 @@ from homeassistant.helpers.schema_config_entry_flow import ( from .const import CONF_ENTITY_IDS, CONF_ROUND_DIGITS, DOMAIN -_STATISTIC_MEASURES = ["last", "max", "mean", "min", "median"] +_STATISTIC_MEASURES = [ + {"value": "min", "label": "Minimum"}, + {"value": "max", "label": "Maximum"}, + {"value": "mean", "label": "Arithmetic mean"}, + {"value": "median", "label": "Median"}, + {"value": "last", "label": "Most recently updated"}, +] + OPTIONS_SCHEMA = vol.Schema( { diff --git a/homeassistant/components/min_max/strings.json b/homeassistant/components/min_max/strings.json index 13f81365a25..596dd2250eb 100644 --- a/homeassistant/components/min_max/strings.json +++ b/homeassistant/components/min_max/strings.json @@ -3,24 +3,30 @@ "config": { "step": { "user": { - "description": "Precision controls the number of decimal digits when the statistics characteristic is mean or median.", + "title": "Add min / max / mean / median sensor", + "description": "Create a sensor that calculates a min, max, mean or median value from a list of input sensors.", "data": { "entity_ids": "Input entities", "name": "Name", "round_digits": "Precision", "type": "Statistic characteristic" + }, + "data_description": { + "round_digits": "Controls the number of decimal digits in the output when the statistics characteristic is mean or median." } } } }, "options": { "step": { - "options": { - "description": "[%key:component::min_max::config::step::user::description%]", + "init": { "data": { "entity_ids": "[%key:component::min_max::config::step::user::data::entity_ids%]", "round_digits": "[%key:component::min_max::config::step::user::data::round_digits%]", "type": "[%key:component::min_max::config::step::user::data::type%]" + }, + "data_description": { + "round_digits": "[%key:component::min_max::config::step::user::data_description::round_digits%]" } } } diff --git a/homeassistant/components/min_max/translations/en.json b/homeassistant/components/min_max/translations/en.json index 65cdce569a8..8cc0d41c419 100644 --- a/homeassistant/components/min_max/translations/en.json +++ b/homeassistant/components/min_max/translations/en.json @@ -8,19 +8,25 @@ "round_digits": "Precision", "type": "Statistic characteristic" }, - "description": "Precision controls the number of decimal digits when the statistics characteristic is mean or median." + "data_description": { + "round_digits": "Controls the number of decimal digits in the output when the statistics characteristic is mean or median." + }, + "description": "Create a sensor that calculates a min, max, mean or median value from a list of input sensors.", + "title": "Add min / max / mean / median sensor" } } }, "options": { "step": { - "options": { + "init": { "data": { "entity_ids": "Input entities", "round_digits": "Precision", "type": "Statistic characteristic" }, - "description": "Precision controls the number of decimal digits when the statistics characteristic is mean or median." + "data_description": { + "round_digits": "Controls the number of decimal digits in the output when the statistics characteristic is mean or median." + } } } },