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

* Add translations for type select selector min_max

* Remove redundant labels
This commit is contained in:
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 from .const import CONF_ENTITY_IDS, CONF_ROUND_DIGITS, DOMAIN
_STATISTIC_MEASURES = [ _STATISTIC_MEASURES = [
selector.SelectOptionDict(value="min", label="Minimum"), "min",
selector.SelectOptionDict(value="max", label="Maximum"), "max",
selector.SelectOptionDict(value="mean", label="Arithmetic mean"), "mean",
selector.SelectOptionDict(value="median", label="Median"), "median",
selector.SelectOptionDict(value="last", label="Most recently updated"), "last",
selector.SelectOptionDict(value="range", label="Statistical range"), "range",
selector.SelectOptionDict(value="sum", label="Sum"), "sum",
] ]
@ -38,7 +38,9 @@ OPTIONS_SCHEMA = vol.Schema(
), ),
), ),
vol.Required(CONF_TYPE): selector.SelectSelector( 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( vol.Required(CONF_ROUND_DIGITS, default=2): selector.NumberSelector(
selector.NumberSelectorConfig( 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"
}
}
}
} }