File: example-discovery.py

package info (click to toggle)
python-mystrom 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 292 kB
  • sloc: python: 901; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import asyncio

from pymystrom import discovery


async def main():
    """Sample code to work with discovery."""
    # Discover all bulbs in the network via broadcast datagram (UDP)
    bulbs = await discovery.discover_devices()
    print(f"Number of detected bulbs: {len(bulbs)}")


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())