mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-21 22:51:41 +01:00
Standardize ip_address option (#630)
This commit is contained in:
parent
11febb043b
commit
9873af9bc4
@ -192,7 +192,7 @@ def gendevice(
|
||||
|
||||
|
||||
def hello(
|
||||
host: str,
|
||||
ip_address: str,
|
||||
port: int = DEFAULT_PORT,
|
||||
timeout: int = DEFAULT_TIMEOUT,
|
||||
) -> Device:
|
||||
@ -202,7 +202,11 @@ def hello(
|
||||
"""
|
||||
try:
|
||||
return next(
|
||||
xdiscover(timeout=timeout, discover_ip_address=host, discover_ip_port=port)
|
||||
xdiscover(
|
||||
timeout=timeout,
|
||||
discover_ip_address=ip_address,
|
||||
discover_ip_port=port,
|
||||
)
|
||||
)
|
||||
except StopIteration as err:
|
||||
raise e.NetworkTimeoutError(
|
||||
|
@ -76,7 +76,7 @@ def scan(
|
||||
conn.close()
|
||||
|
||||
|
||||
def ping(address: str, port: int = DEFAULT_PORT) -> None:
|
||||
def ping(ip_address: str, port: int = DEFAULT_PORT) -> None:
|
||||
"""Send a ping packet to an address.
|
||||
|
||||
This packet feeds the watchdog timer of firmwares >= v53.
|
||||
@ -87,7 +87,7 @@ def ping(address: str, port: int = DEFAULT_PORT) -> None:
|
||||
conn.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||
packet = bytearray(0x30)
|
||||
packet[0x26] = 1
|
||||
conn.sendto(packet, (address, port))
|
||||
conn.sendto(packet, (ip_address, port))
|
||||
|
||||
|
||||
class Device:
|
||||
|
Loading…
Reference in New Issue
Block a user