Add new sensor/number device classes: altitude, azimuth, height, latitude, longitude, cpu_utilization, memory_utilization, storage_utilization #3561
Replies: 1 comment
-
|
GPS coordinates already are a thing in HA but they aren't a device class. Any sensor with latitude or longitude can be placed on a map. It doesn't make sense to separate them and add a unit of measurement because they wouldn't work on a map. height already exists, it's distance. It covers any measurement that is the unit of a distance. All your percentage ones are covered already with Technically You have AI compairing current patterns in HA, but there's no real reason to add these unique distinctions. Just some blanket AI statement saying "distinct semantics" or "dedicated classes". But what actual benefits do these supply. Please use your own words, not AI. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe your core improvement
This proposes 8 new device classes for
sensorandnumberentities, covering angular positions, vertical measurements, geographic coordinates, and system resource utilization — all common sensor values that currently have no dedicated device class.altitude— Solar/object elevation angle above the horizon°| State class:MEASUREMENTsensor.sun_solar_altitude(sun integration), solar panel tilt trackersazimuth— Compass bearing / directional angle (circular, 0–360°)°| State class:MEASUREMENT_ANGLEsensor.sun_solar_azimuth, wind vane direction, motorised dish bearingheight— Vertical extent (water level, snow depth, sea level rise)UnitOfLength(mm,cm,m,km,in,ft,yd,mi) with automatic metric ↔ imperial conversionMEASUREMENTsensor.tank_water_level(cm),sensor.snow_depth(mm)latitude/longitude— Geographic coordinates from GPS-capable devices°| Precision: 6 decimal places (~11 cm resolution)MEASUREMENT(latitude),MEASUREMENT_ANGLE(longitude)cpu_utilization— CPU load as a percentage%| State class:MEASUREMENTsystem_monitor,netdata, ESPHome system statsmemory_utilization— RAM usage as a percentage%| State class:MEASUREMENTsystem_monitor,netdatastorage_utilization— Disk/storage usage as a percentage%| State class:MEASUREMENTsystem_monitor,synology_dsm,netdataCurrent limitations
All 8 of these sensor types are in widespread use today across multiple integrations, but none have a dedicated device class. The consequences are:
Noneas the device class, or pick the closest approximate class (e.g. misusingdistancefor height) — resulting in wrong icons, wrong labels, and misleading semantics.%sensor that represents battery level, humidity, CPU load, memory usage, or disk usage — they all look the same.storage_utilization.height, the existingdistanceclass is semantically wrong (it implies travel distance) andaltitudewith length units doesn't exist yet — forcing integrations like tank level sensors to either misusedistanceor use no class.Technical benefits
cpu_utilizationexceeds 80% for 5 minutes" or "whenlatitudecrosses a boundary" using the device automation UI, without manually knowing which entity to pick.heightregistersDistanceConverter, enabling automatic metric ↔ imperial conversion (cm → inches) consistent with howdistanceandprecipitationalready work.latitude/longitudeget 6 decimal places (~11 cm GPS resolution);heightgets 1 decimal place in meters;altitude/azimuthget 1 decimal place in degrees.battery,humidity,moisture,cpu_utilization,memory_utilization, andstorage_utilizationare all%— but now each has its own class, making dashboards and statistics meaningful.MEASUREMENT_ANGLEstate class used correctly:azimuthandlongitudeuse the existingMEASUREMENT_ANGLEstate class (introduced specifically for circular/wrapping angle values), ensuring correct handling of 0°/360° wrap-around.Noneor other classes are unaffected.Additional context
affects
homeassistant/components/sensor/const.py,homeassistant/components/number/const.py,homeassistant/components/sensor/strings.jsonDesign decisions worth discussing:
altitudeuses°(degrees) — targeting solar elevation angle. A separate length-based altitude class (meters/feet for GPS elevation) may also be needed, but that use case is partially covered by the newheightclass.longitudeusesMEASUREMENT_ANGLEbecause it wraps at ±180°. Open to using plainMEASUREMENTinstead.cpu_utilization,memory_utilization,storage_utilization) are intentionally separate to allow per-resource filtering in dashboards. A singlesystem_resource_utilizationclass was also considered.Comparable patterns already in core:
azimuthfollows the same pattern as the existingMEASUREMENT_ANGLEstate class introduced for wind direction and similar sensors.heightfollows the same pattern asdistance(same units, same converter) but with distinct semantics.batteryandhumidity— both are%but have dedicated classes.Beta Was this translation helpful? Give feedback.
All reactions