bremor / bureau_of_meteorology

Custom component for retrieving weather information from the Bureau of Meteorology.
MIT License
186 stars 31 forks source link

Replace pytz with zoneinfo. Fix for #222 #225

Closed dbiczo closed 3 months ago

dbiczo commented 3 months ago

Fix "Detected blocking call to open inside the event loop" warnings by replacing pytz with zoneinfo.

Makin-Things commented 3 months ago

@dbiczo thanks for this PR. For some reason I had not even been getting these warnings (probably because I Only use it for forecast information). I assume you have fully tested that it doesn't break anything else. It looks like a fairly trivial change.

dbiczo commented 3 months ago

Yes, tested over a full day. Havn't tested setup flow but don't think it will affect that.

Makin-Things commented 3 months ago

Awesome. Thanks I will merge and do a release.

Makin-Things commented 3 months ago

I did the release and it broke for me so I have removed it for now. It looks like there is a typo in the fix you submitted. File "/config/custom_components/bureau_of_meteorology/weather.py", line 8, in <module> import zoneifo ModuleNotFoundError: No module named 'zoneifo'

I will edit on main and retry.

Actually I think line 8 should simply be removed since you added the import needed on line 18. Do you agree?

dbiczo commented 3 months ago

Thanks. Sorry for the typo. I tested live on my setup and copied the changes to the pull request.

dbiczo commented 3 months ago

I was copying what was there for pytz and both lines were there.

Makin-Things commented 3 months ago

Yep, they both need to be there. I did a quick test without the first one and got errors. Will do a new release shortly.

Makin-Things commented 3 months ago

Release 1.3.2 is done and gives me no errors.

dbiczo commented 3 months ago

Great. Thanks for you help.

fabienval commented 2 months ago

That commit introduce error #226 since we are no longer using pytz, but pytz.timezone is still referenced for the UV text