Add support to entity registry for overriding device_class (#59985)

This commit is contained in:
Erik Montnemery 2021-11-22 17:38:06 +01:00 committed by GitHub
parent 67e13b35db
commit 49a27e12ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 136 additions and 69 deletions

View file

@ -46,7 +46,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
continue
config = {
ATTR_SENSOR_ATTRIBUTES: {},
ATTR_SENSOR_DEVICE_CLASS: entry.device_class,
ATTR_SENSOR_DEVICE_CLASS: entry.device_class or entry.original_device_class,
ATTR_SENSOR_ICON: entry.original_icon,
ATTR_SENSOR_NAME: entry.original_name,
ATTR_SENSOR_STATE: None,