From 25ab622b51ac9a207c582abfe026e070b37a31bf Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 20 Oct 2023 13:36:24 +0200 Subject: [PATCH] Rename mqtt entry setup helpers to reflect their purpose (#102378) Rename mqtt entry setup helpers --- homeassistant/components/mqtt/alarm_control_panel.py | 4 ++-- homeassistant/components/mqtt/binary_sensor.py | 4 ++-- homeassistant/components/mqtt/button.py | 8 ++++++-- homeassistant/components/mqtt/camera.py | 8 ++++++-- homeassistant/components/mqtt/climate.py | 4 ++-- homeassistant/components/mqtt/cover.py | 4 ++-- homeassistant/components/mqtt/device_automation.py | 6 ++++-- 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 | 8 ++++++-- homeassistant/components/mqtt/lawn_mower.py | 4 ++-- homeassistant/components/mqtt/light/__init__.py | 4 ++-- homeassistant/components/mqtt/lock.py | 4 ++-- homeassistant/components/mqtt/mixins.py | 6 +++--- homeassistant/components/mqtt/number.py | 4 ++-- homeassistant/components/mqtt/scene.py | 8 ++++++-- homeassistant/components/mqtt/select.py | 4 ++-- homeassistant/components/mqtt/sensor.py | 4 ++-- homeassistant/components/mqtt/siren.py | 4 ++-- homeassistant/components/mqtt/switch.py | 4 ++-- homeassistant/components/mqtt/tag.py | 4 ++-- homeassistant/components/mqtt/text.py | 4 ++-- homeassistant/components/mqtt/update.py | 4 ++-- homeassistant/components/mqtt/vacuum/__init__.py | 4 ++-- homeassistant/components/mqtt/water_heater.py | 4 ++-- 27 files changed, 73 insertions(+), 55 deletions(-) diff --git a/homeassistant/components/mqtt/alarm_control_panel.py b/homeassistant/components/mqtt/alarm_control_panel.py index 1eb210bf99e..68aca18f249 100644 --- a/homeassistant/components/mqtt/alarm_control_panel.py +++ b/homeassistant/components/mqtt/alarm_control_panel.py @@ -43,7 +43,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage @@ -132,7 +132,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT alarm control panel through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttAlarm, diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index b8f7c73eede..7ab2e9ebf90 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -41,7 +41,7 @@ from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttAvailability, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MqttValueTemplate, ReceiveMessage @@ -76,7 +76,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT binary sensor through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttBinarySensor, diff --git a/homeassistant/components/mqtt/button.py b/homeassistant/components/mqtt/button.py index a6bc43bece2..f0d8037b60d 100644 --- a/homeassistant/components/mqtt/button.py +++ b/homeassistant/components/mqtt/button.py @@ -20,7 +20,11 @@ from .const import ( 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 .models import MqttCommandTemplate from .util import valid_publish_topic @@ -48,7 +52,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT button through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttButton, diff --git a/homeassistant/components/mqtt/camera.py b/homeassistant/components/mqtt/camera.py index 1a2d4744948..954cddd20f7 100644 --- a/homeassistant/components/mqtt/camera.py +++ b/homeassistant/components/mqtt/camera.py @@ -20,7 +20,11 @@ from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_QOS, CONF_TOPIC 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 .util import valid_subscribe_topic @@ -60,7 +64,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT camera through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttCamera, diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 4437f2a6270..dae768a1359 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -84,7 +84,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -399,7 +399,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT climate through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttClimate, diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index 367390aefaf..c8da14e67e6 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -47,7 +47,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage @@ -219,7 +219,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT cover through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttCover, diff --git a/homeassistant/components/mqtt/device_automation.py b/homeassistant/components/mqtt/device_automation.py index 13d0b9ea530..c0e6f5750fb 100644 --- a/homeassistant/components/mqtt/device_automation.py +++ b/homeassistant/components/mqtt/device_automation.py @@ -11,7 +11,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import device_trigger 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_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.""" 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( diff --git a/homeassistant/components/mqtt/device_tracker.py b/homeassistant/components/mqtt/device_tracker.py index 1216a68fe7b..6e5aeb8f228 100644 --- a/homeassistant/components/mqtt/device_tracker.py +++ b/homeassistant/components/mqtt/device_tracker.py @@ -35,7 +35,7 @@ from .mixins import ( CONF_JSON_ATTRS_TOPIC, MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MqttValueTemplate, ReceiveMessage, ReceivePayloadType @@ -85,7 +85,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT event through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttDeviceTracker, diff --git a/homeassistant/components/mqtt/event.py b/homeassistant/components/mqtt/event.py index 39057314508..c9302bf65b1 100644 --- a/homeassistant/components/mqtt/event.py +++ b/homeassistant/components/mqtt/event.py @@ -34,7 +34,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -82,7 +82,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT event through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttEvent, diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index 783573c8e00..02192676784 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -52,7 +52,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -199,7 +199,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT fan through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttFan, diff --git a/homeassistant/components/mqtt/humidifier.py b/homeassistant/components/mqtt/humidifier.py index 1e56ba1649a..77a74b15197 100644 --- a/homeassistant/components/mqtt/humidifier.py +++ b/homeassistant/components/mqtt/humidifier.py @@ -54,7 +54,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -191,7 +191,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT humidifier through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttHumidifier, diff --git a/homeassistant/components/mqtt/image.py b/homeassistant/components/mqtt/image.py index bf4ca584c47..1f90f0fdb3d 100644 --- a/homeassistant/components/mqtt/image.py +++ b/homeassistant/components/mqtt/image.py @@ -26,7 +26,11 @@ from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_ENCODING, CONF_QOS 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 .util import get_mqtt_data, valid_subscribe_topic @@ -78,7 +82,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT image through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttImage, diff --git a/homeassistant/components/mqtt/lawn_mower.py b/homeassistant/components/mqtt/lawn_mower.py index cd19e9c26ed..924d34bf5c7 100644 --- a/homeassistant/components/mqtt/lawn_mower.py +++ b/homeassistant/components/mqtt/lawn_mower.py @@ -34,7 +34,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -91,7 +91,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT lawn mower through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttLawnMower, diff --git a/homeassistant/components/mqtt/light/__init__.py b/homeassistant/components/mqtt/light/__init__.py index 15431616658..a5f3f0aca84 100644 --- a/homeassistant/components/mqtt/light/__init__.py +++ b/homeassistant/components/mqtt/light/__init__.py @@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback 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_basic import ( DISCOVERY_SCHEMA_BASIC, @@ -69,7 +69,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT lights through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, None, diff --git a/homeassistant/components/mqtt/lock.py b/homeassistant/components/mqtt/lock.py index f6177d94410..26b6009426c 100644 --- a/homeassistant/components/mqtt/lock.py +++ b/homeassistant/components/mqtt/lock.py @@ -36,7 +36,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -112,7 +112,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT lock through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttLock, diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index 2b86d8b3e87..767a012d179 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -305,7 +305,7 @@ async def _async_discover( raise -async def async_setup_entry_helper( +async def async_setup_non_entity_entry_helper( hass: HomeAssistant, domain: str, 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, entry: ConfigEntry, entity_class: type[MqttEntity] | None, @@ -342,7 +342,7 @@ async def async_mqtt_entry_helper( platform_schema_modern: vol.Schema, schema_class_mapping: dict[str, type[MqttEntity]] | 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) async def async_setup_from_discovery( diff --git a/homeassistant/components/mqtt/number.py b/homeassistant/components/mqtt/number.py index 34616df41bc..83eb047519f 100644 --- a/homeassistant/components/mqtt/number.py +++ b/homeassistant/components/mqtt/number.py @@ -44,7 +44,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -117,7 +117,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT number through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttNumber, diff --git a/homeassistant/components/mqtt/scene.py b/homeassistant/components/mqtt/scene.py index 7e41e5e8592..de75f470228 100644 --- a/homeassistant/components/mqtt/scene.py +++ b/homeassistant/components/mqtt/scene.py @@ -16,7 +16,11 @@ from homeassistant.helpers.typing import ConfigType from .config import MQTT_BASE_SCHEMA 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 DEFAULT_NAME = "MQTT Scene" @@ -42,7 +46,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT scene through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttScene, diff --git a/homeassistant/components/mqtt/select.py b/homeassistant/components/mqtt/select.py index 6c391232072..5d9bc989c25 100644 --- a/homeassistant/components/mqtt/select.py +++ b/homeassistant/components/mqtt/select.py @@ -30,7 +30,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -72,7 +72,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT select through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttSelect, diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index a4a59de4dfb..93151c51542 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -43,7 +43,7 @@ from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttAvailability, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -105,7 +105,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT sensor through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttSensor, diff --git a/homeassistant/components/mqtt/siren.py b/homeassistant/components/mqtt/siren.py index 3ba7df84cc9..cb2ecbafa55 100644 --- a/homeassistant/components/mqtt/siren.py +++ b/homeassistant/components/mqtt/siren.py @@ -51,7 +51,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -121,7 +121,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT siren through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttSiren, diff --git a/homeassistant/components/mqtt/switch.py b/homeassistant/components/mqtt/switch.py index 7221d02611e..c45e6dd77ab 100644 --- a/homeassistant/components/mqtt/switch.py +++ b/homeassistant/components/mqtt/switch.py @@ -39,7 +39,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MqttValueTemplate, ReceiveMessage @@ -71,7 +71,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT switch through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttSwitch, diff --git a/homeassistant/components/mqtt/tag.py b/homeassistant/components/mqtt/tag.py index e87a9b0da6e..80a717b1f37 100644 --- a/homeassistant/components/mqtt/tag.py +++ b/homeassistant/components/mqtt/tag.py @@ -21,7 +21,7 @@ from .mixins import ( MQTT_ENTITY_DEVICE_INFO_SCHEMA, MqttDiscoveryDeviceUpdate, async_handle_schema_error, - async_setup_entry_helper, + async_setup_non_entity_entry_helper, send_discovery_done, 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.""" 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( diff --git a/homeassistant/components/mqtt/text.py b/homeassistant/components/mqtt/text.py index 3fd0f9a4198..f6aeac3be7c 100644 --- a/homeassistant/components/mqtt/text.py +++ b/homeassistant/components/mqtt/text.py @@ -37,7 +37,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import ( @@ -107,7 +107,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT text through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttTextEntity, diff --git a/homeassistant/components/mqtt/update.py b/homeassistant/components/mqtt/update.py index c9ad17c078c..45424995224 100644 --- a/homeassistant/components/mqtt/update.py +++ b/homeassistant/components/mqtt/update.py @@ -35,7 +35,7 @@ from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, MqttEntity, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MessageCallbackType, MqttValueTemplate, ReceiveMessage @@ -91,7 +91,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT update entity through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttUpdate, diff --git a/homeassistant/components/mqtt/vacuum/__init__.py b/homeassistant/components/mqtt/vacuum/__init__.py index cbf99073ba5..fabbb9868df 100644 --- a/homeassistant/components/mqtt/vacuum/__init__.py +++ b/homeassistant/components/mqtt/vacuum/__init__.py @@ -17,7 +17,7 @@ from homeassistant.helpers.issue_registry import IssueSeverity, async_create_iss from homeassistant.helpers.typing import ConfigType 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_legacy import ( DISCOVERY_SCHEMA_LEGACY, @@ -110,7 +110,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT vacuum through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, None, diff --git a/homeassistant/components/mqtt/water_heater.py b/homeassistant/components/mqtt/water_heater.py index 99cc35f74a4..0ccd2dbc47d 100644 --- a/homeassistant/components/mqtt/water_heater.py +++ b/homeassistant/components/mqtt/water_heater.py @@ -66,7 +66,7 @@ from .const import ( from .debug_info import log_messages from .mixins import ( MQTT_ENTITY_COMMON_SCHEMA, - async_mqtt_entry_helper, + async_setup_entity_entry_helper, write_state_on_attr_change, ) from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage @@ -169,7 +169,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up MQTT water heater device through YAML and through MQTT discovery.""" - await async_mqtt_entry_helper( + await async_setup_entity_entry_helper( hass, config_entry, MqttWaterHeater,