Revert "Allow setting an entity's name by its device class" (#93539)

This commit is contained in:
Erik Montnemery 2023-05-25 17:20:54 +02:00 committed by GitHub
parent f7404e2ee0
commit a71c097aeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 35 additions and 141 deletions

View file

@ -14,7 +14,6 @@ from homeassistant.const import (
STATE_ON,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity import DEVICE_CLASS_NAME
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@ -74,11 +73,6 @@ class ModbusBinarySensor(BasePlatform, RestoreEntity, BinarySensorEntity):
# this ensures that idx = bit position of value in result
# polling is done with the base class
name = self._attr_name if self._attr_name else "modbus_sensor"
# DataUpdateCoordinator does not support DEVICE_CLASS_NAME
# the assert satisfies the type checker and will catch attempts
# to use DEVICE_CLASS_NAME in _attr_name.
assert name is not DEVICE_CLASS_NAME
self._coordinator = DataUpdateCoordinator(
hass,
_LOGGER,