Add translations for type select selector min_max config and option flow (#86213)

* Add translations for type select selector min_max

* Remove redundant labels
pull/86525/head
Jan Bouwhuis 2023-01-24 13:11:11 +01:00 committed by GitHub
parent 14d3911bfd
commit 1b4fda2321
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 9 deletions

View File

@ -19,13 +19,13 @@ from homeassistant.helpers.schema_config_entry_flow import (
from .const import CONF_ENTITY_IDS, CONF_ROUND_DIGITS, DOMAIN
_STATISTIC_MEASURES = [
selector.SelectOptionDict(value="min", label="Minimum"),
selector.SelectOptionDict(value="max", label="Maximum"),
selector.SelectOptionDict(value="mean", label="Arithmetic mean"),
selector.SelectOptionDict(value="median", label="Median"),
selector.SelectOptionDict(value="last", label="Most recently updated"),
selector.SelectOptionDict(value="range", label="Statistical range"),
selector.SelectOptionDict(value="sum", label="Sum"),
"min",
"max",
"mean",
"median",
"last",
"range",
"sum",
]
@ -38,7 +38,9 @@ OPTIONS_SCHEMA = vol.Schema(
),
),
vol.Required(CONF_TYPE): selector.SelectSelector(
selector.SelectSelectorConfig(options=_STATISTIC_MEASURES),
selector.SelectSelectorConfig(
options=_STATISTIC_MEASURES, translation_key=CONF_TYPE
),
),
vol.Required(CONF_ROUND_DIGITS, default=2): selector.NumberSelector(
selector.NumberSelectorConfig(

View File

@ -30,5 +30,18 @@
}
}
}
},
"selector": {
"type": {
"options": {
"min": "Minimum",
"max": "Maximum",
"mean": "Arithmetic mean",
"median": "Median",
"last": "Most recently updated",
"range": "Statistical range",
"sum": "Sum"
}
}
}
}

View File

@ -30,5 +30,18 @@
}
}
},
"title": "Combine the state of several sensors"
"title": "Combine the state of several sensors",
"selector": {
"type": {
"options":{
"min": "Minimum",
"max": "Maximum",
"mean": "Arithmetic mean",
"median": "Median",
"last": "Most recently updated",
"range": "Statistical range",
"sum": "Sum"
}
}
}
}