mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 15:08:10 +01:00
add proper device class to uptime (#3928)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
60717b074e
commit
1000c4466f
1 changed files with 2 additions and 0 deletions
|
@ -6,6 +6,7 @@ from esphome.const import (
|
||||||
STATE_CLASS_TOTAL_INCREASING,
|
STATE_CLASS_TOTAL_INCREASING,
|
||||||
UNIT_SECOND,
|
UNIT_SECOND,
|
||||||
ICON_TIMER,
|
ICON_TIMER,
|
||||||
|
DEVICE_CLASS_DURATION,
|
||||||
)
|
)
|
||||||
|
|
||||||
uptime_ns = cg.esphome_ns.namespace("uptime")
|
uptime_ns = cg.esphome_ns.namespace("uptime")
|
||||||
|
@ -17,6 +18,7 @@ CONFIG_SCHEMA = sensor.sensor_schema(
|
||||||
icon=ICON_TIMER,
|
icon=ICON_TIMER,
|
||||||
accuracy_decimals=0,
|
accuracy_decimals=0,
|
||||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||||
|
device_class=DEVICE_CLASS_DURATION,
|
||||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||||
).extend(cv.polling_component_schema("60s"))
|
).extend(cv.polling_component_schema("60s"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue