mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Remove str from switch device class (#83400)
This commit is contained in:
parent
91cf2e2792
commit
8cdadd1552
@ -93,17 +93,17 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
class SwitchEntityDescription(ToggleEntityDescription):
|
class SwitchEntityDescription(ToggleEntityDescription):
|
||||||
"""A class that describes switch entities."""
|
"""A class that describes switch entities."""
|
||||||
|
|
||||||
device_class: SwitchDeviceClass | str | None = None
|
device_class: SwitchDeviceClass | None = None
|
||||||
|
|
||||||
|
|
||||||
class SwitchEntity(ToggleEntity):
|
class SwitchEntity(ToggleEntity):
|
||||||
"""Base class for switch entities."""
|
"""Base class for switch entities."""
|
||||||
|
|
||||||
entity_description: SwitchEntityDescription
|
entity_description: SwitchEntityDescription
|
||||||
_attr_device_class: SwitchDeviceClass | str | None
|
_attr_device_class: SwitchDeviceClass | None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_class(self) -> SwitchDeviceClass | str | None:
|
def device_class(self) -> SwitchDeviceClass | None:
|
||||||
"""Return the class of this entity."""
|
"""Return the class of this entity."""
|
||||||
if hasattr(self, "_attr_device_class"):
|
if hasattr(self, "_attr_device_class"):
|
||||||
return self._attr_device_class
|
return self._attr_device_class
|
||||||
|
@ -2269,7 +2269,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||||||
matches=[
|
matches=[
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="device_class",
|
function_name="device_class",
|
||||||
return_type=["SwitchDeviceClass", "str", None],
|
return_type=["SwitchDeviceClass", None],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user