Use sensor constants in recorder (#50906)
Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
parent
391b2f8ccd
commit
fd2e640c74
1 changed files with 10 additions and 2 deletions
|
@ -6,14 +6,22 @@ import itertools
|
|||
from statistics import fmean
|
||||
|
||||
from homeassistant.components.recorder import history, statistics
|
||||
from homeassistant.components.sensor import ATTR_STATE_CLASS, STATE_CLASS_MEASUREMENT
|
||||
from homeassistant.components.sensor import (
|
||||
ATTR_STATE_CLASS,
|
||||
DEVICE_CLASS_ENERGY,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
)
|
||||
from homeassistant.const import ATTR_DEVICE_CLASS
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
DEVICE_CLASS_STATISTICS = {"temperature": {"mean", "min", "max"}, "energy": {"sum"}}
|
||||
DEVICE_CLASS_STATISTICS = {
|
||||
DEVICE_CLASS_TEMPERATURE: {"mean", "min", "max"},
|
||||
DEVICE_CLASS_ENERGY: {"sum"},
|
||||
}
|
||||
|
||||
|
||||
def _get_entities(hass: HomeAssistant) -> list[tuple[str, str]]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue