-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathusage.py
33 lines (23 loc) · 966 Bytes
/
usage.py
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
# Copyright (c) 2019 Cisco Systems
# Licensed under the MIT License
#
# Usage sample from README.md at https://github.com/cisco-ce/pyxows
#
import xows
import asyncio
async def start():
async with xows.XoWSClient(url_or_host='192.168.1.32', username='localadmin', password='ciscopsdt') as client:
def callback(data, id_):
print(f'Feedback (Id {id_}): {data}')
print('Status Query:',
await client.xQuery(['Status', '**', 'DisplayName']))
print('Get:',
await client.xGet(['Status', 'Audio', 'Volume']))
print('Command:',
await client.xCommand(['Audio', 'Volume', 'Set'], Level=60))
print('Configuration:',
await client.xSet(['Configuration', 'Audio', 'DefaultVolume'], 50))
print('Subscription 1:',
await client.subscribe(['Status', 'Audio', 'Volume'], callback, True))
await client.wait_until_closed()
asyncio.run(start())