mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-11 09:58:01 +00:00
Add device discovery (#25)
* add (untested) discover mode * Keep discovery and normal communication separate, uppercase magic consts This sepearates the earlier test code for discovering devices, and adds 5 sec timeout for gathering responses from potential devices. This commit also uppercases magic constants. Discovery & communication tested with HS110. * update readme with example how to discover devices, pep8ify
This commit is contained in:
9
examples/discover.py
Normal file
9
examples/discover.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import logging
|
||||
from pprint import pprint as pp
|
||||
|
||||
from pyHS100 import TPLinkSmartHomeProtocol
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
for dev in TPLinkSmartHomeProtocol.discover():
|
||||
print("Found device!")
|
||||
pp(dev)
|
Reference in New Issue
Block a user