Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded attributes selection from history_states api calls #68409

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions homeassistant/components/history_stats/sensor.py
Expand Up @@ -232,14 +232,16 @@ async def async_update(self):
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
Expand Down