Skip to content

Commit

Permalink
Evita il warning in debug di asyncio a causa di holidays
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualdj committed Nov 2, 2024
1 parent 84a865b commit 17141bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/pun_sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import random

from awesomeversion.awesomeversion import AwesomeVersion
import holidays
from holidays import country_holidays

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import __version__ as HA_VERSION
Expand All @@ -32,7 +32,7 @@ async def async_setup_entry(hass: HomeAssistant, config: ConfigEntry) -> bool:
# Carica le dipendenze di holidays in background per evitare errori nel log
if AwesomeVersion(HA_VERSION) >= AwesomeVersion("2024.5.0"):
with async_pause_setup(hass, SetupPhases.WAIT_IMPORT_PACKAGES):
await hass.async_add_import_executor_job(holidays.IT) # type: ignore[attr-defined]
await hass.async_add_import_executor_job(country_holidays, "IT")

# Salva il coordinator nella configurazione
coordinator = PUNDataUpdateCoordinator(hass, config)
Expand Down

0 comments on commit 17141bd

Please sign in to comment.