Translate config flow for sensor measurement option in group (#87374)

* Translate config flow

* reset en

* Delete en.json
pull/93841/head
G Johansson 2023-05-31 03:23:47 +02:00 committed by GitHub
parent 5e1c9ba80d
commit 6736ed67ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 10 deletions

View File

@ -24,14 +24,14 @@ from .binary_sensor import CONF_ALL
from .const import CONF_HIDE_MEMBERS, CONF_IGNORE_NON_NUMERIC
_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"),
selector.SelectOptionDict(value="product", label="Product"),
"min",
"max",
"mean",
"median",
"last",
"range",
"sum",
"product",
]
@ -80,13 +80,17 @@ BINARY_SENSOR_CONFIG_SCHEMA = basic_group_config_schema("binary_sensor").extend(
SENSOR_CONFIG_EXTENDS = {
vol.Required(CONF_TYPE): selector.SelectSelector(
selector.SelectSelectorConfig(options=_STATISTIC_MEASURES),
selector.SelectSelectorConfig(
options=_STATISTIC_MEASURES, translation_key=CONF_TYPE
),
),
}
SENSOR_OPTIONS = {
vol.Optional(CONF_IGNORE_NON_NUMERIC, default=False): selector.BooleanSelector(),
vol.Required(CONF_TYPE): selector.SelectSelector(
selector.SelectSelectorConfig(options=_STATISTIC_MEASURES),
selector.SelectSelectorConfig(
options=_STATISTIC_MEASURES, translation_key=CONF_TYPE
),
),
}

View File

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