Rename mqtt entry setup helpers to reflect their purpose (#102378)

Rename mqtt entry setup helpers
This commit is contained in:
Jan Bouwhuis 2023-10-20 13:36:24 +02:00 committed by GitHub
parent e319b04fde
commit 25ab622b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 73 additions and 55 deletions

View File

@ -43,7 +43,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage
@ -132,7 +132,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT alarm control panel through YAML and through MQTT discovery.""" """Set up MQTT alarm control panel through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttAlarm, MqttAlarm,

View File

@ -41,7 +41,7 @@ from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttAvailability, MqttAvailability,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MqttValueTemplate, ReceiveMessage from .models import MqttValueTemplate, ReceiveMessage
@ -76,7 +76,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT binary sensor through YAML and through MQTT discovery.""" """Set up MQTT binary sensor through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttBinarySensor, MqttBinarySensor,

View File

@ -20,7 +20,11 @@ from .const import (
CONF_QOS, CONF_QOS,
CONF_RETAIN, CONF_RETAIN,
) )
from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_mqtt_entry_helper from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity,
async_setup_entity_entry_helper,
)
from .models import MqttCommandTemplate from .models import MqttCommandTemplate
from .util import valid_publish_topic from .util import valid_publish_topic
@ -48,7 +52,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT button through YAML and through MQTT discovery.""" """Set up MQTT button through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttButton, MqttButton,

View File

@ -20,7 +20,11 @@ from . import subscription
from .config import MQTT_BASE_SCHEMA from .config import MQTT_BASE_SCHEMA
from .const import CONF_QOS, CONF_TOPIC from .const import CONF_QOS, CONF_TOPIC
from .debug_info import log_messages from .debug_info import log_messages
from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_mqtt_entry_helper from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity,
async_setup_entity_entry_helper,
)
from .models import ReceiveMessage from .models import ReceiveMessage
from .util import valid_subscribe_topic from .util import valid_subscribe_topic
@ -60,7 +64,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT camera through YAML and through MQTT discovery.""" """Set up MQTT camera through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttCamera, MqttCamera,

View File

@ -84,7 +84,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -399,7 +399,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT climate through YAML and through MQTT discovery.""" """Set up MQTT climate through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttClimate, MqttClimate,

View File

@ -47,7 +47,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage
@ -219,7 +219,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT cover through YAML and through MQTT discovery.""" """Set up MQTT cover through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttCover, MqttCover,

View File

@ -11,7 +11,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import device_trigger from . import device_trigger
from .config import MQTT_BASE_SCHEMA from .config import MQTT_BASE_SCHEMA
from .mixins import async_setup_entry_helper from .mixins import async_setup_non_entity_entry_helper
AUTOMATION_TYPE_TRIGGER = "trigger" AUTOMATION_TYPE_TRIGGER = "trigger"
AUTOMATION_TYPES = [AUTOMATION_TYPE_TRIGGER] AUTOMATION_TYPES = [AUTOMATION_TYPE_TRIGGER]
@ -28,7 +28,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> N
"""Set up MQTT device automation dynamically through MQTT discovery.""" """Set up MQTT device automation dynamically through MQTT discovery."""
setup = functools.partial(_async_setup_automation, hass, config_entry=config_entry) setup = functools.partial(_async_setup_automation, hass, config_entry=config_entry)
await async_setup_entry_helper(hass, "device_automation", setup, DISCOVERY_SCHEMA) await async_setup_non_entity_entry_helper(
hass, "device_automation", setup, DISCOVERY_SCHEMA
)
async def _async_setup_automation( async def _async_setup_automation(

View File

@ -35,7 +35,7 @@ from .mixins import (
CONF_JSON_ATTRS_TOPIC, CONF_JSON_ATTRS_TOPIC,
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MqttValueTemplate, ReceiveMessage, ReceivePayloadType from .models import MqttValueTemplate, ReceiveMessage, ReceivePayloadType
@ -85,7 +85,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT event through YAML and through MQTT discovery.""" """Set up MQTT event through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttDeviceTracker, MqttDeviceTracker,

View File

@ -34,7 +34,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -82,7 +82,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT event through YAML and through MQTT discovery.""" """Set up MQTT event through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttEvent, MqttEvent,

View File

@ -52,7 +52,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -199,7 +199,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT fan through YAML and through MQTT discovery.""" """Set up MQTT fan through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttFan, MqttFan,

View File

@ -54,7 +54,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -191,7 +191,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT humidifier through YAML and through MQTT discovery.""" """Set up MQTT humidifier through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttHumidifier, MqttHumidifier,

View File

@ -26,7 +26,11 @@ from . import subscription
from .config import MQTT_BASE_SCHEMA from .config import MQTT_BASE_SCHEMA
from .const import CONF_ENCODING, CONF_QOS from .const import CONF_ENCODING, CONF_QOS
from .debug_info import log_messages from .debug_info import log_messages
from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_mqtt_entry_helper from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity,
async_setup_entity_entry_helper,
)
from .models import MessageCallbackType, MqttValueTemplate, ReceiveMessage from .models import MessageCallbackType, MqttValueTemplate, ReceiveMessage
from .util import get_mqtt_data, valid_subscribe_topic from .util import get_mqtt_data, valid_subscribe_topic
@ -78,7 +82,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT image through YAML and through MQTT discovery.""" """Set up MQTT image through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttImage, MqttImage,

View File

@ -34,7 +34,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -91,7 +91,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT lawn mower through YAML and through MQTT discovery.""" """Set up MQTT lawn mower through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttLawnMower, MqttLawnMower,

View File

@ -11,7 +11,7 @@ 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
from ..mixins import async_mqtt_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
from .schema_basic import ( from .schema_basic import (
DISCOVERY_SCHEMA_BASIC, DISCOVERY_SCHEMA_BASIC,
@ -69,7 +69,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT lights through YAML and through MQTT discovery.""" """Set up MQTT lights through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
None, None,

View File

@ -36,7 +36,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -112,7 +112,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT lock through YAML and through MQTT discovery.""" """Set up MQTT lock through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttLock, MqttLock,

View File

@ -305,7 +305,7 @@ async def _async_discover(
raise raise
async def async_setup_entry_helper( async def async_setup_non_entity_entry_helper(
hass: HomeAssistant, hass: HomeAssistant,
domain: str, domain: str,
async_setup: partial[Coroutine[Any, Any, None]], async_setup: partial[Coroutine[Any, Any, None]],
@ -332,7 +332,7 @@ async def async_setup_entry_helper(
) )
async def async_mqtt_entry_helper( async def async_setup_entity_entry_helper(
hass: HomeAssistant, hass: HomeAssistant,
entry: ConfigEntry, entry: ConfigEntry,
entity_class: type[MqttEntity] | None, entity_class: type[MqttEntity] | None,
@ -342,7 +342,7 @@ async def async_mqtt_entry_helper(
platform_schema_modern: vol.Schema, platform_schema_modern: vol.Schema,
schema_class_mapping: dict[str, type[MqttEntity]] | None = None, schema_class_mapping: dict[str, type[MqttEntity]] | None = None,
) -> None: ) -> None:
"""Set up entity, automation or tag creation dynamically through MQTT discovery.""" """Set up entity creation dynamically through MQTT discovery."""
mqtt_data = get_mqtt_data(hass) mqtt_data = get_mqtt_data(hass)
async def async_setup_from_discovery( async def async_setup_from_discovery(

View File

@ -44,7 +44,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -117,7 +117,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT number through YAML and through MQTT discovery.""" """Set up MQTT number through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttNumber, MqttNumber,

View File

@ -16,7 +16,11 @@ from homeassistant.helpers.typing import ConfigType
from .config import MQTT_BASE_SCHEMA from .config import MQTT_BASE_SCHEMA
from .const import CONF_COMMAND_TOPIC, CONF_ENCODING, CONF_QOS, CONF_RETAIN from .const import CONF_COMMAND_TOPIC, CONF_ENCODING, CONF_QOS, CONF_RETAIN
from .mixins import MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, async_mqtt_entry_helper from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity,
async_setup_entity_entry_helper,
)
from .util import valid_publish_topic from .util import valid_publish_topic
DEFAULT_NAME = "MQTT Scene" DEFAULT_NAME = "MQTT Scene"
@ -42,7 +46,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT scene through YAML and through MQTT discovery.""" """Set up MQTT scene through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttScene, MqttScene,

View File

@ -30,7 +30,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -72,7 +72,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT select through YAML and through MQTT discovery.""" """Set up MQTT select through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttSelect, MqttSelect,

View File

@ -43,7 +43,7 @@ from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttAvailability, MqttAvailability,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -105,7 +105,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT sensor through YAML and through MQTT discovery.""" """Set up MQTT sensor through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttSensor, MqttSensor,

View File

@ -51,7 +51,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -121,7 +121,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT siren through YAML and through MQTT discovery.""" """Set up MQTT siren through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttSiren, MqttSiren,

View File

@ -39,7 +39,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MqttValueTemplate, ReceiveMessage from .models import MqttValueTemplate, ReceiveMessage
@ -71,7 +71,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT switch through YAML and through MQTT discovery.""" """Set up MQTT switch through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttSwitch, MqttSwitch,

View File

@ -21,7 +21,7 @@ from .mixins import (
MQTT_ENTITY_DEVICE_INFO_SCHEMA, MQTT_ENTITY_DEVICE_INFO_SCHEMA,
MqttDiscoveryDeviceUpdate, MqttDiscoveryDeviceUpdate,
async_handle_schema_error, async_handle_schema_error,
async_setup_entry_helper, async_setup_non_entity_entry_helper,
send_discovery_done, send_discovery_done,
update_device, update_device,
) )
@ -47,7 +47,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> N
"""Set up MQTT tag scanner dynamically through MQTT discovery.""" """Set up MQTT tag scanner dynamically through MQTT discovery."""
setup = functools.partial(_async_setup_tag, hass, config_entry=config_entry) setup = functools.partial(_async_setup_tag, hass, config_entry=config_entry)
await async_setup_entry_helper(hass, TAG, setup, DISCOVERY_SCHEMA) await async_setup_non_entity_entry_helper(hass, TAG, setup, DISCOVERY_SCHEMA)
async def _async_setup_tag( async def _async_setup_tag(

View File

@ -37,7 +37,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import ( from .models import (
@ -107,7 +107,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT text through YAML and through MQTT discovery.""" """Set up MQTT text through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttTextEntity, MqttTextEntity,

View File

@ -35,7 +35,7 @@ from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
MqttEntity, MqttEntity,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MessageCallbackType, MqttValueTemplate, ReceiveMessage from .models import MessageCallbackType, MqttValueTemplate, ReceiveMessage
@ -91,7 +91,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT update entity through YAML and through MQTT discovery.""" """Set up MQTT update entity through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttUpdate, MqttUpdate,

View File

@ -17,7 +17,7 @@ from homeassistant.helpers.issue_registry import IssueSeverity, async_create_iss
from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.typing import ConfigType
from ..const import DOMAIN from ..const import DOMAIN
from ..mixins import async_mqtt_entry_helper from ..mixins import async_setup_entity_entry_helper
from .schema import CONF_SCHEMA, LEGACY, MQTT_VACUUM_SCHEMA, STATE from .schema import CONF_SCHEMA, LEGACY, MQTT_VACUUM_SCHEMA, STATE
from .schema_legacy import ( from .schema_legacy import (
DISCOVERY_SCHEMA_LEGACY, DISCOVERY_SCHEMA_LEGACY,
@ -110,7 +110,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT vacuum through YAML and through MQTT discovery.""" """Set up MQTT vacuum through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
None, None,

View File

@ -66,7 +66,7 @@ from .const import (
from .debug_info import log_messages from .debug_info import log_messages
from .mixins import ( from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA, MQTT_ENTITY_COMMON_SCHEMA,
async_mqtt_entry_helper, async_setup_entity_entry_helper,
write_state_on_attr_change, write_state_on_attr_change,
) )
from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage
@ -169,7 +169,7 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback, async_add_entities: AddEntitiesCallback,
) -> None: ) -> None:
"""Set up MQTT water heater device through YAML and through MQTT discovery.""" """Set up MQTT water heater device through YAML and through MQTT discovery."""
await async_mqtt_entry_helper( await async_setup_entity_entry_helper(
hass, hass,
config_entry, config_entry,
MqttWaterHeater, MqttWaterHeater,