Remove str from switch device class (#83400)

This commit is contained in:
Franck Nijhof 2022-12-06 14:50:44 +01:00 committed by GitHub
parent 91cf2e2792
commit 8cdadd1552
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -93,17 +93,17 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
class SwitchEntityDescription(ToggleEntityDescription):
"""A class that describes switch entities."""
device_class: SwitchDeviceClass | str | None = None
device_class: SwitchDeviceClass | None = None
class SwitchEntity(ToggleEntity):
"""Base class for switch entities."""
entity_description: SwitchEntityDescription
_attr_device_class: SwitchDeviceClass | str | None
_attr_device_class: SwitchDeviceClass | None
@property
def device_class(self) -> SwitchDeviceClass | str | None:
def device_class(self) -> SwitchDeviceClass | None:
"""Return the class of this entity."""
if hasattr(self, "_attr_device_class"):
return self._attr_device_class

View file

@ -2269,7 +2269,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
matches=[
TypeHintMatch(
function_name="device_class",
return_type=["SwitchDeviceClass", "str", None],
return_type=["SwitchDeviceClass", None],
),
],
),