Module pyatv.helpers
Various helper methods.
Functions
-
async def auto_connect(handler: Callable[[AppleTV], NoneType], timeout: int = 5, not_found: Callable[[], NoneType] = None, loop: Optional[asyncio.events.AbstractEventLoop] = None) -> NoneType -
Connect to first discovered device.
This is a convenience method that auto discovers devices, picks the first device found, connects to it and passes it to a user provided handler. An optional error handler can be provided that is called when no device was found. Very inflexible in many cases, but can be handys sometimes when trying things.
Note: both handler and not_found must be coroutines
-
def get_unique_id(service_type: str, service_name: str, properties: Mapping[str, str]) -> Optional[str] -
Return unique identifier from a Zeroconf service.
service_typeis the Zeroconf service type (e.g. _mediaremotetv._tcp.local),service_namename of the service (e.g. Office or Living Room) andpropertiesall key-value properties belonging to the service.The unique identifier is returned if available, otherwise
Noneis returned.