File: simple.py

package info (click to toggle)
pyjvcprojector 1.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: python: 966; makefile: 13; sh: 5
file content (46 lines) | stat: -rw-r--r-- 990 bytes parent folder | download
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import asyncio
import logging

from jvcprojector.projector import JvcProjector
from jvcprojector import const

logging.basicConfig(level=logging.WARNING)


async def main():
    jp = JvcProjector("192.168.0.30")
    await jp.connect()

    print("Projector info:")
    print(await jp.get_info())

    if await jp.get_power() != const.ON:
        await jp.power_on()
        print("Waiting for projector to warmup...")
        while await jp.get_power() != const.ON:
            await asyncio.sleep(3)

    print("Current state:")
    print(await jp.get_state())

    #
    # Example of sending remote codes
    #
    print("Showing info")
    await jp.remote(const.REMOTE_INFO)
    await asyncio.sleep(5)

    print("Hiding info")
    await jp.remote(const.REMOTE_BACK)

    #
    # Example of reference command (reads value from function)
    #
    print("Picture mode info:")
    print(await jp.ref("PMPM"))

    await jp.disconnect()


if __name__ == "__main__":
    asyncio.run(main())