diff --git a/homeassistant/components/energy/validate.py b/homeassistant/components/energy/validate.py index d9cd9a73aa0..e48a576f44e 100644 --- a/homeassistant/components/energy/validate.py +++ b/homeassistant/components/energy/validate.py @@ -489,7 +489,7 @@ async def async_validate(hass: HomeAssistant) -> EnergyPreferencesValidation: # Fetch the needed statistics metadata statistics_metadata.update( - await hass.async_add_executor_job( + await recorder.get_instance(hass).async_add_executor_job( functools.partial( recorder.statistics.get_metadata, hass, diff --git a/homeassistant/components/energy/websocket_api.py b/homeassistant/components/energy/websocket_api.py index 3d47d6e894b..ad77308b410 100644 --- a/homeassistant/components/energy/websocket_api.py +++ b/homeassistant/components/energy/websocket_api.py @@ -260,7 +260,7 @@ async def ws_get_fossil_energy_consumption( statistic_ids.append(msg["co2_statistic_id"]) # Fetch energy + CO2 statistics - statistics = await hass.async_add_executor_job( + statistics = await recorder.get_instance(hass).async_add_executor_job( recorder.statistics.statistics_during_period, hass, start_time,