mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-24 08:18:01 +00:00
add typing hints to make it easier for 3rd party developers to use the library (#90)
* add typing hints to make it easier for 3rd party developers to use the library * remove unused devicetype enum to support python3.3 * add python 3.3 to travis and tox, install typing module in setup.py
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import socket
|
||||
import logging
|
||||
import json
|
||||
from typing import Dict
|
||||
|
||||
from pyHS100 import TPLinkSmartHomeProtocol, SmartPlug, SmartBulb
|
||||
from pyHS100 import TPLinkSmartHomeProtocol, SmartDevice, SmartPlug, SmartBulb
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Discover:
|
||||
@staticmethod
|
||||
def discover(protocol=None, port=9999, timeout=3):
|
||||
def discover(protocol: TPLinkSmartHomeProtocol = None,
|
||||
port: int = 9999,
|
||||
timeout: int = 3) -> Dict[str, SmartDevice]:
|
||||
"""
|
||||
Sends discovery message to 255.255.255.255:9999 in order
|
||||
to detect available supported devices in the local network,
|
||||
and waits for given timeout for answers from devices.
|
||||
|
||||
:param protocol: Protocol implementation to use
|
||||
:param timeout: How long to wait for responses, defaults to 5
|
||||
:param port: port to send broadcast messages, defaults to 9999.
|
||||
:rtype: dict
|
||||
|
||||
Reference in New Issue
Block a user