mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Improve mqtt schema typing (#120407)
This commit is contained in:
parent
62fd692d27
commit
7453b7df63
@ -47,7 +47,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.template import Template
|
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 homeassistant.util.unit_conversion import TemperatureConverter
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -550,7 +550,7 @@ class MqttClimate(MqttTemperatureControlEntity, ClimateEntity):
|
|||||||
_enable_turn_on_off_backwards_compatibility = False
|
_enable_turn_on_off_backwards_compatibility = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
|
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.json import JSON_DECODE_EXCEPTIONS, json_loads
|
||||||
from homeassistant.util.percentage import (
|
from homeassistant.util.percentage import (
|
||||||
percentage_to_ranged_value,
|
percentage_to_ranged_value,
|
||||||
@ -246,7 +246,7 @@ class MqttCover(MqttEntity, CoverEntity):
|
|||||||
_tilt_range: tuple[int, int]
|
_tilt_range: tuple[int, int]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
from .config import MQTT_BASE_SCHEMA
|
from .config import MQTT_BASE_SCHEMA
|
||||||
@ -103,7 +103,7 @@ class MqttDeviceTracker(MqttEntity, TrackerEntity):
|
|||||||
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME, CONF_VALUE_TEMPLAT
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
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 homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -94,7 +94,7 @@ class MqttEvent(MqttEntity, EventEntity):
|
|||||||
_template: Callable[[ReceivePayloadType, PayloadSentinel], ReceivePayloadType]
|
_template: Callable[[ReceivePayloadType, PayloadSentinel], ReceivePayloadType]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.template import Template
|
from homeassistant.helpers.template import Template
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
from homeassistant.util.percentage import (
|
from homeassistant.util.percentage import (
|
||||||
percentage_to_ranged_value,
|
percentage_to_ranged_value,
|
||||||
ranged_value_to_percentage,
|
ranged_value_to_percentage,
|
||||||
@ -226,7 +226,7 @@ class MqttFan(MqttEntity, FanEntity):
|
|||||||
_speed_range: tuple[int, int]
|
_speed_range: tuple[int, int]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.template import Template
|
from homeassistant.helpers.template import Template
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
from .config import MQTT_RW_SCHEMA
|
from .config import MQTT_RW_SCHEMA
|
||||||
@ -212,7 +212,7 @@ class MqttHumidifier(MqttEntity, HumidifierEntity):
|
|||||||
_topic: dict[str, Any]
|
_topic: dict[str, Any]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.helpers import config_validation as cv
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
|
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 homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -117,7 +117,7 @@ class MqttImage(MqttEntity, ImageEntity):
|
|||||||
MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
|
MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
from .config import MQTT_BASE_SCHEMA
|
from .config import MQTT_BASE_SCHEMA
|
||||||
@ -103,7 +103,7 @@ class MqttLawnMower(MqttEntity, LawnMowerEntity, RestoreEntity):
|
|||||||
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.components import light
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
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 ..mixins import async_setup_entity_entry_helper
|
||||||
from .schema import CONF_SCHEMA, MQTT_LIGHT_SCHEMA_SCHEMA
|
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:
|
def validate_mqtt_light_discovery(config_value: dict[str, Any]) -> ConfigType:
|
||||||
"""Validate MQTT light schema for discovery."""
|
"""Validate MQTT light schema for discovery."""
|
||||||
schemas = {
|
schemas: dict[str, VolSchemaType] = {
|
||||||
"basic": DISCOVERY_SCHEMA_BASIC,
|
"basic": DISCOVERY_SCHEMA_BASIC,
|
||||||
"json": DISCOVERY_SCHEMA_JSON,
|
"json": DISCOVERY_SCHEMA_JSON,
|
||||||
"template": DISCOVERY_SCHEMA_TEMPLATE,
|
"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:
|
def validate_mqtt_light_modern(config_value: dict[str, Any]) -> ConfigType:
|
||||||
"""Validate MQTT light schema for setup from configuration.yaml."""
|
"""Validate MQTT light schema for setup from configuration.yaml."""
|
||||||
schemas = {
|
schemas: dict[str, VolSchemaType] = {
|
||||||
"basic": PLATFORM_SCHEMA_MODERN_BASIC,
|
"basic": PLATFORM_SCHEMA_MODERN_BASIC,
|
||||||
"json": PLATFORM_SCHEMA_MODERN_JSON,
|
"json": PLATFORM_SCHEMA_MODERN_JSON,
|
||||||
"template": PLATFORM_SCHEMA_MODERN_TEMPLATE,
|
"template": PLATFORM_SCHEMA_MODERN_TEMPLATE,
|
||||||
|
@ -39,7 +39,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
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
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from .. import subscription
|
from .. import subscription
|
||||||
@ -249,7 +249,7 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity):
|
|||||||
_optimistic_xy_color: bool
|
_optimistic_xy_color: bool
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA_BASIC
|
return DISCOVERY_SCHEMA_BASIC
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ import homeassistant.helpers.config_validation as cv
|
|||||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||||
from homeassistant.helpers.json import json_dumps
|
from homeassistant.helpers.json import json_dumps
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
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
|
import homeassistant.util.color as color_util
|
||||||
from homeassistant.util.json import json_loads_object
|
from homeassistant.util.json import json_loads_object
|
||||||
from homeassistant.util.yaml import dump as yaml_dump
|
from homeassistant.util.yaml import dump as yaml_dump
|
||||||
@ -267,7 +267,7 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
|
|||||||
_deprecated_color_handling: bool = False
|
_deprecated_color_handling: bool = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA_JSON
|
return DISCOVERY_SCHEMA_JSON
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
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
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from .. import subscription
|
from .. import subscription
|
||||||
@ -120,7 +120,7 @@ class MqttLightTemplate(MqttEntity, LightEntity, RestoreEntity):
|
|||||||
_topics: dict[str, str | None]
|
_topics: dict[str, str | None]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA_TEMPLATE
|
return DISCOVERY_SCHEMA_TEMPLATE
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ from homeassistant.helpers.typing import (
|
|||||||
ConfigType,
|
ConfigType,
|
||||||
DiscoveryInfoType,
|
DiscoveryInfoType,
|
||||||
UndefinedType,
|
UndefinedType,
|
||||||
|
VolSchemaType,
|
||||||
)
|
)
|
||||||
from homeassistant.util.json import json_loads
|
from homeassistant.util.json import json_loads
|
||||||
from homeassistant.util.yaml import dump as yaml_dump
|
from homeassistant.util.yaml import dump as yaml_dump
|
||||||
@ -247,8 +248,8 @@ def async_setup_entity_entry_helper(
|
|||||||
entity_class: type[MqttEntity] | None,
|
entity_class: type[MqttEntity] | None,
|
||||||
domain: str,
|
domain: str,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
discovery_schema: vol.Schema,
|
discovery_schema: VolSchemaType,
|
||||||
platform_schema_modern: vol.Schema,
|
platform_schema_modern: VolSchemaType,
|
||||||
schema_class_mapping: dict[str, type[MqttEntity]] | None = None,
|
schema_class_mapping: dict[str, type[MqttEntity]] | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up entity creation dynamically through MQTT discovery."""
|
"""Set up entity creation dynamically through MQTT discovery."""
|
||||||
@ -1187,7 +1188,7 @@ class MqttEntity(
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
|
|
||||||
def _set_entity_name(self, config: ConfigType) -> None:
|
def _set_entity_name(self, config: ConfigType) -> None:
|
||||||
|
@ -11,15 +11,18 @@ from enum import StrEnum
|
|||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING, Any, TypedDict
|
from typing import TYPE_CHECKING, Any, TypedDict
|
||||||
|
|
||||||
import voluptuous as vol
|
|
||||||
|
|
||||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME, Platform
|
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME, Platform
|
||||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ServiceValidationError, TemplateError
|
from homeassistant.exceptions import ServiceValidationError, TemplateError
|
||||||
from homeassistant.helpers import template
|
from homeassistant.helpers import template
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.service_info.mqtt import ReceivePayloadType
|
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
|
from homeassistant.util.hass_dict import HassKey
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -418,7 +421,7 @@ class MqttData:
|
|||||||
platforms_loaded: set[Platform | str] = field(default_factory=set)
|
platforms_loaded: set[Platform | str] = field(default_factory=set)
|
||||||
reload_dispatchers: list[CALLBACK_TYPE] = field(default_factory=list)
|
reload_dispatchers: list[CALLBACK_TYPE] = field(default_factory=list)
|
||||||
reload_handlers: dict[str, CALLBACK_TYPE] = field(default_factory=dict)
|
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)
|
state_write_requests: EntityTopicState = field(default_factory=EntityTopicState)
|
||||||
subscriptions_to_restore: list[Subscription] = field(default_factory=list)
|
subscriptions_to_restore: list[Subscription] = field(default_factory=list)
|
||||||
tags: dict[str, dict[str, MQTTTagScanner]] = field(default_factory=dict)
|
tags: dict[str, dict[str, MQTTTagScanner]] = field(default_factory=dict)
|
||||||
|
@ -28,7 +28,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
from .config import MQTT_RW_SCHEMA
|
from .config import MQTT_RW_SCHEMA
|
||||||
@ -133,7 +133,7 @@ class MqttNumber(MqttEntity, RestoreNumber):
|
|||||||
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
from .config import MQTT_RW_SCHEMA
|
from .config import MQTT_RW_SCHEMA
|
||||||
@ -84,7 +84,7 @@ class MqttSelect(MqttEntity, SelectEntity, RestoreEntity):
|
|||||||
_optimistic: bool = False
|
_optimistic: bool = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ from homeassistant.core import CALLBACK_TYPE, HomeAssistant, State, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.event import async_call_later
|
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 homeassistant.util import dt as dt_util
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -185,7 +185,7 @@ class MqttSensor(MqttEntity, RestoreSensor):
|
|||||||
await MqttEntity.async_will_remove_from_hass(self)
|
await MqttEntity.async_will_remove_from_hass(self)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import homeassistant.helpers.config_validation as cv
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.json import json_dumps
|
from homeassistant.helpers.json import json_dumps
|
||||||
from homeassistant.helpers.template import Template
|
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 homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -142,7 +142,7 @@ class MqttSiren(MqttEntity, SirenEntity):
|
|||||||
_optimistic: bool
|
_optimistic: bool
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType, VolSchemaType
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
from .config import MQTT_RW_SCHEMA
|
from .config import MQTT_RW_SCHEMA
|
||||||
@ -121,7 +121,7 @@ class MqttTextEntity(MqttEntity, TextEntity):
|
|||||||
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
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 homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -107,7 +107,7 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity):
|
|||||||
return super().entity_picture
|
return super().entity_picture
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ import homeassistant.helpers.config_validation as cv
|
|||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||||
from homeassistant.helpers.json import json_dumps
|
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 homeassistant.util.json import json_loads_object
|
||||||
|
|
||||||
from . import subscription
|
from . import subscription
|
||||||
@ -281,7 +281,7 @@ class MqttStateVacuum(MqttEntity, StateVacuumEntity):
|
|||||||
MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
|
MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
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.json import JSON_DECODE_EXCEPTIONS, json_loads
|
||||||
from homeassistant.util.percentage import (
|
from homeassistant.util.percentage import (
|
||||||
percentage_to_ranged_value,
|
percentage_to_ranged_value,
|
||||||
@ -163,7 +163,7 @@ class MqttValve(MqttEntity, ValveEntity):
|
|||||||
_tilt_optimistic: bool
|
_tilt_optimistic: bool
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.template import Template
|
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 homeassistant.util.unit_conversion import TemperatureConverter
|
||||||
|
|
||||||
from .climate import MqttTemperatureControlEntity
|
from .climate import MqttTemperatureControlEntity
|
||||||
@ -188,7 +188,7 @@ class MqttWaterHeater(MqttTemperatureControlEntity, WaterHeaterEntity):
|
|||||||
_attr_target_temperature_high: float | None = None
|
_attr_target_temperature_high: float | None = None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def config_schema() -> vol.Schema:
|
def config_schema() -> VolSchemaType:
|
||||||
"""Return the config schema."""
|
"""Return the config schema."""
|
||||||
return DISCOVERY_SCHEMA
|
return DISCOVERY_SCHEMA
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user