From 7453b7df63d7fe6a330d1612fa0d0ff5a69886f5 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:03:18 +0200 Subject: [PATCH] Improve mqtt schema typing (#120407) --- homeassistant/components/mqtt/climate.py | 4 ++-- homeassistant/components/mqtt/cover.py | 4 ++-- homeassistant/components/mqtt/device_tracker.py | 4 ++-- homeassistant/components/mqtt/event.py | 4 ++-- homeassistant/components/mqtt/fan.py | 4 ++-- homeassistant/components/mqtt/humidifier.py | 4 ++-- homeassistant/components/mqtt/image.py | 4 ++-- homeassistant/components/mqtt/lawn_mower.py | 4 ++-- homeassistant/components/mqtt/light/__init__.py | 6 +++--- homeassistant/components/mqtt/light/schema_basic.py | 4 ++-- homeassistant/components/mqtt/light/schema_json.py | 4 ++-- .../components/mqtt/light/schema_template.py | 4 ++-- homeassistant/components/mqtt/mixins.py | 7 ++++--- homeassistant/components/mqtt/models.py | 11 +++++++---- homeassistant/components/mqtt/number.py | 4 ++-- homeassistant/components/mqtt/select.py | 4 ++-- homeassistant/components/mqtt/sensor.py | 4 ++-- homeassistant/components/mqtt/siren.py | 4 ++-- homeassistant/components/mqtt/text.py | 4 ++-- homeassistant/components/mqtt/update.py | 4 ++-- homeassistant/components/mqtt/vacuum.py | 4 ++-- homeassistant/components/mqtt/valve.py | 4 ++-- homeassistant/components/mqtt/water_heater.py | 4 ++-- 23 files changed, 54 insertions(+), 50 deletions(-) diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index f63c9ecc7ae..7873b056889 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -47,7 +47,7 @@ from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.template import Template -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.unit_conversion import TemperatureConverter from . import subscription @@ -550,7 +550,7 @@ class MqttClimate(MqttTemperatureControlEntity, ClimateEntity): _enable_turn_on_off_backwards_compatibility = False @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index bd79c0f9470..2d1b64d002a 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -31,7 +31,7 @@ from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.service_info.mqtt import ReceivePayloadType -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads from homeassistant.util.percentage import ( percentage_to_ranged_value, @@ -246,7 +246,7 @@ class MqttCover(MqttEntity, CoverEntity): _tilt_range: tuple[int, int] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/device_tracker.py b/homeassistant/components/mqtt/device_tracker.py index 082483a64a3..b2aeb4c0fc1 100644 --- a/homeassistant/components/mqtt/device_tracker.py +++ b/homeassistant/components/mqtt/device_tracker.py @@ -27,7 +27,7 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_BASE_SCHEMA @@ -103,7 +103,7 @@ class MqttDeviceTracker(MqttEntity, TrackerEntity): _value_template: Callable[[ReceivePayloadType], ReceivePayloadType] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/event.py b/homeassistant/components/mqtt/event.py index 15b70b1b98d..5e801fda54b 100644 --- a/homeassistant/components/mqtt/event.py +++ b/homeassistant/components/mqtt/event.py @@ -19,7 +19,7 @@ from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME, CONF_VALUE_TEMPLAT from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object from . import subscription @@ -94,7 +94,7 @@ class MqttEvent(MqttEntity, EventEntity): _template: Callable[[ReceivePayloadType, PayloadSentinel], ReceivePayloadType] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index 1933b5e17b5..dd777bd178e 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -30,7 +30,7 @@ from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.template import Template -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.percentage import ( percentage_to_ranged_value, ranged_value_to_percentage, @@ -226,7 +226,7 @@ class MqttFan(MqttEntity, FanEntity): _speed_range: tuple[int, int] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/humidifier.py b/homeassistant/components/mqtt/humidifier.py index 8f7eda21240..a4510ee5951 100644 --- a/homeassistant/components/mqtt/humidifier.py +++ b/homeassistant/components/mqtt/humidifier.py @@ -33,7 +33,7 @@ from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.template import Template -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_RW_SCHEMA @@ -212,7 +212,7 @@ class MqttHumidifier(MqttEntity, HumidifierEntity): _topic: dict[str, Any] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/image.py b/homeassistant/components/mqtt/image.py index d5930a1668a..30fd102764d 100644 --- a/homeassistant/components/mqtt/image.py +++ b/homeassistant/components/mqtt/image.py @@ -20,7 +20,7 @@ from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.httpx_client import get_async_client from homeassistant.helpers.service_info.mqtt import ReceivePayloadType -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, VolSchemaType from homeassistant.util import dt as dt_util from . import subscription @@ -117,7 +117,7 @@ class MqttImage(MqttEntity, ImageEntity): MqttEntity.__init__(self, hass, config, config_entry, discovery_data) @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/lawn_mower.py b/homeassistant/components/mqtt/lawn_mower.py index 853ce743f12..a74d278401c 100644 --- a/homeassistant/components/mqtt/lawn_mower.py +++ b/homeassistant/components/mqtt/lawn_mower.py @@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_BASE_SCHEMA @@ -103,7 +103,7 @@ class MqttLawnMower(MqttEntity, LawnMowerEntity, RestoreEntity): _value_template: Callable[[ReceivePayloadType], ReceivePayloadType] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/light/__init__.py b/homeassistant/components/mqtt/light/__init__.py index ac2d1ff14ee..04619b08e11 100644 --- a/homeassistant/components/mqtt/light/__init__.py +++ b/homeassistant/components/mqtt/light/__init__.py @@ -10,7 +10,7 @@ from homeassistant.components import light from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from ..mixins import async_setup_entity_entry_helper from .schema import CONF_SCHEMA, MQTT_LIGHT_SCHEMA_SCHEMA @@ -33,7 +33,7 @@ from .schema_template import ( def validate_mqtt_light_discovery(config_value: dict[str, Any]) -> ConfigType: """Validate MQTT light schema for discovery.""" - schemas = { + schemas: dict[str, VolSchemaType] = { "basic": DISCOVERY_SCHEMA_BASIC, "json": DISCOVERY_SCHEMA_JSON, "template": DISCOVERY_SCHEMA_TEMPLATE, @@ -44,7 +44,7 @@ def validate_mqtt_light_discovery(config_value: dict[str, Any]) -> ConfigType: def validate_mqtt_light_modern(config_value: dict[str, Any]) -> ConfigType: """Validate MQTT light schema for setup from configuration.yaml.""" - schemas = { + schemas: dict[str, VolSchemaType] = { "basic": PLATFORM_SCHEMA_MODERN_BASIC, "json": PLATFORM_SCHEMA_MODERN_JSON, "template": PLATFORM_SCHEMA_MODERN_TEMPLATE, diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index 565cf4d7132..b0ffae4e328 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -39,7 +39,7 @@ from homeassistant.const import ( from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType import homeassistant.util.color as color_util from .. import subscription @@ -249,7 +249,7 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity): _optimistic_xy_color: bool @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA_BASIC diff --git a/homeassistant/components/mqtt/light/schema_json.py b/homeassistant/components/mqtt/light/schema_json.py index 1d3ad3a6ef0..58fde4a3800 100644 --- a/homeassistant/components/mqtt/light/schema_json.py +++ b/homeassistant/components/mqtt/light/schema_json.py @@ -51,7 +51,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.json import json_dumps from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType import homeassistant.util.color as color_util from homeassistant.util.json import json_loads_object from homeassistant.util.yaml import dump as yaml_dump @@ -267,7 +267,7 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity): _deprecated_color_handling: bool = False @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA_JSON diff --git a/homeassistant/components/mqtt/light/schema_template.py b/homeassistant/components/mqtt/light/schema_template.py index d414f219241..c35b0e6ced9 100644 --- a/homeassistant/components/mqtt/light/schema_template.py +++ b/homeassistant/components/mqtt/light/schema_template.py @@ -31,7 +31,7 @@ from homeassistant.const import ( from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import ConfigType, TemplateVarsType +from homeassistant.helpers.typing import ConfigType, TemplateVarsType, VolSchemaType import homeassistant.util.color as color_util from .. import subscription @@ -120,7 +120,7 @@ class MqttLightTemplate(MqttEntity, LightEntity, RestoreEntity): _topics: dict[str, str | None] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA_TEMPLATE diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index 55b76337db0..0800aeb8ee4 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -53,6 +53,7 @@ from homeassistant.helpers.typing import ( ConfigType, DiscoveryInfoType, UndefinedType, + VolSchemaType, ) from homeassistant.util.json import json_loads from homeassistant.util.yaml import dump as yaml_dump @@ -247,8 +248,8 @@ def async_setup_entity_entry_helper( entity_class: type[MqttEntity] | None, domain: str, async_add_entities: AddEntitiesCallback, - discovery_schema: vol.Schema, - platform_schema_modern: vol.Schema, + discovery_schema: VolSchemaType, + platform_schema_modern: VolSchemaType, schema_class_mapping: dict[str, type[MqttEntity]] | None = None, ) -> None: """Set up entity creation dynamically through MQTT discovery.""" @@ -1187,7 +1188,7 @@ class MqttEntity( @staticmethod @abstractmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" def _set_entity_name(self, config: ConfigType) -> None: diff --git a/homeassistant/components/mqtt/models.py b/homeassistant/components/mqtt/models.py index f26ed196663..e5a9a9c44da 100644 --- a/homeassistant/components/mqtt/models.py +++ b/homeassistant/components/mqtt/models.py @@ -11,15 +11,18 @@ from enum import StrEnum import logging from typing import TYPE_CHECKING, Any, TypedDict -import voluptuous as vol - from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME, Platform from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback from homeassistant.exceptions import ServiceValidationError, TemplateError from homeassistant.helpers import template from homeassistant.helpers.entity import Entity from homeassistant.helpers.service_info.mqtt import ReceivePayloadType -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, TemplateVarsType +from homeassistant.helpers.typing import ( + ConfigType, + DiscoveryInfoType, + TemplateVarsType, + VolSchemaType, +) from homeassistant.util.hass_dict import HassKey if TYPE_CHECKING: @@ -418,7 +421,7 @@ class MqttData: platforms_loaded: set[Platform | str] = field(default_factory=set) reload_dispatchers: list[CALLBACK_TYPE] = field(default_factory=list) reload_handlers: dict[str, CALLBACK_TYPE] = field(default_factory=dict) - reload_schema: dict[str, vol.Schema] = field(default_factory=dict) + reload_schema: dict[str, VolSchemaType] = field(default_factory=dict) state_write_requests: EntityTopicState = field(default_factory=EntityTopicState) subscriptions_to_restore: list[Subscription] = field(default_factory=list) tags: dict[str, dict[str, MQTTTagScanner]] = field(default_factory=dict) diff --git a/homeassistant/components/mqtt/number.py b/homeassistant/components/mqtt/number.py index 50a4f398c7d..e8f2cf0cfe4 100644 --- a/homeassistant/components/mqtt/number.py +++ b/homeassistant/components/mqtt/number.py @@ -28,7 +28,7 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_RW_SCHEMA @@ -133,7 +133,7 @@ class MqttNumber(MqttEntity, RestoreNumber): _value_template: Callable[[ReceivePayloadType], ReceivePayloadType] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/select.py b/homeassistant/components/mqtt/select.py index ea0a0886082..5cc7a586c71 100644 --- a/homeassistant/components/mqtt/select.py +++ b/homeassistant/components/mqtt/select.py @@ -15,7 +15,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_RW_SCHEMA @@ -84,7 +84,7 @@ class MqttSelect(MqttEntity, SelectEntity, RestoreEntity): _optimistic: bool = False @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index 043bc9a5c0e..4a41f486831 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -33,7 +33,7 @@ from homeassistant.core import CALLBACK_TYPE, HomeAssistant, State, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.event import async_call_later -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util import dt as dt_util from . import subscription @@ -185,7 +185,7 @@ class MqttSensor(MqttEntity, RestoreSensor): await MqttEntity.async_will_remove_from_hass(self) @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/siren.py b/homeassistant/components/mqtt/siren.py index 49645f7b1b4..9f1466dd95d 100644 --- a/homeassistant/components/mqtt/siren.py +++ b/homeassistant/components/mqtt/siren.py @@ -32,7 +32,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.json import json_dumps from homeassistant.helpers.template import Template -from homeassistant.helpers.typing import ConfigType, TemplateVarsType +from homeassistant.helpers.typing import ConfigType, TemplateVarsType, VolSchemaType from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object from . import subscription @@ -142,7 +142,7 @@ class MqttSiren(MqttEntity, SirenEntity): _optimistic: bool @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/text.py b/homeassistant/components/mqtt/text.py index 73adaa2cb0c..0b122dec7b5 100644 --- a/homeassistant/components/mqtt/text.py +++ b/homeassistant/components/mqtt/text.py @@ -22,7 +22,7 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_RW_SCHEMA @@ -121,7 +121,7 @@ class MqttTextEntity(MqttEntity, TextEntity): _value_template: Callable[[ReceivePayloadType], ReceivePayloadType] @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/update.py b/homeassistant/components/mqtt/update.py index eecd7b967de..4b87e0ef7da 100644 --- a/homeassistant/components/mqtt/update.py +++ b/homeassistant/components/mqtt/update.py @@ -19,7 +19,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads from . import subscription @@ -107,7 +107,7 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity): return super().entity_picture @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/vacuum.py b/homeassistant/components/mqtt/vacuum.py index eac3556a28b..8aa42270016 100644 --- a/homeassistant/components/mqtt/vacuum.py +++ b/homeassistant/components/mqtt/vacuum.py @@ -35,7 +35,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue from homeassistant.helpers.json import json_dumps -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, VolSchemaType from homeassistant.util.json import json_loads_object from . import subscription @@ -281,7 +281,7 @@ class MqttStateVacuum(MqttEntity, StateVacuumEntity): MqttEntity.__init__(self, hass, config, config_entry, discovery_data) @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/valve.py b/homeassistant/components/mqtt/valve.py index f3c76462269..02127dfc19c 100644 --- a/homeassistant/components/mqtt/valve.py +++ b/homeassistant/components/mqtt/valve.py @@ -28,7 +28,7 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads from homeassistant.util.percentage import ( percentage_to_ranged_value, @@ -163,7 +163,7 @@ class MqttValve(MqttEntity, ValveEntity): _tilt_optimistic: bool @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA diff --git a/homeassistant/components/mqtt/water_heater.py b/homeassistant/components/mqtt/water_heater.py index ac3c8aacc92..13b0478210f 100644 --- a/homeassistant/components/mqtt/water_heater.py +++ b/homeassistant/components/mqtt/water_heater.py @@ -38,7 +38,7 @@ from homeassistant.core import HomeAssistant, callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.template import Template -from homeassistant.helpers.typing import ConfigType +from homeassistant.helpers.typing import ConfigType, VolSchemaType from homeassistant.util.unit_conversion import TemperatureConverter from .climate import MqttTemperatureControlEntity @@ -188,7 +188,7 @@ class MqttWaterHeater(MqttTemperatureControlEntity, WaterHeaterEntity): _attr_target_temperature_high: float | None = None @staticmethod - def config_schema() -> vol.Schema: + def config_schema() -> VolSchemaType: """Return the config schema.""" return DISCOVERY_SCHEMA