diff --git a/homeassistant/components/google_assistant/helpers.py b/homeassistant/components/google_assistant/helpers.py index 6f81ddebdb4..0b9b12f2f4c 100644 --- a/homeassistant/components/google_assistant/helpers.py +++ b/homeassistant/components/google_assistant/helpers.py @@ -51,7 +51,7 @@ LOCAL_SDK_MIN_VERSION = AwesomeVersion("2.1.5") @callback def _get_registry_entries( hass: HomeAssistant, entity_id: str -) -> tuple[device_registry.DeviceEntry, area_registry.AreaEntry]: +) -> tuple[device_registry.DeviceEntry | None, area_registry.AreaEntry | None]: """Get registry entries.""" ent_reg = entity_registry.async_get(hass) dev_reg = device_registry.async_get(hass) diff --git a/homeassistant/components/google_assistant/http.py b/homeassistant/components/google_assistant/http.py index 3f3db1f2b5b..84d5e4a3364 100644 --- a/homeassistant/components/google_assistant/http.py +++ b/homeassistant/components/google_assistant/http.py @@ -59,7 +59,7 @@ def _get_homegraph_jwt(time, iss, key): async def _get_homegraph_token( hass: HomeAssistant, jwt_signed: str -) -> dict[str, Any] | list[str, Any] | Any: +) -> dict[str, Any] | list[Any] | Any: headers = { "Authorization": f"Bearer {jwt_signed}", "Content-Type": "application/x-www-form-urlencoded", diff --git a/homeassistant/components/google_assistant/report_state.py b/homeassistant/components/google_assistant/report_state.py index 4e8ac1624cc..737b54c8b1e 100644 --- a/homeassistant/components/google_assistant/report_state.py +++ b/homeassistant/components/google_assistant/report_state.py @@ -3,6 +3,7 @@ from __future__ import annotations from collections import deque import logging +from typing import Any from homeassistant.const import MATCH_ALL from homeassistant.core import CALLBACK_TYPE, HassJob, HomeAssistant, callback @@ -28,7 +29,7 @@ def async_enable_report_state(hass: HomeAssistant, google_config: AbstractConfig """Enable state reporting.""" checker = None unsub_pending: CALLBACK_TYPE | None = None - pending = deque([{}]) + pending: deque[dict[str, Any]] = deque([{}]) async def report_states(now=None): """Report the states.""" diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 42fc43197ea..ee41dd0c678 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -176,6 +176,8 @@ def _next_selected(items: list[str], selected: str | None) -> str | None: If selected is missing in items, None is returned """ + if selected is None: + return None try: index = items.index(selected) except ValueError: @@ -188,7 +190,7 @@ def _next_selected(items: list[str], selected: str | None) -> str | None: class _Trait: """Represents a Trait inside Google Assistant skill.""" - commands = [] + commands: list[str] = [] @staticmethod def might_2fa(domain, features, device_class): @@ -1701,7 +1703,7 @@ class InputSelectorTrait(_Trait): name = TRAIT_INPUTSELECTOR commands = [COMMAND_INPUT, COMMAND_NEXT_INPUT, COMMAND_PREVIOUS_INPUT] - SYNONYMS = {} + SYNONYMS: dict[str, list[str]] = {} @staticmethod def supported(domain, features, device_class, _): @@ -2197,7 +2199,7 @@ class MediaStateTrait(_Trait): """ name = TRAIT_MEDIA_STATE - commands = [] + commands: list[str] = [] activity_lookup = { STATE_OFF: "INACTIVE", @@ -2314,7 +2316,7 @@ class SensorStateTrait(_Trait): } name = TRAIT_SENSOR_STATE - commands = [] + commands: list[str] = [] @classmethod def supported(cls, domain, features, device_class, _): diff --git a/mypy.ini b/mypy.ini index f29bcf92720..5c5675bcb37 100644 --- a/mypy.ini +++ b/mypy.ini @@ -2662,18 +2662,6 @@ ignore_errors = true [mypy-homeassistant.components.evohome.water_heater] ignore_errors = true -[mypy-homeassistant.components.google_assistant.helpers] -ignore_errors = true - -[mypy-homeassistant.components.google_assistant.http] -ignore_errors = true - -[mypy-homeassistant.components.google_assistant.report_state] -ignore_errors = true - -[mypy-homeassistant.components.google_assistant.trait] -ignore_errors = true - [mypy-homeassistant.components.hassio] ignore_errors = true diff --git a/script/hassfest/mypy_config.py b/script/hassfest/mypy_config.py index f058cfd391f..a1955c51993 100644 --- a/script/hassfest/mypy_config.py +++ b/script/hassfest/mypy_config.py @@ -29,10 +29,6 @@ IGNORED_MODULES: Final[list[str]] = [ "homeassistant.components.evohome", "homeassistant.components.evohome.climate", "homeassistant.components.evohome.water_heater", - "homeassistant.components.google_assistant.helpers", - "homeassistant.components.google_assistant.http", - "homeassistant.components.google_assistant.report_state", - "homeassistant.components.google_assistant.trait", "homeassistant.components.hassio", "homeassistant.components.hassio.auth", "homeassistant.components.hassio.binary_sensor",