diff --git a/tests/components/mqtt/test_event.py b/tests/components/mqtt/test_event.py
index e78d3bd1d33a43897b6769c2a2d81ff66d783ba8..abcd6e8f3ee11b09254fe69e23e3ab36eee714bd 100644
--- a/tests/components/mqtt/test_event.py
+++ b/tests/components/mqtt/test_event.py
@@ -48,7 +48,7 @@ from .test_common import (
     help_test_update_with_json_attrs_not_dict,
 )
 
-from tests.common import async_fire_mqtt_message
+from tests.common import MockConfigEntry, async_fire_mqtt_message
 from tests.typing import MqttMockHAClientGenerator, MqttMockPahoClient
 
 DEFAULT_CONFIG = {
@@ -503,9 +503,11 @@ async def test_entity_device_info_with_hub(
 ) -> None:
     """Test MQTT event device registry integration."""
     await mqtt_mock_entry()
+    other_config_entry = MockConfigEntry()
+    other_config_entry.add_to_hass(hass)
     registry = dr.async_get(hass)
     hub = registry.async_get_or_create(
-        config_entry_id="123",
+        config_entry_id=other_config_entry.entry_id,
         connections=set(),
         identifiers={("mqtt", "hub-id")},
         manufacturer="manufacturer",