Add read_only selectors to Statistics Options Flow (#145522)

This commit is contained in:
karwosts 2025-05-23 08:58:45 -07:00 committed by GitHub
parent 102230bf9d
commit 19259d5cad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -106,6 +106,19 @@ DATA_SCHEMA_SETUP = vol.Schema(
)
DATA_SCHEMA_OPTIONS = vol.Schema(
{
vol.Optional(CONF_ENTITY_ID): EntitySelector(
EntitySelectorConfig(read_only=True)
),
vol.Optional(CONF_STATE_CHARACTERISTIC): SelectSelector(
SelectSelectorConfig(
options=list(
set(list(STATS_BINARY_SUPPORT) + list(STATS_NUMERIC_SUPPORT))
),
translation_key=CONF_STATE_CHARACTERISTIC,
mode=SelectSelectorMode.DROPDOWN,
read_only=True,
)
),
vol.Optional(CONF_SAMPLES_MAX_BUFFER_SIZE): NumberSelector(
NumberSelectorConfig(min=0, step=1, mode=NumberSelectorMode.BOX)
),

View File

@ -32,6 +32,8 @@
"options": {
"description": "Read the documentation for further details on how to configure the statistics sensor using these options.",
"data": {
"entity_id": "[%key:component::statistics::config::step::user::data::entity_id%]",
"state_characteristic": "[%key:component::statistics::config::step::state_characteristic::data::state_characteristic%]",
"sampling_size": "Sampling size",
"max_age": "Max age",
"keep_last_sample": "Keep last sample",
@ -39,6 +41,8 @@
"precision": "Precision"
},
"data_description": {
"entity_id": "[%key:component::statistics::config::step::user::data_description::entity_id%]",
"state_characteristic": "[%key:component::statistics::config::step::state_characteristic::data_description::state_characteristic%]",
"sampling_size": "Maximum number of source sensor measurements stored.",
"max_age": "Maximum age of source sensor measurements stored.",
"keep_last_sample": "Defines whether the most recent sampled value should be preserved regardless of the 'Max age' setting.",
@ -60,6 +64,8 @@
"init": {
"description": "[%key:component::statistics::config::step::options::description%]",
"data": {
"entity_id": "[%key:component::statistics::config::step::user::data::entity_id%]",
"state_characteristic": "[%key:component::statistics::config::step::state_characteristic::data::state_characteristic%]",
"sampling_size": "[%key:component::statistics::config::step::options::data::sampling_size%]",
"max_age": "[%key:component::statistics::config::step::options::data::max_age%]",
"keep_last_sample": "[%key:component::statistics::config::step::options::data::keep_last_sample%]",
@ -67,6 +73,8 @@
"precision": "[%key:component::statistics::config::step::options::data::precision%]"
},
"data_description": {
"entity_id": "[%key:component::statistics::config::step::user::data_description::entity_id%]",
"state_characteristic": "[%key:component::statistics::config::step::state_characteristic::data_description::state_characteristic%]",
"sampling_size": "[%key:component::statistics::config::step::options::data_description::sampling_size%]",
"max_age": "[%key:component::statistics::config::step::options::data_description::max_age%]",
"keep_last_sample": "[%key:component::statistics::config::step::options::data_description::keep_last_sample%]",