Remove philips_js from mypy ignore list (#74659)
* Remove philips_js from mypy ignore list * Use class attribute
This commit is contained in:
parent
a6244eea28
commit
c6bff8ae18
7 changed files with 12 additions and 28 deletions
|
@ -108,6 +108,8 @@ class PluggableAction:
|
||||||
class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""Coordinator to update data."""
|
"""Coordinator to update data."""
|
||||||
|
|
||||||
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(self, hass, api: PhilipsTV, options: Mapping) -> None:
|
def __init__(self, hass, api: PhilipsTV, options: Mapping) -> None:
|
||||||
"""Set up the coordinator."""
|
"""Set up the coordinator."""
|
||||||
self.api = api
|
self.api = api
|
||||||
|
@ -136,8 +138,7 @@ class PhilipsTVDataUpdateCoordinator(DataUpdateCoordinator[None]):
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str:
|
||||||
"""Return the system descriptor."""
|
"""Return the system descriptor."""
|
||||||
entry: ConfigEntry = self.config_entry
|
entry = self.config_entry
|
||||||
assert entry
|
|
||||||
if entry.unique_id:
|
if entry.unique_id:
|
||||||
return entry.unique_id
|
return entry.unique_id
|
||||||
assert entry.entry_id
|
assert entry.entry_id
|
||||||
|
|
|
@ -23,7 +23,7 @@ from .const import CONF_ALLOW_NOTIFY, CONF_SYSTEM, CONST_APP_ID, CONST_APP_NAME,
|
||||||
|
|
||||||
async def _validate_input(
|
async def _validate_input(
|
||||||
hass: core.HomeAssistant, host: str, api_version: int
|
hass: core.HomeAssistant, host: str, api_version: int
|
||||||
) -> tuple[dict, PhilipsTV]:
|
) -> PhilipsTV:
|
||||||
"""Validate the user input allows us to connect."""
|
"""Validate the user input allows us to connect."""
|
||||||
hub = PhilipsTV(host, api_version)
|
hub = PhilipsTV(host, api_version)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize flow."""
|
"""Initialize flow."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._current = {}
|
self._current: dict[str, Any] = {}
|
||||||
self._hub: PhilipsTV | None = None
|
self._hub: PhilipsTV | None = None
|
||||||
self._pair_state: Any = None
|
self._pair_state: Any = None
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
"""Attempt to pair with device."""
|
"""Attempt to pair with device."""
|
||||||
assert self._hub
|
assert self._hub
|
||||||
|
|
||||||
errors = {}
|
errors: dict[str, str] = {}
|
||||||
schema = vol.Schema(
|
schema = vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_PIN): str,
|
vol.Required(CONF_PIN): str,
|
||||||
|
|
|
@ -65,6 +65,10 @@ async def async_attach_trigger(
|
||||||
}
|
}
|
||||||
|
|
||||||
device = registry.async_get(config[CONF_DEVICE_ID])
|
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:
|
for config_entry_id in device.config_entries:
|
||||||
coordinator: PhilipsTVDataUpdateCoordinator = hass.data[DOMAIN].get(
|
coordinator: PhilipsTVDataUpdateCoordinator = hass.data[DOMAIN].get(
|
||||||
config_entry_id
|
config_entry_id
|
||||||
|
|
|
@ -146,7 +146,7 @@ class PhilipsTVLightEntity(
|
||||||
self._hs = None
|
self._hs = None
|
||||||
self._brightness = None
|
self._brightness = None
|
||||||
self._cache_keys = None
|
self._cache_keys = None
|
||||||
self._last_selected_effect: AmbilightEffect = None
|
self._last_selected_effect: AmbilightEffect | None = None
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
|
|
||||||
self._attr_supported_color_modes = {ColorMode.HS, ColorMode.ONOFF}
|
self._attr_supported_color_modes = {ColorMode.HS, ColorMode.ONOFF}
|
||||||
|
|
|
@ -80,8 +80,7 @@ class PhilipsTVMediaPlayer(
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the Philips TV."""
|
"""Initialize the Philips TV."""
|
||||||
self._tv = coordinator.api
|
self._tv = coordinator.api
|
||||||
self._sources = {}
|
self._sources: dict[str, str] = {}
|
||||||
self._channels = {}
|
|
||||||
self._supports = SUPPORT_PHILIPS_JS
|
self._supports = SUPPORT_PHILIPS_JS
|
||||||
self._system = coordinator.system
|
self._system = coordinator.system
|
||||||
self._attr_name = coordinator.system["name"]
|
self._attr_name = coordinator.system["name"]
|
||||||
|
|
15
mypy.ini
15
mypy.ini
|
@ -2746,21 +2746,6 @@ ignore_errors = true
|
||||||
[mypy-homeassistant.components.onvif.sensor]
|
[mypy-homeassistant.components.onvif.sensor]
|
||||||
ignore_errors = true
|
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]
|
[mypy-homeassistant.components.plex.media_player]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
|
|
||||||
|
|
|
@ -57,11 +57,6 @@ IGNORED_MODULES: Final[list[str]] = [
|
||||||
"homeassistant.components.onvif.camera",
|
"homeassistant.components.onvif.camera",
|
||||||
"homeassistant.components.onvif.device",
|
"homeassistant.components.onvif.device",
|
||||||
"homeassistant.components.onvif.sensor",
|
"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.plex.media_player",
|
||||||
"homeassistant.components.profiler",
|
"homeassistant.components.profiler",
|
||||||
"homeassistant.components.solaredge.config_flow",
|
"homeassistant.components.solaredge.config_flow",
|
||||||
|
|
Loading…
Add table
Reference in a new issue