aiodiscover
raw JSON → 2.7.1 verified Fri May 01 auth: no python
Async host discovery via ARP and PTR lookup, used primarily in home automation projects like Home Assistant. Current version: 2.7.1. Release cadence: frequent, every few months.
pip install aiodiscover Common errors
error ModuleNotFoundError: No module named 'aiodiscover' ↓
cause Library not installed in the current Python environment.
fix
pip install aiodiscover
error PermissionError: [Errno 1] Operation not permitted ↓
cause Raw socket creation requires root privileges on Linux.
fix
Run the script with sudo or as root.
error ImportError: cannot import name 'AIODiscover' from 'aiodiscover.discover' ↓
cause Incorrect import path; the public class is directly in aiodiscover.
fix
Use 'from aiodiscover import AIODiscover'
Warnings
breaking v2.7.0 changed DNSResolver to a single shared instance – code relying on separate resolvers per call may break. ↓
fix Rely on internal resolver management; do not instantiate multiple AIODiscover objects.
gotcha Requires root/sudo on Linux to send ARP packets via raw socket. ↓
fix Run script with sudo, or use Docker with NET_ADMIN capability.
deprecated async_timeout is required only for Python <3.11; it's optional for 3.11+. ↓
fix For Python >=3.11, no extra needed; for older versions, install async_timeout.
Imports
- AIODiscover wrong
from aiodiscover.discover import AIODiscovercorrectfrom aiodiscover import AIODiscover
Quickstart
import asyncio
from aiodiscover import AIODiscover
async def main():
discover = AIODiscover()
hosts = await discover.async_discover()
print(hosts)
asyncio.run(main())