From 21affac5711c6508fa72928f56767a50a12e1385 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Thu, 19 Sep 2024 20:50:33 +0200 Subject: [PATCH] Rename mqtt mixins module to `entity.py` (#126279) --- homeassistant/components/mqtt/alarm_control_panel.py | 2 +- homeassistant/components/mqtt/binary_sensor.py | 2 +- homeassistant/components/mqtt/button.py | 2 +- homeassistant/components/mqtt/camera.py | 2 +- homeassistant/components/mqtt/climate.py | 2 +- homeassistant/components/mqtt/cover.py | 2 +- homeassistant/components/mqtt/device_automation.py | 2 +- homeassistant/components/mqtt/device_tracker.py | 2 +- homeassistant/components/mqtt/device_trigger.py | 2 +- homeassistant/components/mqtt/{mixins.py => entity.py} | 10 +++++----- homeassistant/components/mqtt/event.py | 2 +- homeassistant/components/mqtt/fan.py | 2 +- homeassistant/components/mqtt/humidifier.py | 2 +- homeassistant/components/mqtt/image.py | 2 +- homeassistant/components/mqtt/lawn_mower.py | 2 +- homeassistant/components/mqtt/light/__init__.py | 2 +- homeassistant/components/mqtt/light/schema_basic.py | 2 +- homeassistant/components/mqtt/light/schema_json.py | 2 +- homeassistant/components/mqtt/light/schema_template.py | 2 +- homeassistant/components/mqtt/lock.py | 2 +- homeassistant/components/mqtt/notify.py | 2 +- homeassistant/components/mqtt/number.py | 2 +- homeassistant/components/mqtt/scene.py | 2 +- homeassistant/components/mqtt/select.py | 2 +- homeassistant/components/mqtt/sensor.py | 2 +- homeassistant/components/mqtt/siren.py | 2 +- homeassistant/components/mqtt/switch.py | 2 +- homeassistant/components/mqtt/tag.py | 2 +- homeassistant/components/mqtt/text.py | 2 +- homeassistant/components/mqtt/update.py | 2 +- homeassistant/components/mqtt/vacuum.py | 2 +- homeassistant/components/mqtt/valve.py | 2 +- homeassistant/components/mqtt/water_heater.py | 2 +- tests/components/mqtt/test_common.py | 4 ++-- tests/components/mqtt/test_event.py | 6 +++--- tests/components/mqtt/test_init.py | 2 +- 36 files changed, 43 insertions(+), 43 deletions(-) rename homeassistant/components/mqtt/{mixins.py => entity.py} (99%) diff --git a/homeassistant/components/mqtt/alarm_control_panel.py b/homeassistant/components/mqtt/alarm_control_panel.py index 3cdb3efea7f..7f14c65ffb0 100644 --- a/homeassistant/components/mqtt/alarm_control_panel.py +++ b/homeassistant/components/mqtt/alarm_control_panel.py @@ -39,7 +39,7 @@ from .const import ( CONF_SUPPORTED_FEATURES, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic, valid_subscribe_topic diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index 293b6e5f1f4..7f89a78991a 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -37,7 +37,7 @@ from homeassistant.util import dt as dt_util from . import subscription from .config import MQTT_RO_SCHEMA from .const import CONF_STATE_TOPIC, PAYLOAD_NONE -from .mixins import MqttAvailabilityMixin, MqttEntity, async_setup_entity_entry_helper +from .entity import MqttAvailabilityMixin, MqttEntity, async_setup_entity_entry_helper from .models import MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA diff --git a/homeassistant/components/mqtt/button.py b/homeassistant/components/mqtt/button.py index 6ad11859f44..2aac51890c1 100644 --- a/homeassistant/components/mqtt/button.py +++ b/homeassistant/components/mqtt/button.py @@ -15,7 +15,7 @@ from homeassistant.helpers.typing import ConfigType from .config import DEFAULT_RETAIN, MQTT_BASE_SCHEMA from .const import CONF_COMMAND_TEMPLATE, CONF_COMMAND_TOPIC, CONF_RETAIN -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import MqttCommandTemplate from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic diff --git a/homeassistant/components/mqtt/camera.py b/homeassistant/components/mqtt/camera.py index fa550b9fd0c..ca622defb25 100644 --- a/homeassistant/components/mqtt/camera.py +++ b/homeassistant/components/mqtt/camera.py @@ -20,7 +20,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_TOPIC -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_subscribe_topic diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index ac276c37d71..dd3efa4054b 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -79,7 +79,7 @@ from .const import ( DEFAULT_OPTIMISTIC, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index 2d1b64d002a..f53d895ec4f 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -61,7 +61,7 @@ from .const import ( DEFAULT_RETAIN, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic, valid_subscribe_topic diff --git a/homeassistant/components/mqtt/device_automation.py b/homeassistant/components/mqtt/device_automation.py index 8d23d32326b..366f2f13ad4 100644 --- a/homeassistant/components/mqtt/device_automation.py +++ b/homeassistant/components/mqtt/device_automation.py @@ -12,7 +12,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import device_trigger from .config import MQTT_BASE_SCHEMA -from .mixins import async_setup_non_entity_entry_helper +from .entity import async_setup_non_entity_entry_helper AUTOMATION_TYPE_TRIGGER = "trigger" AUTOMATION_TYPES = [AUTOMATION_TYPE_TRIGGER] diff --git a/homeassistant/components/mqtt/device_tracker.py b/homeassistant/components/mqtt/device_tracker.py index 57614106d4e..13b89256e21 100644 --- a/homeassistant/components/mqtt/device_tracker.py +++ b/homeassistant/components/mqtt/device_tracker.py @@ -33,7 +33,7 @@ from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_PAYLOAD_RESET, CONF_STATE_TOPIC -from .mixins import CONF_JSON_ATTRS_TOPIC, MqttEntity, async_setup_entity_entry_helper +from .entity import CONF_JSON_ATTRS_TOPIC, MqttEntity, async_setup_entity_entry_helper from .models import MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_subscribe_topic diff --git a/homeassistant/components/mqtt/device_trigger.py b/homeassistant/components/mqtt/device_trigger.py index 911dce163f9..80faf879587 100644 --- a/homeassistant/components/mqtt/device_trigger.py +++ b/homeassistant/components/mqtt/device_trigger.py @@ -36,7 +36,7 @@ from .const import ( DOMAIN, ) from .discovery import MQTTDiscoveryPayload, clear_discovery_hash -from .mixins import MqttDiscoveryDeviceUpdateMixin, send_discovery_done, update_device +from .entity import MqttDiscoveryDeviceUpdateMixin, send_discovery_done, update_device from .models import DATA_MQTT from .schemas import MQTT_ENTITY_DEVICE_INFO_SCHEMA diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/entity.py similarity index 99% rename from homeassistant/components/mqtt/mixins.py rename to homeassistant/components/mqtt/entity.py index b1c7c6edadb..633b22035dd 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/entity.py @@ -1,4 +1,4 @@ -"""MQTT component mixins and helpers.""" +"""MQTT (entity) component mixins and helpers.""" from __future__ import annotations @@ -369,7 +369,7 @@ def init_entity_id_from_config( ) -class MqttAttributesMixin(Entity): # pylint: disable=hass-enforce-class-module +class MqttAttributesMixin(Entity): """Mixin used for platforms that support JSON attributes.""" _attributes_extra_blocked: frozenset[str] = frozenset() @@ -454,7 +454,7 @@ class MqttAttributesMixin(Entity): # pylint: disable=hass-enforce-class-module _LOGGER.warning("JSON result was not a dictionary") -class MqttAvailabilityMixin(Entity): # pylint: disable=hass-enforce-class-module +class MqttAvailabilityMixin(Entity): """Mixin used for platforms that report availability.""" def __init__(self, config: ConfigType) -> None: @@ -799,7 +799,7 @@ class MqttDiscoveryDeviceUpdateMixin(ABC): """Handle the cleanup of platform specific parts, extend to the platform.""" -class MqttDiscoveryUpdateMixin(Entity): # pylint: disable=hass-enforce-class-module +class MqttDiscoveryUpdateMixin(Entity): """Mixin used to handle updated discovery message for entity based platforms.""" def __init__( @@ -1021,7 +1021,7 @@ def device_info_from_specifications( return info -class MqttEntityDeviceInfo(Entity): # pylint: disable=hass-enforce-class-module +class MqttEntityDeviceInfo(Entity): """Mixin used for mqtt platforms that support the device registry.""" def __init__( diff --git a/homeassistant/components/mqtt/event.py b/homeassistant/components/mqtt/event.py index 0dc267f80f9..3f67891ca5e 100644 --- a/homeassistant/components/mqtt/event.py +++ b/homeassistant/components/mqtt/event.py @@ -26,7 +26,7 @@ from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads_object from . import subscription from .config import MQTT_RO_SCHEMA from .const import CONF_STATE_TOPIC, PAYLOAD_EMPTY_JSON, PAYLOAD_NONE -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( DATA_MQTT, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index a22dba4ae93..70187ee9eb1 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -47,7 +47,7 @@ from .const import ( CONF_STATE_VALUE_TEMPLATE, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/humidifier.py b/homeassistant/components/mqtt/humidifier.py index d55c1d3cebf..304d293de79 100644 --- a/homeassistant/components/mqtt/humidifier.py +++ b/homeassistant/components/mqtt/humidifier.py @@ -49,7 +49,7 @@ from .const import ( CONF_STATE_VALUE_TEMPLATE, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/image.py b/homeassistant/components/mqtt/image.py index 30fd102764d..6ecdee06489 100644 --- a/homeassistant/components/mqtt/image.py +++ b/homeassistant/components/mqtt/image.py @@ -25,7 +25,7 @@ from homeassistant.util import dt as dt_util from . import subscription from .config import MQTT_BASE_SCHEMA -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( DATA_MQTT, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/lawn_mower.py b/homeassistant/components/mqtt/lawn_mower.py index f4aa248929e..11afe4220c4 100644 --- a/homeassistant/components/mqtt/lawn_mower.py +++ b/homeassistant/components/mqtt/lawn_mower.py @@ -26,7 +26,7 @@ from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_RETAIN, DEFAULT_OPTIMISTIC, DEFAULT_RETAIN -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/light/__init__.py b/homeassistant/components/mqtt/light/__init__.py index 04619b08e11..a1ba955181d 100644 --- a/homeassistant/components/mqtt/light/__init__.py +++ b/homeassistant/components/mqtt/light/__init__.py @@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, VolSchemaType -from ..mixins import async_setup_entity_entry_helper +from ..entity import async_setup_entity_entry_helper from .schema import CONF_SCHEMA, MQTT_LIGHT_SCHEMA_SCHEMA from .schema_basic import ( DISCOVERY_SCHEMA_BASIC, diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index 1a64b1eecb4..de6a9d4c126 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -51,7 +51,7 @@ from ..const import ( CONF_STATE_VALUE_TEMPLATE, PAYLOAD_NONE, ) -from ..mixins import MqttEntity +from ..entity import MqttEntity from ..models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/light/schema_json.py b/homeassistant/components/mqtt/light/schema_json.py index 58fde4a3800..89f338f6bab 100644 --- a/homeassistant/components/mqtt/light/schema_json.py +++ b/homeassistant/components/mqtt/light/schema_json.py @@ -65,7 +65,7 @@ from ..const import ( CONF_STATE_TOPIC, DOMAIN as MQTT_DOMAIN, ) -from ..mixins import MqttEntity +from ..entity import MqttEntity from ..models import ReceiveMessage from ..schemas import MQTT_ENTITY_COMMON_SCHEMA from ..util import valid_subscribe_topic diff --git a/homeassistant/components/mqtt/light/schema_template.py b/homeassistant/components/mqtt/light/schema_template.py index a1f4ea2e81a..c4f9cad44c5 100644 --- a/homeassistant/components/mqtt/light/schema_template.py +++ b/homeassistant/components/mqtt/light/schema_template.py @@ -38,7 +38,7 @@ import homeassistant.util.color as color_util from .. import subscription from ..config import MQTT_RW_SCHEMA from ..const import CONF_COMMAND_TOPIC, CONF_STATE_TOPIC, PAYLOAD_NONE -from ..mixins import MqttEntity +from ..entity import MqttEntity from ..models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/lock.py b/homeassistant/components/mqtt/lock.py index c72dcd8dc21..e58d15b659d 100644 --- a/homeassistant/components/mqtt/lock.py +++ b/homeassistant/components/mqtt/lock.py @@ -34,7 +34,7 @@ from .const import ( CONF_STATE_OPENING, CONF_STATE_TOPIC, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/notify.py b/homeassistant/components/mqtt/notify.py index 581660b6ecf..4a5ccc02774 100644 --- a/homeassistant/components/mqtt/notify.py +++ b/homeassistant/components/mqtt/notify.py @@ -15,7 +15,7 @@ from homeassistant.helpers.typing import ConfigType from .config import DEFAULT_RETAIN, MQTT_BASE_SCHEMA from .const import CONF_COMMAND_TEMPLATE, CONF_COMMAND_TOPIC, CONF_RETAIN -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import MqttCommandTemplate from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic diff --git a/homeassistant/components/mqtt/number.py b/homeassistant/components/mqtt/number.py index ce441a2de6e..895334f2e1e 100644 --- a/homeassistant/components/mqtt/number.py +++ b/homeassistant/components/mqtt/number.py @@ -39,7 +39,7 @@ from .const import ( CONF_PAYLOAD_RESET, CONF_STATE_TOPIC, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/scene.py b/homeassistant/components/mqtt/scene.py index 994a77d3abb..dad596d9c4f 100644 --- a/homeassistant/components/mqtt/scene.py +++ b/homeassistant/components/mqtt/scene.py @@ -17,7 +17,7 @@ from homeassistant.helpers.typing import ConfigType from .config import MQTT_BASE_SCHEMA from .const import CONF_COMMAND_TOPIC, CONF_RETAIN -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic diff --git a/homeassistant/components/mqtt/select.py b/homeassistant/components/mqtt/select.py index 5f9c4a11c23..37d3287988f 100644 --- a/homeassistant/components/mqtt/select.py +++ b/homeassistant/components/mqtt/select.py @@ -26,7 +26,7 @@ from .const import ( CONF_OPTIONS, CONF_STATE_TOPIC, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index fc95807b8a5..5b7fbe34b76 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -40,7 +40,7 @@ from homeassistant.util import dt as dt_util from . import subscription from .config import MQTT_RO_SCHEMA from .const import CONF_OPTIONS, CONF_STATE_TOPIC, PAYLOAD_NONE -from .mixins import MqttAvailabilityMixin, MqttEntity, async_setup_entity_entry_helper +from .entity import MqttAvailabilityMixin, MqttEntity, async_setup_entity_entry_helper from .models import MqttValueTemplate, PayloadSentinel, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import check_state_too_long diff --git a/homeassistant/components/mqtt/siren.py b/homeassistant/components/mqtt/siren.py index e7cf9e270bd..1937b60fde0 100644 --- a/homeassistant/components/mqtt/siren.py +++ b/homeassistant/components/mqtt/siren.py @@ -46,7 +46,7 @@ from .const import ( PAYLOAD_EMPTY_JSON, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/switch.py b/homeassistant/components/mqtt/switch.py index 510de7b40dc..a73c4fe53f8 100644 --- a/homeassistant/components/mqtt/switch.py +++ b/homeassistant/components/mqtt/switch.py @@ -34,7 +34,7 @@ from .const import ( CONF_STATE_TOPIC, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/tag.py b/homeassistant/components/mqtt/tag.py index 031c620af4a..680f252fb20 100644 --- a/homeassistant/components/mqtt/tag.py +++ b/homeassistant/components/mqtt/tag.py @@ -20,7 +20,7 @@ from . import subscription from .config import MQTT_BASE_SCHEMA from .const import ATTR_DISCOVERY_HASH, CONF_QOS, CONF_TOPIC from .discovery import MQTTDiscoveryPayload -from .mixins import ( +from .entity import ( MqttDiscoveryDeviceUpdateMixin, async_handle_schema_error, async_setup_non_entity_entry_helper, diff --git a/homeassistant/components/mqtt/text.py b/homeassistant/components/mqtt/text.py index 0db711cc456..edfecfbc038 100644 --- a/homeassistant/components/mqtt/text.py +++ b/homeassistant/components/mqtt/text.py @@ -28,7 +28,7 @@ from homeassistant.helpers.typing import ConfigType, VolSchemaType from . import subscription from .config import MQTT_RW_SCHEMA from .const import CONF_COMMAND_TEMPLATE, CONF_COMMAND_TOPIC, CONF_STATE_TOPIC -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ( MqttCommandTemplate, MqttValueTemplate, diff --git a/homeassistant/components/mqtt/update.py b/homeassistant/components/mqtt/update.py index 4b87e0ef7da..f7bb9f75dd1 100644 --- a/homeassistant/components/mqtt/update.py +++ b/homeassistant/components/mqtt/update.py @@ -25,7 +25,7 @@ from homeassistant.util.json import JSON_DECODE_EXCEPTIONS, json_loads from . import subscription from .config import DEFAULT_RETAIN, MQTT_RO_SCHEMA from .const import CONF_COMMAND_TOPIC, CONF_RETAIN, CONF_STATE_TOPIC, PAYLOAD_EMPTY_JSON -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic, valid_subscribe_topic diff --git a/homeassistant/components/mqtt/vacuum.py b/homeassistant/components/mqtt/vacuum.py index 87d6c9dd744..86b32aa281b 100644 --- a/homeassistant/components/mqtt/vacuum.py +++ b/homeassistant/components/mqtt/vacuum.py @@ -34,7 +34,7 @@ from homeassistant.util.json import json_loads_object from . import subscription from .config import MQTT_BASE_SCHEMA from .const import CONF_COMMAND_TOPIC, CONF_RETAIN, CONF_STATE_TOPIC -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic diff --git a/homeassistant/components/mqtt/valve.py b/homeassistant/components/mqtt/valve.py index 02127dfc19c..05c8ad833a0 100644 --- a/homeassistant/components/mqtt/valve.py +++ b/homeassistant/components/mqtt/valve.py @@ -59,7 +59,7 @@ from .const import ( DEFAULT_RETAIN, PAYLOAD_NONE, ) -from .mixins import MqttEntity, async_setup_entity_entry_helper +from .entity import MqttEntity, async_setup_entity_entry_helper from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic, valid_subscribe_topic diff --git a/homeassistant/components/mqtt/water_heater.py b/homeassistant/components/mqtt/water_heater.py index 13b0478210f..b98d73e0bfe 100644 --- a/homeassistant/components/mqtt/water_heater.py +++ b/homeassistant/components/mqtt/water_heater.py @@ -65,7 +65,7 @@ from .const import ( DEFAULT_OPTIMISTIC, PAYLOAD_NONE, ) -from .mixins import async_setup_entity_entry_helper +from .entity import async_setup_entity_entry_helper from .models import MqttCommandTemplate, MqttValueTemplate, ReceiveMessage from .schemas import MQTT_ENTITY_COMMON_SCHEMA from .util import valid_publish_topic, valid_subscribe_topic diff --git a/tests/components/mqtt/test_common.py b/tests/components/mqtt/test_common.py index c135c29ebc5..b89baf06254 100644 --- a/tests/components/mqtt/test_common.py +++ b/tests/components/mqtt/test_common.py @@ -20,7 +20,7 @@ from homeassistant.components.mqtt.const import ( MQTT_CONNECTION_STATE, SUPPORTED_COMPONENTS, ) -from homeassistant.components.mqtt.mixins import MQTT_ATTRIBUTES_BLOCKED +from homeassistant.components.mqtt.entity import MQTT_ATTRIBUTES_BLOCKED from homeassistant.components.mqtt.models import PublishPayloadType from homeassistant.config_entries import ConfigEntryState from homeassistant.const import ( @@ -1938,7 +1938,7 @@ async def help_test_skipped_async_ha_write_state( ) -> None: """Test entity.async_ha_write_state is only called on changes.""" with patch( - "homeassistant.components.mqtt.mixins.MqttEntity.async_write_ha_state" + "homeassistant.components.mqtt.entity.MqttEntity.async_write_ha_state" ) as mock_async_ha_write_state: assert len(mock_async_ha_write_state.mock_calls) == 0 async_fire_mqtt_message(hass, topic, payload1) diff --git a/tests/components/mqtt/test_event.py b/tests/components/mqtt/test_event.py index 3d4847a406a..ea46f514d3d 100644 --- a/tests/components/mqtt/test_event.py +++ b/tests/components/mqtt/test_event.py @@ -90,7 +90,7 @@ async def test_multiple_events_are_all_updating_the_state( """Test all events are respected and trigger a state write.""" await mqtt_mock_entry() with patch( - "homeassistant.components.mqtt.mixins.MqttEntity.async_write_ha_state" + "homeassistant.components.mqtt.entity.MqttEntity.async_write_ha_state" ) as mock_async_ha_write_state: async_fire_mqtt_message( hass, "test-topic", '{"event_type": "press", "duration": "short" }' @@ -109,7 +109,7 @@ async def test_handling_retained_event_payloads( """Test if event messages with a retained flag are ignored.""" await mqtt_mock_entry() with patch( - "homeassistant.components.mqtt.mixins.MqttEntity.async_write_ha_state" + "homeassistant.components.mqtt.entity.MqttEntity.async_write_ha_state" ) as mock_async_ha_write_state: async_fire_mqtt_message( hass, @@ -752,7 +752,7 @@ async def test_skipped_async_ha_write_state2( payload1 = '{"event_type": "press"}' payload2 = '{"event_type": "unknown"}' with patch( - "homeassistant.components.mqtt.mixins.MqttEntity.async_write_ha_state" + "homeassistant.components.mqtt.entity.MqttEntity.async_write_ha_state" ) as mock_async_ha_write_state: assert len(mock_async_ha_write_state.mock_calls) == 0 async_fire_mqtt_message(hass, topic, payload1) diff --git a/tests/components/mqtt/test_init.py b/tests/components/mqtt/test_init.py index 8f7f7ed6289..562e74bfd1d 100644 --- a/tests/components/mqtt/test_init.py +++ b/tests/components/mqtt/test_init.py @@ -1894,7 +1894,7 @@ async def test_disabling_and_enabling_entry( config_light = '{"name": "test_new", "command_topic": "test-topic_new"}' with patch( - "homeassistant.components.mqtt.mixins.mqtt_config_entry_enabled", + "homeassistant.components.mqtt.entity.mqtt_config_entry_enabled", return_value=False, ): # Discovery of mqtt tag