Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.history_stats.helpers Namespace Reference

Functions

tuple[datetime.datetime, datetime.datetime] async_calculate_period (datetime.timedelta|None duration, Template|None start_template, Template|None end_template)
 
float floored_timestamp (datetime.datetime incoming_dt)
 
float pretty_ratio (float value, tuple[datetime.datetime, datetime.datetime] period)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string DURATION_END = "end"
 
string DURATION_START = "start"
 

Detailed Description

Helpers to make instant statistics about your history.

Function Documentation

◆ async_calculate_period()

tuple[datetime.datetime, datetime.datetime] homeassistant.components.history_stats.helpers.async_calculate_period ( datetime.timedelta | None  duration,
Template | None  start_template,
Template | None  end_template 
)
Parse the templates and return the period.

Definition at line 22 of file helpers.py.

◆ floored_timestamp()

float homeassistant.components.history_stats.helpers.floored_timestamp ( datetime.datetime  incoming_dt)
Calculate the floored value of a timestamp.

Definition at line 87 of file helpers.py.

◆ pretty_ratio()

float homeassistant.components.history_stats.helpers.pretty_ratio ( float  value,
tuple[datetime.datetime, datetime.datetime]   period 
)
Format the ratio of value / period duration.

Definition at line 76 of file helpers.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.history_stats.helpers._LOGGER = logging.getLogger(__name__)
private

Definition at line 14 of file helpers.py.

◆ DURATION_END

string homeassistant.components.history_stats.helpers.DURATION_END = "end"

Definition at line 18 of file helpers.py.

◆ DURATION_START

string homeassistant.components.history_stats.helpers.DURATION_START = "start"

Definition at line 17 of file helpers.py.