diff --git a/homeassistant/components/philips_js/__init__.py b/homeassistant/components/philips_js/__init__.py index 29e92a6ffe3..8ff20d8b104 100644 --- a/homeassistant/components/philips_js/__init__.py +++ b/homeassistant/components/philips_js/__init__.py @@ -108,6 +108,8 @@ class PluggableAction: class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]): """Coordinator to update data.""" + config_entry: ConfigEntry + def __init__(self, hass, api: PhilipsTV, options: Mapping) -> None: """Set up the coordinator.""" self.api = api @@ -136,8 +138,7 @@ class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]): @property def unique_id(self) -> str: """Return the system descriptor.""" - entry: ConfigEntry = self.config_entry - assert entry + entry = self.config_entry if entry.unique_id: return entry.unique_id assert entry.entry_id diff --git a/homeassistant/components/philips_js/config_flow.py b/homeassistant/components/philips_js/config_flow.py index 9785aaf54a3..39f1c78b070 100644 --- a/homeassistant/components/philips_js/config_flow.py +++ b/homeassistant/components/philips_js/config_flow.py @@ -23,7 +23,7 @@ from .const import CONF_ALLOW_NOTIFY, CONF_SYSTEM, CONST_APP_ID, CONST_APP_NAME, async def _validate_input( hass: core.HomeAssistant, host: str, api_version: int -) -> tuple[dict, PhilipsTV]: +) -> PhilipsTV: """Validate the user input allows us to connect.""" hub = PhilipsTV(host, api_version) @@ -44,7 +44,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): def __init__(self) -> None: """Initialize flow.""" super().__init__() - self._current = {} + self._current: dict[str, Any] = {} self._hub: PhilipsTV | None = None self._pair_state: Any = None @@ -62,7 +62,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): """Attempt to pair with device.""" assert self._hub - errors = {} + errors: dict[str, str] = {} schema = vol.Schema( { vol.Required(CONF_PIN): str, diff --git a/homeassistant/components/philips_js/device_trigger.py b/homeassistant/components/philips_js/device_trigger.py index 69a5932576f..eca3158fb15 100644 --- a/homeassistant/components/philips_js/device_trigger.py +++ b/homeassistant/components/philips_js/device_trigger.py @@ -65,6 +65,10 @@ async def async_attach_trigger( } device = registry.async_get(config[CONF_DEVICE_ID]) + if device is None: + raise HomeAssistantError( + f"Device id {config[CONF_DEVICE_ID]} not found in registry" + ) for config_entry_id in device.config_entries: coordinator: PhilipsTVDataUpdateCoordinator = hass.data[DOMAIN].get( config_entry_id diff --git a/homeassistant/components/philips_js/light.py b/homeassistant/components/philips_js/light.py index 5a32d2954a4..ab4f04a8ddc 100644 --- a/homeassistant/components/philips_js/light.py +++ b/homeassistant/components/philips_js/light.py @@ -146,7 +146,7 @@ class PhilipsTVLightEntity( self._hs = None self._brightness = None self._cache_keys = None - self._last_selected_effect: AmbilightEffect = None + self._last_selected_effect: AmbilightEffect | None = None super().__init__(coordinator) self._attr_supported_color_modes = {ColorMode.HS, ColorMode.ONOFF} diff --git a/homeassistant/components/philips_js/media_player.py b/homeassistant/components/philips_js/media_player.py index 27cf41abd4f..3d63865fe31 100644 --- a/homeassistant/components/philips_js/media_player.py +++ b/homeassistant/components/philips_js/media_player.py @@ -80,8 +80,7 @@ class PhilipsTVMediaPlayer( ) -> None: """Initialize the Philips TV.""" self._tv = coordinator.api - self._sources = {} - self._channels = {} + self._sources: dict[str, str] = {} self._supports = SUPPORT_PHILIPS_JS self._system = coordinator.system self._attr_name = coordinator.system["name"] diff --git a/mypy.ini b/mypy.ini index b139a40976b..87dd265eeef 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2746,21 +2746,6 @@ ignore_errors = true [mypy-homeassistant.components.onvif.sensor] ignore_errors = true -[mypy-homeassistant.components.philips_js] -ignore_errors = true - -[mypy-homeassistant.components.philips_js.config_flow] -ignore_errors = true - -[mypy-homeassistant.components.philips_js.device_trigger] -ignore_errors = true - -[mypy-homeassistant.components.philips_js.light] -ignore_errors = true - -[mypy-homeassistant.components.philips_js.media_player] -ignore_errors = true - [mypy-homeassistant.components.plex.media_player] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index 55ed01aaa63..4e11028d574 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -57,11 +57,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.onvif.camera", "homeassistant.components.onvif.device", "homeassistant.components.onvif.sensor", - "homeassistant.components.philips_js", - "homeassistant.components.philips_js.config_flow", - "homeassistant.components.philips_js.device_trigger", - "homeassistant.components.philips_js.light", - "homeassistant.components.philips_js.media_player", "homeassistant.components.plex.media_player", "homeassistant.components.profiler", "homeassistant.components.solaredge.config_flow",