diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 7387685187a..6eb2a275e18 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -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 diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 1908a85ed9b..4f7b9053ca0 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -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], ), ], ),