diff --git a/homeassistant/components/tibber/coordinator.py b/homeassistant/components/tibber/coordinator.py index 78841f9db91..2de9ebd1ec6 100644 --- a/homeassistant/components/tibber/coordinator.py +++ b/homeassistant/components/tibber/coordinator.py @@ -33,11 +33,17 @@ class TibberDataCoordinator(DataUpdateCoordinator[None]): config_entry: ConfigEntry - def __init__(self, hass: HomeAssistant, tibber_connection: tibber.Tibber) -> None: + def __init__( + self, + hass: HomeAssistant, + config_entry: ConfigEntry, + tibber_connection: tibber.Tibber, + ) -> None: """Initialize the data handler.""" super().__init__( hass, _LOGGER, + config_entry=config_entry, name=f"Tibber {tibber_connection.name}", update_interval=timedelta(minutes=20), ) diff --git a/homeassistant/components/tibber/sensor.py b/homeassistant/components/tibber/sensor.py index c1ec7bf2a9e..c14a62bb608 100644 --- a/homeassistant/components/tibber/sensor.py +++ b/homeassistant/components/tibber/sensor.py @@ -285,7 +285,7 @@ async def async_setup_entry( if home.has_active_subscription: entities.append(TibberSensorElPrice(home)) if coordinator is None: - coordinator = TibberDataCoordinator(hass, tibber_connection) + coordinator = TibberDataCoordinator(hass, entry, tibber_connection) entities.extend( TibberDataSensor(home, coordinator, entity_description) for entity_description in SENSORS diff --git a/tests/components/tibber/test_statistics.py b/tests/components/tibber/test_statistics.py index d817c9612aa..845df86a88c 100644 --- a/tests/components/tibber/test_statistics.py +++ b/tests/components/tibber/test_statistics.py @@ -10,10 +10,13 @@ from homeassistant.util import dt as dt_util from .test_common import CONSUMPTION_DATA_1, PRODUCTION_DATA_1, mock_get_homes +from tests.common import MockConfigEntry from tests.components.recorder.common import async_wait_recording_done -async def test_async_setup_entry(recorder_mock: Recorder, hass: HomeAssistant) -> None: +async def test_async_setup_entry( + recorder_mock: Recorder, hass: HomeAssistant, config_entry: MockConfigEntry +) -> None: """Test setup Tibber.""" tibber_connection = AsyncMock() tibber_connection.name = "tibber" @@ -21,7 +24,7 @@ async def test_async_setup_entry(recorder_mock: Recorder, hass: HomeAssistant) - tibber_connection.fetch_production_data_active_homes.return_value = None tibber_connection.get_homes = mock_get_homes - coordinator = TibberDataCoordinator(hass, tibber_connection) + coordinator = TibberDataCoordinator(hass, config_entry, tibber_connection) await coordinator._async_update_data() await async_wait_recording_done(hass)