Util¶
Utilities Module
-
pyhap.util.
event_wait
(event, timeout)[source]¶ Wait for the given event to be set or for the timeout to expire.
Parameters: - event (asyncio.Event) – The event to wait for.
- timeout (float) – The timeout for which to wait, in seconds.
Returns: event.is_set()
Return type: bool
-
pyhap.util.
generate_mac
()[source]¶ Generates a fake mac address used in broadcast.
Returns: MAC address in format XX:XX:XX:XX:XX:XX Return type: str
-
pyhap.util.
generate_pincode
()[source]¶ Generates a random pincode.
Returns: pincode in format xxx-xx-xxx
Return type: bytearray
-
pyhap.util.
generate_setup_id
()[source]¶ Generates a random Setup ID for an
Accessory
orBridge
.Used in QR codes and the setup hash.
Returns: 4 digit alphanumeric code. Return type: str
-
pyhap.util.
get_local_address
() → str[source]¶ Grabs the local IP address using a socket.
Returns: Local IP Address in IPv4 format. Return type: str
-
pyhap.util.
iscoro
(func)[source]¶ Check if the function is a coroutine or if the function is a
functools.partial
, check the wrapped function for the same.