Move imports to top for statistics (#29223)
* Move imports to top for statistics * Added recorder to manifest.json * Deleted recorder from manifest.json, moved import back into method, added pylint disable comment * Moved recorder util imports away from the top * Move recorder imports to top, add recorder as after_dependency to manifest.jsonpull/29523/head
parent
5bdb20098e
commit
98d2eadb76
|
@ -1,25 +1,26 @@
|
|||
"""Support for statistics for sensor values."""
|
||||
from collections import deque
|
||||
import logging
|
||||
import statistics
|
||||
from collections import deque
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.recorder.models import States
|
||||
from homeassistant.components.recorder.util import execute, session_scope
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
CONF_ENTITY_ID,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
STATE_UNKNOWN,
|
||||
STATE_UNAVAILABLE,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CONF_ENTITY_ID,
|
||||
CONF_NAME,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.components.recorder.util import session_scope, execute
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -275,7 +276,6 @@ class StatisticsSensor(Entity):
|
|||
If MaxAge is provided then query will restrict to entries younger then
|
||||
current datetime - MaxAge.
|
||||
"""
|
||||
from homeassistant.components.recorder.models import States
|
||||
|
||||
_LOGGER.debug("%s: initializing values from the database", self.entity_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue