python-kasa/examples/discover.py
Teemu R 71ac1f043a 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
2017-01-08 06:44:57 +08:00

10 lines
220 B
Python

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)