diff --git a/tests/components/derivative/test_sensor.py b/tests/components/derivative/test_sensor.py
index 2d1d7a93afc169332096a887b5288ad0ea2d7b84..5ba00cabd9d66b980bf03e47e90b33a57ab00ab6 100644
--- a/tests/components/derivative/test_sensor.py
+++ b/tests/components/derivative/test_sensor.py
@@ -354,6 +354,7 @@ async def test_device_id(hass: HomeAssistant) -> None:
     entity_registry = er.async_get(hass)
 
     source_config_entry = MockConfigEntry()
+    source_config_entry.add_to_hass(hass)
     source_device_entry = device_registry.async_get_or_create(
         config_entry_id=source_config_entry.entry_id,
         identifiers={("sensor", "identifier_test")},