Skip to content

Commit

Permalink
Translate config flow for sensor measurement option in group (#87374)
Browse files Browse the repository at this point in the history
* Translate config flow

* reset en

* Delete en.json
  • Loading branch information
gjohansson-ST committed May 31, 2023
1 parent 5e1c9ba commit 6736ed6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
24 changes: 14 additions & 10 deletions homeassistant/components/group/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
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",
]


Expand Down Expand Up @@ -80,13 +80,17 @@ async def binary_sensor_options_schema(handler: SchemaCommonFlowHandler) -> vol.

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
),
),
}

Expand Down
14 changes: 14 additions & 0 deletions homeassistant/components/group/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}

0 comments on commit 6736ed6

Please sign in to comment.