1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-25 05:03:52 +01:00

Add support for Sensor state class (#1835)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Franck Nijhof
2021-06-03 03:49:56 +02:00
committed by GitHub
parent 913ac8b7e8
commit 11fb54c74e
112 changed files with 1237 additions and 269 deletions

View File

@@ -8,6 +8,8 @@ from esphome.const import (
CONF_RANGE,
DEVICE_CLASS_EMPTY,
ICON_MAGNET,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_NONE,
UNIT_MICROTESLA,
UNIT_DEGREES,
ICON_SCREEN_ROTATION,
@@ -78,10 +80,10 @@ def validate_enum(enum_values, units=None, int=True):
field_strength_schema = sensor.sensor_schema(
UNIT_MICROTESLA, ICON_MAGNET, 1, DEVICE_CLASS_EMPTY
UNIT_MICROTESLA, ICON_MAGNET, 1, DEVICE_CLASS_EMPTY, STATE_CLASS_MEASUREMENT
)
heading_schema = sensor.sensor_schema(
UNIT_DEGREES, ICON_SCREEN_ROTATION, 1, DEVICE_CLASS_EMPTY
UNIT_DEGREES, ICON_SCREEN_ROTATION, 1, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
)
CONFIG_SCHEMA = (