mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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.json
This commit is contained in:
parent
5bdb20098e
commit
98d2eadb76
@ -1,25 +1,26 @@
|
|||||||
"""Support for statistics for sensor values."""
|
"""Support for statistics for sensor values."""
|
||||||
|
from collections import deque
|
||||||
import logging
|
import logging
|
||||||
import statistics
|
import statistics
|
||||||
from collections import deque
|
|
||||||
|
|
||||||
import voluptuous as vol
|
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.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME,
|
|
||||||
CONF_ENTITY_ID,
|
|
||||||
EVENT_HOMEASSISTANT_START,
|
|
||||||
STATE_UNKNOWN,
|
|
||||||
STATE_UNAVAILABLE,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
|
CONF_ENTITY_ID,
|
||||||
|
CONF_NAME,
|
||||||
|
EVENT_HOMEASSISTANT_START,
|
||||||
|
STATE_UNAVAILABLE,
|
||||||
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.event import async_track_state_change
|
from homeassistant.helpers.event import async_track_state_change
|
||||||
from homeassistant.util import dt as dt_util
|
from homeassistant.util import dt as dt_util
|
||||||
from homeassistant.components.recorder.util import session_scope, execute
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -275,7 +276,6 @@ class StatisticsSensor(Entity):
|
|||||||
If MaxAge is provided then query will restrict to entries younger then
|
If MaxAge is provided then query will restrict to entries younger then
|
||||||
current datetime - MaxAge.
|
current datetime - MaxAge.
|
||||||
"""
|
"""
|
||||||
from homeassistant.components.recorder.models import States
|
|
||||||
|
|
||||||
_LOGGER.debug("%s: initializing values from the database", self.entity_id)
|
_LOGGER.debug("%s: initializing values from the database", self.entity_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user