add proper device class to uptime (#3928)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
H. Árkosi Róbert 2022-10-25 08:10:03 +02:00 committed by GitHub
parent 60717b074e
commit 1000c4466f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ from esphome.const import (
STATE_CLASS_TOTAL_INCREASING,
UNIT_SECOND,
ICON_TIMER,
DEVICE_CLASS_DURATION,
)
uptime_ns = cg.esphome_ns.namespace("uptime")
@ -17,6 +18,7 @@ CONFIG_SCHEMA = sensor.sensor_schema(
icon=ICON_TIMER,
accuracy_decimals=0,
state_class=STATE_CLASS_TOTAL_INCREASING,
device_class=DEVICE_CLASS_DURATION,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
).extend(cv.polling_component_schema("60s"))