From 8ebb60450a70c3ca8772fb50e99c870f52e3f857 Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 1 Apr 2020 20:10:10 +0200 Subject: [PATCH] Add MQTT debug info for remaining MQTT integrations --- .../components/mqtt/alarm_control_panel.py | 2 ++ homeassistant/components/mqtt/binary_sensor.py | 2 ++ homeassistant/components/mqtt/camera.py | 2 ++ homeassistant/components/mqtt/climate.py | 12 ++++++++++++ homeassistant/components/mqtt/cover.py | 8 ++++++-- homeassistant/components/mqtt/fan.py | 4 ++++ .../components/mqtt/light/schema_basic.py | 9 +++++++++ .../components/mqtt/light/schema_json.py | 2 ++ .../components/mqtt/light/schema_template.py | 2 ++ homeassistant/components/mqtt/lock.py | 2 ++ homeassistant/components/mqtt/switch.py | 2 ++ .../components/mqtt/vacuum/schema_legacy.py | 2 ++ .../components/mqtt/vacuum/schema_state.py | 2 ++ .../mqtt/test_alarm_control_panel.py | 8 ++++++++ tests/components/mqtt/test_binary_sensor.py | 8 ++++++++ tests/components/mqtt/test_camera.py | 8 ++++++++ tests/components/mqtt/test_climate.py | 15 +++++++++++++++ tests/components/mqtt/test_cover.py | 8 ++++++++ tests/components/mqtt/test_fan.py | 8 ++++++++ tests/components/mqtt/test_legacy_vacuum.py | 18 ++++++++++++++++++ tests/components/mqtt/test_light.py | 8 ++++++++ tests/components/mqtt/test_light_json.py | 8 ++++++++ tests/components/mqtt/test_light_template.py | 8 ++++++++ tests/components/mqtt/test_lock.py | 8 ++++++++ tests/components/mqtt/test_state_vacuum.py | 8 ++++++++ tests/components/mqtt/test_switch.py | 8 ++++++++ 26 files changed, 170 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/mqtt/alarm_control_panel.py b/homeassistant/components/mqtt/alarm_control_panel.py index 043fa62f6effe..09f735c72a06b 100644 --- a/homeassistant/components/mqtt/alarm_control_panel.py +++ b/homeassistant/components/mqtt/alarm_control_panel.py @@ -41,6 +41,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -167,6 +168,7 @@ async def _subscribe_topics(self): command_template.hass = self.hass @callback + @log_messages(self.hass, self.entity_id) def message_received(msg): """Run when new MQTT message has been received.""" payload = msg.payload diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index d268c12aa8772..c7595de0eebbd 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -37,6 +37,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -155,6 +156,7 @@ def off_delay_listener(now): self.async_write_ha_state() @callback + @log_messages(self.hass, self.entity_id) def state_message_received(msg): """Handle a new received MQTT state message.""" payload = msg.payload diff --git a/homeassistant/components/mqtt/camera.py b/homeassistant/components/mqtt/camera.py index a75ae33f86197..1bfb248d94ad8 100644 --- a/homeassistant/components/mqtt/camera.py +++ b/homeassistant/components/mqtt/camera.py @@ -21,6 +21,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -116,6 +117,7 @@ async def _subscribe_topics(self): """(Re)Subscribe to topics.""" @callback + @log_messages(self.hass, self.entity_id) def message_received(msg): """Handle new MQTT messages.""" self._last_image = msg.payload diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 46404de0c8a77..0216302c6515e 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -60,6 +60,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -384,6 +385,7 @@ def render_template(msg, template_name): return template(msg.payload) @callback + @log_messages(self.hass, self.entity_id) def handle_action_received(msg): """Handle receiving action via MQTT.""" payload = render_template(msg, CONF_ACTION_TEMPLATE) @@ -405,6 +407,7 @@ def handle_temperature_received(msg, template_name, attr): _LOGGER.error("Could not parse temperature from %s", payload) @callback + @log_messages(self.hass, self.entity_id) def handle_current_temperature_received(msg): """Handle current temperature coming via MQTT.""" handle_temperature_received( @@ -416,6 +419,7 @@ def handle_current_temperature_received(msg): ) @callback + @log_messages(self.hass, self.entity_id) def handle_target_temperature_received(msg): """Handle target temperature coming via MQTT.""" handle_temperature_received(msg, CONF_TEMP_STATE_TEMPLATE, "_target_temp") @@ -425,6 +429,7 @@ def handle_target_temperature_received(msg): ) @callback + @log_messages(self.hass, self.entity_id) def handle_temperature_low_received(msg): """Handle target temperature low coming via MQTT.""" handle_temperature_received( @@ -436,6 +441,7 @@ def handle_temperature_low_received(msg): ) @callback + @log_messages(self.hass, self.entity_id) def handle_temperature_high_received(msg): """Handle target temperature high coming via MQTT.""" handle_temperature_received( @@ -458,6 +464,7 @@ def handle_mode_received(msg, template_name, attr, mode_list): self.async_write_ha_state() @callback + @log_messages(self.hass, self.entity_id) def handle_current_mode_received(msg): """Handle receiving mode via MQTT.""" handle_mode_received( @@ -467,6 +474,7 @@ def handle_current_mode_received(msg): add_subscription(topics, CONF_MODE_STATE_TOPIC, handle_current_mode_received) @callback + @log_messages(self.hass, self.entity_id) def handle_fan_mode_received(msg): """Handle receiving fan mode via MQTT.""" handle_mode_received( @@ -479,6 +487,7 @@ def handle_fan_mode_received(msg): add_subscription(topics, CONF_FAN_MODE_STATE_TOPIC, handle_fan_mode_received) @callback + @log_messages(self.hass, self.entity_id) def handle_swing_mode_received(msg): """Handle receiving swing mode via MQTT.""" handle_mode_received( @@ -514,6 +523,7 @@ def handle_onoff_mode_received(msg, template_name, attr): self.async_write_ha_state() @callback + @log_messages(self.hass, self.entity_id) def handle_away_mode_received(msg): """Handle receiving away mode via MQTT.""" handle_onoff_mode_received(msg, CONF_AWAY_MODE_STATE_TEMPLATE, "_away") @@ -521,6 +531,7 @@ def handle_away_mode_received(msg): add_subscription(topics, CONF_AWAY_MODE_STATE_TOPIC, handle_away_mode_received) @callback + @log_messages(self.hass, self.entity_id) def handle_aux_mode_received(msg): """Handle receiving aux mode via MQTT.""" handle_onoff_mode_received(msg, CONF_AUX_STATE_TEMPLATE, "_aux") @@ -528,6 +539,7 @@ def handle_aux_mode_received(msg): add_subscription(topics, CONF_AUX_STATE_TOPIC, handle_aux_mode_received) @callback + @log_messages(self.hass, self.entity_id) def handle_hold_mode_received(msg): """Handle receiving hold mode via MQTT.""" payload = render_template(msg, CONF_HOLD_STATE_TEMPLATE) diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index a7a396781928e..3081c1d0d9ff1 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -49,6 +49,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -268,7 +269,8 @@ async def _subscribe_topics(self): topics = {} @callback - def tilt_updated(msg): + @log_messages(self.hass, self.entity_id) + def tilt_message_received(msg): """Handle tilt updates.""" payload = msg.payload if tilt_status_template is not None: @@ -287,6 +289,7 @@ def tilt_updated(msg): self.async_write_ha_state() @callback + @log_messages(self.hass, self.entity_id) def state_message_received(msg): """Handle new MQTT state messages.""" payload = msg.payload @@ -311,6 +314,7 @@ def state_message_received(msg): self.async_write_ha_state() @callback + @log_messages(self.hass, self.entity_id) def position_message_received(msg): """Handle new MQTT state messages.""" payload = msg.payload @@ -354,7 +358,7 @@ def position_message_received(msg): self._tilt_value = STATE_UNKNOWN topics["tilt_status_topic"] = { "topic": self._config.get(CONF_TILT_STATUS_TOPIC), - "msg_callback": tilt_updated, + "msg_callback": tilt_message_received, "qos": self._config[CONF_QOS], } diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index b50bdf9734bb0..ec7c729d5976d 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -40,6 +40,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -249,6 +250,7 @@ async def _subscribe_topics(self): templates[key] = tpl.async_render_with_possible_json_value @callback + @log_messages(self.hass, self.entity_id) def state_received(msg): """Handle new received MQTT message.""" payload = templates[CONF_STATE](msg.payload) @@ -266,6 +268,7 @@ def state_received(msg): } @callback + @log_messages(self.hass, self.entity_id) def speed_received(msg): """Handle new received MQTT message for the speed.""" payload = templates[ATTR_SPEED](msg.payload) @@ -288,6 +291,7 @@ def speed_received(msg): self._speed = SPEED_OFF @callback + @log_messages(self.hass, self.entity_id) def oscillation_received(msg): """Handle new received MQTT message for the oscillation.""" payload = templates[OSCILLATION](msg.payload) diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index 4b47014af486a..e6a7f827f1e2c 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -51,6 +51,7 @@ from homeassistant.helpers.restore_state import RestoreEntity import homeassistant.util.color as color_util +from ..debug_info import log_messages from .schema import MQTT_LIGHT_SCHEMA_SCHEMA _LOGGER = logging.getLogger(__name__) @@ -292,6 +293,7 @@ async def _subscribe_topics(self): last_state = await self.async_get_last_state() @callback + @log_messages(self.hass, self.entity_id) def state_received(msg): """Handle new MQTT messages.""" payload = templates[CONF_STATE](msg.payload) @@ -315,6 +317,7 @@ def state_received(msg): self._state = last_state.state == STATE_ON @callback + @log_messages(self.hass, self.entity_id) def brightness_received(msg): """Handle new MQTT messages for the brightness.""" payload = templates[CONF_BRIGHTNESS](msg.payload) @@ -346,6 +349,7 @@ def brightness_received(msg): self._brightness = None @callback + @log_messages(self.hass, self.entity_id) def rgb_received(msg): """Handle new MQTT messages for RGB.""" payload = templates[CONF_RGB](msg.payload) @@ -377,6 +381,7 @@ def rgb_received(msg): self._hs = (0, 0) @callback + @log_messages(self.hass, self.entity_id) def color_temp_received(msg): """Handle new MQTT messages for color temperature.""" payload = templates[CONF_COLOR_TEMP](msg.payload) @@ -406,6 +411,7 @@ def color_temp_received(msg): self._color_temp = None @callback + @log_messages(self.hass, self.entity_id) def effect_received(msg): """Handle new MQTT messages for effect.""" payload = templates[CONF_EFFECT](msg.payload) @@ -435,6 +441,7 @@ def effect_received(msg): self._effect = None @callback + @log_messages(self.hass, self.entity_id) def hs_received(msg): """Handle new MQTT messages for hs color.""" payload = templates[CONF_HS](msg.payload) @@ -466,6 +473,7 @@ def hs_received(msg): self._hs = (0, 0) @callback + @log_messages(self.hass, self.entity_id) def white_value_received(msg): """Handle new MQTT messages for white value.""" payload = templates[CONF_WHITE_VALUE](msg.payload) @@ -497,6 +505,7 @@ def white_value_received(msg): self._white_value = None @callback + @log_messages(self.hass, self.entity_id) def xy_received(msg): """Handle new MQTT messages for xy color.""" payload = templates[CONF_XY](msg.payload) diff --git a/homeassistant/components/mqtt/light/schema_json.py b/homeassistant/components/mqtt/light/schema_json.py index 0af5aaf2c76ed..924559e3e9048 100644 --- a/homeassistant/components/mqtt/light/schema_json.py +++ b/homeassistant/components/mqtt/light/schema_json.py @@ -54,6 +54,7 @@ from homeassistant.helpers.typing import ConfigType import homeassistant.util.color as color_util +from ..debug_info import log_messages from .schema import MQTT_LIGHT_SCHEMA_SCHEMA from .schema_basic import CONF_BRIGHTNESS_SCALE @@ -234,6 +235,7 @@ async def _subscribe_topics(self): last_state = await self.async_get_last_state() @callback + @log_messages(self.hass, self.entity_id) def state_received(msg): """Handle new MQTT messages.""" values = json.loads(msg.payload) diff --git a/homeassistant/components/mqtt/light/schema_template.py b/homeassistant/components/mqtt/light/schema_template.py index cd3e704f624a2..25de6862bdb65 100644 --- a/homeassistant/components/mqtt/light/schema_template.py +++ b/homeassistant/components/mqtt/light/schema_template.py @@ -45,6 +45,7 @@ from homeassistant.helpers.restore_state import RestoreEntity import homeassistant.util.color as color_util +from ..debug_info import log_messages from .schema import MQTT_LIGHT_SCHEMA_SCHEMA _LOGGER = logging.getLogger(__name__) @@ -215,6 +216,7 @@ async def _subscribe_topics(self): last_state = await self.async_get_last_state() @callback + @log_messages(self.hass, self.entity_id) def state_received(msg): """Handle new MQTT messages.""" state = self._templates[ diff --git a/homeassistant/components/mqtt/lock.py b/homeassistant/components/mqtt/lock.py index 89f005b74694e..378f1b8fbcb6d 100644 --- a/homeassistant/components/mqtt/lock.py +++ b/homeassistant/components/mqtt/lock.py @@ -29,6 +29,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -156,6 +157,7 @@ async def _subscribe_topics(self): value_template.hass = self.hass @callback + @log_messages(self.hass, self.entity_id) def message_received(msg): """Handle new MQTT messages.""" payload = msg.payload diff --git a/homeassistant/components/mqtt/switch.py b/homeassistant/components/mqtt/switch.py index 32066c67b7aca..bc1f4a038b42b 100644 --- a/homeassistant/components/mqtt/switch.py +++ b/homeassistant/components/mqtt/switch.py @@ -34,6 +34,7 @@ MqttEntityDeviceInfo, subscription, ) +from .debug_info import log_messages from .discovery import MQTT_DISCOVERY_NEW, clear_discovery_hash _LOGGER = logging.getLogger(__name__) @@ -162,6 +163,7 @@ async def _subscribe_topics(self): template.hass = self.hass @callback + @log_messages(self.hass, self.entity_id) def state_message_received(msg): """Handle new MQTT state messages.""" payload = msg.payload diff --git a/homeassistant/components/mqtt/vacuum/schema_legacy.py b/homeassistant/components/mqtt/vacuum/schema_legacy.py index 7679b97d62e4b..687fefa94e215 100644 --- a/homeassistant/components/mqtt/vacuum/schema_legacy.py +++ b/homeassistant/components/mqtt/vacuum/schema_legacy.py @@ -32,6 +32,7 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.icon import icon_for_battery_level +from ..debug_info import log_messages from .schema import MQTT_VACUUM_SCHEMA, services_to_strings, strings_to_services _LOGGER = logging.getLogger(__name__) @@ -280,6 +281,7 @@ async def _subscribe_topics(self): tpl.hass = self.hass @callback + @log_messages(self.hass, self.entity_id) def message_received(msg): """Handle new MQTT message.""" if ( diff --git a/homeassistant/components/mqtt/vacuum/schema_state.py b/homeassistant/components/mqtt/vacuum/schema_state.py index 126a2432cb09c..cbaf8d43a77e3 100644 --- a/homeassistant/components/mqtt/vacuum/schema_state.py +++ b/homeassistant/components/mqtt/vacuum/schema_state.py @@ -45,6 +45,7 @@ from homeassistant.core import callback import homeassistant.helpers.config_validation as cv +from ..debug_info import log_messages from .schema import MQTT_VACUUM_SCHEMA, services_to_strings, strings_to_services _LOGGER = logging.getLogger(__name__) @@ -246,6 +247,7 @@ async def _subscribe_topics(self): topics = {} @callback + @log_messages(self.hass, self.entity_id) def state_message_received(msg): """Handle state MQTT message.""" payload = msg.payload diff --git a/tests/components/mqtt/test_alarm_control_panel.py b/tests/components/mqtt/test_alarm_control_panel.py index 45c123fa2fe49..ba1855247fe45 100644 --- a/tests/components/mqtt/test_alarm_control_panel.py +++ b/tests/components/mqtt/test_alarm_control_panel.py @@ -21,6 +21,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -494,3 +495,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, alarm_control_panel.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_binary_sensor.py b/tests/components/mqtt/test_binary_sensor.py index a73919844c1c1..07a1c8b6e5f97 100644 --- a/tests/components/mqtt/test_binary_sensor.py +++ b/tests/components/mqtt/test_binary_sensor.py @@ -23,6 +23,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -508,3 +509,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, binary_sensor.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_camera.py b/tests/components/mqtt/test_camera.py index 21f552b4163fd..cefeda0409786 100644 --- a/tests/components/mqtt/test_camera.py +++ b/tests/components/mqtt/test_camera.py @@ -13,6 +13,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -207,3 +208,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, camera.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, camera.DOMAIN, DEFAULT_CONFIG, "test_topic", b"ON" + ) diff --git a/tests/components/mqtt/test_climate.py b/tests/components/mqtt/test_climate.py index ce21aa53d2759..d5b303a51f07d 100644 --- a/tests/components/mqtt/test_climate.py +++ b/tests/components/mqtt/test_climate.py @@ -33,6 +33,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -908,6 +909,20 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): ) +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + config = { + CLIMATE_DOMAIN: { + "platform": "mqtt", + "name": "test", + "mode_state_topic": "test-topic", + } + } + await help_test_entity_debug_info_message( + hass, mqtt_mock, CLIMATE_DOMAIN, config, "test-topic" + ) + + async def test_precision_default(hass, mqtt_mock): """Test that setting precision to tenths works as intended.""" assert await async_setup_component(hass, CLIMATE_DOMAIN, DEFAULT_CONFIG) diff --git a/tests/components/mqtt/test_cover.py b/tests/components/mqtt/test_cover.py index 7749c419ca035..7d0753a9de2e7 100644 --- a/tests/components/mqtt/test_cover.py +++ b/tests/components/mqtt/test_cover.py @@ -30,6 +30,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -1762,3 +1763,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, cover.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_fan.py b/tests/components/mqtt/test_fan.py index 460c99618bd48..6b774e9d5ce4b 100644 --- a/tests/components/mqtt/test_fan.py +++ b/tests/components/mqtt/test_fan.py @@ -11,6 +11,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -509,3 +510,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, fan.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_legacy_vacuum.py b/tests/components/mqtt/test_legacy_vacuum.py index 14ab79b2d202a..0ddb661cf8575 100644 --- a/tests/components/mqtt/test_legacy_vacuum.py +++ b/tests/components/mqtt/test_legacy_vacuum.py @@ -27,6 +27,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -629,3 +630,20 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, vacuum.DOMAIN, DEFAULT_CONFIG_2 ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + config = { + vacuum.DOMAIN: { + "platform": "mqtt", + "name": "test", + "battery_level_topic": "test-topic", + "battery_level_template": "{{ value_json.battery_level }}", + "command_topic": "command-topic", + "availability_topic": "avty-topic", + } + } + await help_test_entity_debug_info_message( + hass, mqtt_mock, vacuum.DOMAIN, config, "test-topic" + ) diff --git a/tests/components/mqtt/test_light.py b/tests/components/mqtt/test_light.py index bc4f5fc339394..45473d6f448e9 100644 --- a/tests/components/mqtt/test_light.py +++ b/tests/components/mqtt/test_light.py @@ -170,6 +170,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -1358,3 +1359,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_light_json.py b/tests/components/mqtt/test_light_json.py index f71791e019fc0..1223f3525c4ee 100644 --- a/tests/components/mqtt/test_light_json.py +++ b/tests/components/mqtt/test_light_json.py @@ -109,6 +109,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -1134,3 +1135,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_light_template.py b/tests/components/mqtt/test_light_template.py index c9612a7ded787..37617192dd568 100644 --- a/tests/components/mqtt/test_light_template.py +++ b/tests/components/mqtt/test_light_template.py @@ -46,6 +46,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -957,3 +958,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, light.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_lock.py b/tests/components/mqtt/test_lock.py index 151021a45f802..803fd6c3ab388 100644 --- a/tests/components/mqtt/test_lock.py +++ b/tests/components/mqtt/test_lock.py @@ -11,6 +11,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -399,3 +400,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, lock.DOMAIN, DEFAULT_CONFIG + ) diff --git a/tests/components/mqtt/test_state_vacuum.py b/tests/components/mqtt/test_state_vacuum.py index ecb38ef5774ea..367b9ceda8a8d 100644 --- a/tests/components/mqtt/test_state_vacuum.py +++ b/tests/components/mqtt/test_state_vacuum.py @@ -38,6 +38,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -454,3 +455,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, vacuum.DOMAIN, DEFAULT_CONFIG_2 ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, vacuum.DOMAIN, DEFAULT_CONFIG_2 + ) diff --git a/tests/components/mqtt/test_switch.py b/tests/components/mqtt/test_switch.py index d8ca803139011..1aaeb154dc250 100644 --- a/tests/components/mqtt/test_switch.py +++ b/tests/components/mqtt/test_switch.py @@ -15,6 +15,7 @@ help_test_discovery_removal, help_test_discovery_update, help_test_discovery_update_attr, + help_test_entity_debug_info_message, help_test_entity_device_info_remove, help_test_entity_device_info_update, help_test_entity_device_info_with_connection, @@ -366,3 +367,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock): await help_test_entity_id_update_discovery_update( hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG ) + + +async def test_entity_debug_info_message(hass, mqtt_mock): + """Test MQTT debug info.""" + await help_test_entity_debug_info_message( + hass, mqtt_mock, switch.DOMAIN, DEFAULT_CONFIG + )