From c2233970987eec63e3e7616c016c110578bcc7d1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 22 Mar 2022 08:49:07 -1000 Subject: [PATCH] Remove unneeded attributes selection from history_states api calls (#68409) --- homeassistant/components/history_stats/sensor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/history_stats/sensor.py b/homeassistant/components/history_stats/sensor.py index b33b7ca4db9..5177d5f5239 100644 --- a/homeassistant/components/history_stats/sensor.py +++ b/homeassistant/components/history_stats/sensor.py @@ -232,14 +232,16 @@ class HistoryStatsSensor(SensorEntity): def _update(self, start, end, now_timestamp, start_timestamp, end_timestamp): # Get history between start and end history_list = history.state_changes_during_period( - self.hass, start, end, str(self._entity_id) + self.hass, start, end, str(self._entity_id), no_attributes=True ) if self._entity_id not in history_list: return # Get the first state - last_state = history.get_state(self.hass, start, self._entity_id) + last_state = history.get_state( + self.hass, start, self._entity_id, no_attributes=True + ) last_state = last_state is not None and last_state in self._entity_states last_time = start_timestamp elapsed = 0