Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.statistics.config_flow Namespace Reference

Classes

class  StatisticsConfigFlowHandler
 

Functions

vol.Schema get_state_characteristics (SchemaCommonFlowHandler handler)
 
dict[str, Any] validate_options (SchemaCommonFlowHandler handler, dict[str, Any] user_input)
 
None ws_start_preview (HomeAssistant hass, websocket_api.ActiveConnection connection, dict[str, Any] msg)
 

Variables

dictionary CONFIG_FLOW
 
 DATA_SCHEMA_OPTIONS
 
 DATA_SCHEMA_SETUP
 
dictionary OPTIONS_FLOW
 

Detailed Description

Config flow for statistics.

Function Documentation

◆ get_state_characteristics()

vol.Schema homeassistant.components.statistics.config_flow.get_state_characteristics ( SchemaCommonFlowHandler  handler)
Return schema with state characteristics.

Definition at line 54 of file config_flow.py.

◆ validate_options()

dict[str, Any] homeassistant.components.statistics.config_flow.validate_options ( SchemaCommonFlowHandler  handler,
dict[str, Any]   user_input 
)
Validate options selected.

Definition at line 78 of file config_flow.py.

◆ ws_start_preview()

None homeassistant.components.statistics.config_flow.ws_start_preview ( HomeAssistant  hass,
websocket_api.ActiveConnection  connection,
dict[str, Any]  msg 
)
Generate a preview.

Definition at line 173 of file config_flow.py.

Variable Documentation

◆ CONFIG_FLOW

dictionary homeassistant.components.statistics.config_flow.CONFIG_FLOW
Initial value:
1 = {
2  "user": SchemaFlowFormStep(
3  schema=DATA_SCHEMA_SETUP,
4  next_step="state_characteristic",
5  ),
6  "state_characteristic": SchemaFlowFormStep(
7  schema=get_state_characteristics, next_step="options"
8  ),
9  "options": SchemaFlowFormStep(
10  schema=DATA_SCHEMA_OPTIONS,
11  validate_user_input=validate_options,
12  preview="statistics",
13  ),
14 }

Definition at line 125 of file config_flow.py.

◆ DATA_SCHEMA_OPTIONS

homeassistant.components.statistics.config_flow.DATA_SCHEMA_OPTIONS
Initial value:
1 = vol.Schema(
2  {
3  vol.Optional(CONF_SAMPLES_MAX_BUFFER_SIZE): NumberSelector(
4  NumberSelectorConfig(min=0, step=1, mode=NumberSelectorMode.BOX)
5  ),
6  vol.Optional(CONF_MAX_AGE): DurationSelector(
7  DurationSelectorConfig(enable_day=False, allow_negative=False)
8  ),
9  vol.Optional(CONF_KEEP_LAST_SAMPLE, default=False): BooleanSelector(),
10  vol.Optional(CONF_PERCENTILE, default=50): NumberSelector(
11  NumberSelectorConfig(min=1, max=99, step=1, mode=NumberSelectorMode.BOX)
12  ),
13  vol.Optional(CONF_PRECISION, default=DEFAULT_PRECISION): NumberSelector(
14  NumberSelectorConfig(min=0, step=1, mode=NumberSelectorMode.BOX)
15  ),
16  }
17 )

Definition at line 107 of file config_flow.py.

◆ DATA_SCHEMA_SETUP

homeassistant.components.statistics.config_flow.DATA_SCHEMA_SETUP
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(CONF_NAME, default=DEFAULT_NAME): TextSelector(),
4  vol.Required(CONF_ENTITY_ID): EntitySelector(
5  EntitySelectorConfig(domain=[BINARY_SENSOR_DOMAIN, SENSOR_DOMAIN])
6  ),
7  }
8 )

Definition at line 99 of file config_flow.py.

◆ OPTIONS_FLOW

dictionary homeassistant.components.statistics.config_flow.OPTIONS_FLOW
Initial value:
1 = {
2  "init": SchemaFlowFormStep(
3  DATA_SCHEMA_OPTIONS,
4  validate_user_input=validate_options,
5  preview="statistics",
6  ),
7 }

Definition at line 139 of file config_flow.py.