async def start(): async with xows.XoWSClient('170.2.245.212', username='******', password='******') as client: def callback(data, id_): print(f'Feedback (Id {id_}): {data}') print('Status Query:', await client.xQuery(['Status', '**', 'DisplayName']))
async def start(endpoint_ip, endpoint_username, endpoint_password): async with xows.XoWSClient(endpoint_ip, username=endpoint_username, password=endpoint_password) as client: p # Note: This will retrieve 65534 entries by default if no limit is set calls_made_on_device = await client.xCommand(['CallHistory', 'Get']) return calls_made_on_device
async def start(): async with xows.XoWSClient('10.10.20.159', username='******', password='******') as client: def callback(data, id_): print(f'Feedback (Id {id_}): {data}') calls_made_on_device = await client.xCommand(['CallHistory', 'Get']) return calls_made_on_device
def cli(ctx, host_or_url, username, password): """First argument is hostname, or url (e.g. ws://example.host/ws) Usage examples: clixows ws://example.codec/ws get Status SystemUnit Uptime clixows example.codec set Configuration Audio Ultrasound MaxVolume 70 clixows example.codec command Phonebook Search Limit=1 Offset=0 clixows example.codec feedback -c '**' """ ctx.obj = xows.XoWSClient(host_or_url, username, password)
async def async_send_raw_message_to_t10(ip: str, username: str, password: str, message: str) -> dict: """Send raw message to T10. Args: ip (str): Device IP username (str): Username password (str): Password message (str): Message Returns: dict: Response """ async with xows.XoWSClient(ip, username, password) as client: encoded_message = f"711:{message}" logger.info(f"Sending message {encoded_message} to T10 {ip} ...") return await client.xCommand(['Message', 'Send'], Text=encoded_message)
async def task(): try: async with xows.XoWSClient('192.168.1.3', username='******', password='******') as client: def callback(data, id): print(f'New event received with id: ({id}): {data}') print( 'Created subscription with number: ', await client.subscribe(['Status', 'Audio', 'Volume'], callback, True)) await client.wait_until_closed() except xows.XoWSError as error: print('Timeout, could not connect to device. Exiting...') print('error', error) except TimeoutError: print('TimeoutError') except aiohttp.client_exceptions.ClientConnectorError: print('ClientConnectorError')