Assign entity categories
Gold rule entity-category: configuration and diagnostic entities have an entity category.
This is a Gold rule. In quality_scale.yaml, it is called entity-category.
Entities that are not the main purpose of a device get an entity category. There are two:
EntityCategory.CONFIG: an entity that changes the configuration of a device, like a switch that turns off the status LED.EntityCategory.DIAGNOSTIC: an entity that shows information about the device itself, like its signal strength, uptime, or firmware version.
Entities that are the reason someone has the device, like the temperature of a thermostat, keep the default: no category.
Home Assistant uses the category to decide where an entity shows up. Auto-generated dashboards leave configuration and diagnostic entities out, and the device page shows them in their own sections. Without categories, the signal strength of a sensor ends up next to the temperature on the dashboard of every user.
class MySignalStrengthSensor(SensorEntity):
"""The signal strength of My device."""
_attr_entity_category = EntityCategory.DIAGNOSTIC
_attr_device_class = SensorDeviceClass.SIGNAL_STRENGTHWith entity descriptions, set entity_category on the description instead.
Checked in review.
If the integration has no entities, or all its entities are primary entities for which no category is right, this rule does not apply.