diff --git a/homeassistant/components/demo/fan.py b/homeassistant/components/demo/fan.py index 89256c95468..e70f5efc626 100644 --- a/homeassistant/components/demo/fan.py +++ b/homeassistant/components/demo/fan.py @@ -114,11 +114,11 @@ class BaseDemoFan(FanEntity): self.hass = hass self._unique_id = unique_id self._supported_features = supported_features - self._percentage = None + self._percentage: int | None = None self._preset_modes = preset_modes - self._preset_mode = None - self._oscillating = None - self._direction = None + self._preset_mode: str | None = None + self._oscillating: bool | None = None + self._direction: str | None = None self._name = name if supported_features & SUPPORT_OSCILLATE: self._oscillating = False @@ -141,12 +141,12 @@ class BaseDemoFan(FanEntity): return False @property - def current_direction(self) -> str: + def current_direction(self) -> str | None: """Fan direction.""" return self._direction @property - def oscillating(self) -> bool: + def oscillating(self) -> bool | None: """Oscillating.""" return self._oscillating @@ -257,7 +257,7 @@ class AsyncDemoPercentageFan(BaseDemoFan, FanEntity): async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new preset mode.""" - if preset_mode not in self.preset_modes: + if self.preset_modes is None or preset_mode not in self.preset_modes: raise ValueError( "{preset_mode} is not a valid preset_mode: {self.preset_modes}" ) diff --git a/homeassistant/components/demo/light.py b/homeassistant/components/demo/light.py index 13e15eb274e..9bb3a30686d 100644 --- a/homeassistant/components/demo/light.py +++ b/homeassistant/components/demo/light.py @@ -195,17 +195,17 @@ class DemoLight(LightEntity): return self._color_mode @property - def hs_color(self) -> tuple: + def hs_color(self) -> tuple[float, float]: """Return the hs color value.""" return self._hs_color @property - def rgbw_color(self) -> tuple: + def rgbw_color(self) -> tuple[int, int, int, int]: """Return the rgbw color value.""" return self._rgbw_color @property - def rgbww_color(self) -> tuple: + def rgbww_color(self) -> tuple[int, int, int, int, int]: """Return the rgbww color value.""" return self._rgbww_color diff --git a/homeassistant/components/demo/number.py b/homeassistant/components/demo/number.py index dd22c5f9827..8660604af9e 100644 --- a/homeassistant/components/demo/number.py +++ b/homeassistant/components/demo/number.py @@ -105,13 +105,10 @@ class DemoNumber(NumberEntity): if step is not None: self._attr_step = step - @property - def device_info(self) -> DeviceInfo: - """Return device info.""" - return DeviceInfo( + self._attr_device_info = DeviceInfo( identifiers={ # Serial numbers are unique identifiers within a specific domain - (DOMAIN, self.unique_id) + (DOMAIN, unique_id) }, name=self.name, ) diff --git a/homeassistant/components/demo/remote.py b/homeassistant/components/demo/remote.py index 2e06b009c9c..f2c1ce11b0a 100644 --- a/homeassistant/components/demo/remote.py +++ b/homeassistant/components/demo/remote.py @@ -46,7 +46,7 @@ class DemoRemote(RemoteEntity): self._attr_name = name or DEVICE_DEFAULT_NAME self._attr_is_on = state self._attr_icon = icon - self._last_command_sent = None + self._last_command_sent: str | None = None @property def extra_state_attributes(self) -> dict[str, Any] | None: diff --git a/homeassistant/components/demo/siren.py b/homeassistant/components/demo/siren.py index 32d3de4b497..9cf18a4c902 100644 --- a/homeassistant/components/demo/siren.py +++ b/homeassistant/components/demo/siren.py @@ -54,7 +54,7 @@ class DemoSiren(SirenEntity): def __init__( self, name: str, - available_tones: str | None = None, + available_tones: list[str | int] | None = None, support_volume_set: bool = False, support_duration: bool = False, is_on: bool = True, diff --git a/homeassistant/components/demo/switch.py b/homeassistant/components/demo/switch.py index c61e39d085b..217119e9372 100644 --- a/homeassistant/components/demo/switch.py +++ b/homeassistant/components/demo/switch.py @@ -64,12 +64,8 @@ class DemoSwitch(SwitchEntity): self._attr_is_on = state self._attr_name = name or DEVICE_DEFAULT_NAME self._attr_unique_id = unique_id - - @property - def device_info(self) -> DeviceInfo: - """Return device info.""" - return DeviceInfo( - identifiers={(DOMAIN, self.unique_id)}, + self._attr_device_info = DeviceInfo( + identifiers={(DOMAIN, unique_id)}, name=self.name, ) diff --git a/mypy.ini b/mypy.ini index c5afffd5638..2ad49bfdc4c 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2196,24 +2196,6 @@ ignore_errors = true [mypy-homeassistant.components.deconz.switch] ignore_errors = true -[mypy-homeassistant.components.demo.fan] -ignore_errors = true - -[mypy-homeassistant.components.demo.light] -ignore_errors = true - -[mypy-homeassistant.components.demo.number] -ignore_errors = true - -[mypy-homeassistant.components.demo.remote] -ignore_errors = true - -[mypy-homeassistant.components.demo.siren] -ignore_errors = true - -[mypy-homeassistant.components.demo.switch] -ignore_errors = true - [mypy-homeassistant.components.denonavr.config_flow] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 376f33de65b..f776f1b635b 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -38,12 +38,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.deconz.services", "homeassistant.components.deconz.siren", "homeassistant.components.deconz.switch", - "homeassistant.components.demo.fan", - "homeassistant.components.demo.light", - "homeassistant.components.demo.number", - "homeassistant.components.demo.remote", - "homeassistant.components.demo.siren", - "homeassistant.components.demo.switch", "homeassistant.components.denonavr.config_flow", "homeassistant.components.denonavr.media_player", "homeassistant.components.denonavr.receiver",