diff --git a/homeassistant/components/recorder/statistics.py b/homeassistant/components/recorder/statistics.py index 8025616d246..9f78b0534ba 100644 --- a/homeassistant/components/recorder/statistics.py +++ b/homeassistant/components/recorder/statistics.py @@ -1034,7 +1034,6 @@ def _generate_statistics_during_period_stmt( end_time: datetime | None, metadata_ids: list[int] | None, table: type[StatisticsBase], - types: set[Literal["last_reset", "max", "mean", "min", "state", "sum"]], ) -> StatementLambdaElement: """Prepare a database query for statistics during a given period. @@ -1535,7 +1534,7 @@ def _statistics_during_period_with_session( if "sum" in types: columns = columns.add_columns(table.sum) stmt = _generate_statistics_during_period_stmt( - columns, start_time, end_time, metadata_ids, table, types + columns, start_time, end_time, metadata_ids, table ) stats = cast(Sequence[Row], execute_stmt_lambda_element(session, stmt)) diff --git a/tests/components/recorder/test_statistics.py b/tests/components/recorder/test_statistics.py index ebad039ca45..ff429794315 100644 --- a/tests/components/recorder/test_statistics.py +++ b/tests/components/recorder/test_statistics.py @@ -1246,11 +1246,11 @@ def test_cache_key_for_generate_statistics_during_period_stmt() -> None: """Test cache key for _generate_statistics_during_period_stmt.""" columns = select(StatisticsShortTerm.metadata_id, StatisticsShortTerm.start_ts) stmt = _generate_statistics_during_period_stmt( - columns, dt_util.utcnow(), dt_util.utcnow(), [0], StatisticsShortTerm, {} + columns, dt_util.utcnow(), dt_util.utcnow(), [0], StatisticsShortTerm ) cache_key_1 = stmt._generate_cache_key() stmt2 = _generate_statistics_during_period_stmt( - columns, dt_util.utcnow(), dt_util.utcnow(), [0], StatisticsShortTerm, {} + columns, dt_util.utcnow(), dt_util.utcnow(), [0], StatisticsShortTerm ) cache_key_2 = stmt2._generate_cache_key() assert cache_key_1 == cache_key_2 @@ -1266,7 +1266,6 @@ def test_cache_key_for_generate_statistics_during_period_stmt() -> None: dt_util.utcnow(), [0], StatisticsShortTerm, - {"max", "mean"}, ) cache_key_3 = stmt3._generate_cache_key() assert cache_key_1 != cache_key_3