mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Move trend imports to top level (#27507)
This commit is contained in:
parent
a712c9b9f5
commit
d516bc44fa
@ -3,6 +3,7 @@ from collections import deque
|
|||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
@ -17,9 +18,9 @@ from homeassistant.const import (
|
|||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_ENTITY_ID,
|
CONF_ENTITY_ID,
|
||||||
CONF_FRIENDLY_NAME,
|
CONF_FRIENDLY_NAME,
|
||||||
STATE_UNKNOWN,
|
|
||||||
STATE_UNAVAILABLE,
|
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
|
STATE_UNAVAILABLE,
|
||||||
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -207,8 +208,6 @@ class SensorTrend(BinarySensorDevice):
|
|||||||
|
|
||||||
This need run inside executor.
|
This need run inside executor.
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
timestamps = np.array([t for t, _ in self.samples])
|
timestamps = np.array([t for t, _ in self.samples])
|
||||||
values = np.array([s for _, s in self.samples])
|
values = np.array([s for _, s in self.samples])
|
||||||
coeffs = np.polyfit(timestamps, values, 1)
|
coeffs = np.polyfit(timestamps, values, 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user