File: usertests.py

package info (click to toggle)
python-advantage-air 0.4.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80 kB
  • sloc: python: 171; makefile: 4
file content (36 lines) | stat: -rw-r--r-- 941 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
30
31
32
33
34
35
36
import asyncio
import aiohttp
from advantage_air import advantage_air

target = input("Enter the IP or hostname of your Advantage Air tablet: ")

async def main():
    async with aiohttp.ClientSession() as session:
        aa = advantage_air(target,port=2025,session=session,retry=5)

        print("> Auto Fan Test")
        print()

        # Get data
        data = await aa.async_get()
        for ac in data['aircons']:
            print(ac, "fan is", data['aircons'][ac]['info']['fan'])
        

        # Set to auto
        for ac in data['aircons']:
            data['aircons']
        print(ac, "set", await aa.aircon.async_set({
            ac: {
                'info': {
                    'fan': 'low'
                }
            }
        }))

        # Get data
        data = await aa.async_get()
        for ac in data['aircons']:
            print(ac, "fan is", data['aircons'][ac]['info']['fan'])

asyncio.run(main())