Remove str from switch device class (#83400)
This commit is contained in:
parent
91cf2e2792
commit
8cdadd1552
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Add table
Reference in a new issue