File: example.py

package info (click to toggle)
pyvlx 0.2.26-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,464 kB
  • sloc: python: 7,901; makefile: 39; sh: 5
file content (29 lines) | stat: -rw-r--r-- 700 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Example implementation for PyVLX."""
import asyncio
from pyvlx import PyVLX


async def main():
    """Load devices and scenes, run first scene."""
    pyvlx = PyVLX('pyvlx.yaml')
    # Alternative:
    # pyvlx = PyVLX(host="192.168.2.127", password="velux123", timeout=60)

    await pyvlx.load_devices()
    print(pyvlx.devices[1])
    print(pyvlx.devices['Fenster 4'])

    await pyvlx.load_scenes()
    print(pyvlx.scenes[0])
    print(pyvlx.scenes['Bath Closed'])

    # opening/ closing windows by running scenes, yay!
    await pyvlx.scenes[1].run()

    await pyvlx.disconnect()


# pylint: disable=invalid-name
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()