pnbruckner / ha-sun2

Home Assistant Sun2 Sensor
The Unlicense
230 stars 22 forks source link

Move zoneinfo & pytz file I/O to executor #126

Closed pnbruckner closed 5 months ago

pnbruckner commented 5 months ago

Version 2.2 of the astral package, which HA & this integration use, indirectly uses the pytz package when methods are called with "local=True", which this integration does, but HA does not. This can result in file I/O when pytz sees a new time zone name. Starting in HA 2024.6, this will generate a warning.

This PR fixes that by making sure the first call to pytz with a particular time zone name is done in an executor instead of the event loop.

Closes #125