mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	add proper device class to uptime (#3928)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
		@@ -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"))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user