From 76a6371705dcd57483e55dcc03435ae867c184d2 Mon Sep 17 00:00:00 2001 From: Greg Laabs Date: Sat, 22 Jul 2017 23:00:30 -0700 Subject: [PATCH] Bugfix: remove superfluous domain filter This filter is already applied later in the function by the `filters` object, where it is conditionally applied when appropriate. This fixes the problem where we get a domain filter even when searching for a single entity_id, which needlessly harms the query's performance. --- homeassistant/components/history.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/homeassistant/components/history.py b/homeassistant/components/history.py index 9800a15c16b..5b57c628a19 100644 --- a/homeassistant/components/history.py +++ b/homeassistant/components/history.py @@ -123,8 +123,7 @@ def get_states(hass, utc_point_in_time, entity_ids=None, run=None, func.max(States.state_id).label('max_state_id') ).filter( (States.created >= run.start) & - (States.created < utc_point_in_time) & - (~States.domain.in_(IGNORE_DOMAINS))) + (States.created < utc_point_in_time)) if filters: most_recent_state_ids = filters.apply(most_recent_state_ids,