Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [1.2.6] - 2026-03-18

### Fixed
- **Blocking `open()` call inside the event loop:** replaced the synchronous `open(tmp_path, "wb")` used during chunk-writing with `aiofiles.open()` so that file I/O is no longer performed on the event-loop thread. This resolves the `homeassistant.util.loop` warning *"Detected blocking call to open … inside the event loop"*. `aiofiles>=23.1.0` has been added as a runtime requirement.

---

## [1.2.5] - 2026-03-11

### Changed
Expand Down Expand Up @@ -236,6 +243,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Service `media_downloader.download_file` with optional subdirectories, custom filenames, overwrite control, and per-download timeout.
- Events: `media_downloader_download_started`, `media_downloader_download_completed` (with `success` and `error` fields).

[1.2.6]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.5...v1.2.6
[1.2.5]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.4...v1.2.5
[1.2.4]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.3...v1.2.4
[1.2.3]: https://github.com/Geek-MD/Advanced_Downloader/compare/v1.2.2...v1.2.3
Expand Down
5 changes: 3 additions & 2 deletions custom_components/advanced_downloader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import sys
import aiofiles
import aiohttp
import logging
from pathlib import Path
Expand Down Expand Up @@ -186,10 +187,10 @@ async def _async_download(call: ServiceCall) -> None:
async with session.get(url) as resp:
if resp.status != 200:
raise HomeAssistantError(f"HTTP error {resp.status}: {url}")
with open(tmp_path, "wb") as f:
async with aiofiles.open(tmp_path, "wb") as f:
async for chunk in resp.content.iter_chunked(1024 * 64):
if chunk:
f.write(chunk)
await f.write(chunk)

if dest_path.exists() and not do_overwrite:
raise HomeAssistantError(f"File exists and overwrite is False: {dest_path}")
Expand Down
4 changes: 2 additions & 2 deletions custom_components/advanced_downloader/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/Geek-MD/Advanced_Downloader/issues",
"quality_scale": "legacy",
"requirements": [],
"version": "1.2.5"
"requirements": ["aiofiles>=23.1.0"],
"version": "1.2.6"
}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ mypy==1.10.0
ruff==0.14.3
pytest==8.3.2
voluptuous==0.15.2
types-aiofiles>=23.1.0
Loading