switching to vue frontend, basic barco control working - still needs styling

This commit is contained in:
0xEmm 2024-10-24 20:40:43 +02:00
parent b665085833
commit 5bb47c9578
29 changed files with 2300 additions and 27 deletions

View file

@ -32,13 +32,21 @@ def parse_barco_response(raw: str):
async def barco_telnet_command(client, writer, select: str):
await client.subscribe(f"p1/projektorji/{select}/#")
onSub = f"p1/projektorji/{select}/#"
print('TEST', onSub)
onMatch = f"p1/projektorji/{select}/ukaz/+"
await client.subscribe(onSub)
async with client.messages() as msgs:
async for mesg in msgs:
if mesg.topic.matches('p1/projektorji/{select}/ukaz/+'):
# print(mesg.topic.value)
# print(mesg.payload.decode())
# print('on', select)
if mesg.topic.matches(onMatch):
# print("test")
cmd = mesg.topic.value.split("/")[-1]
#val = '1' if mesg.payload.decode() == 'ON' else '0'
val = mesg.payload.decode()
val = '1' if mesg.payload.decode() == 'ON' else '0'
barcoCmd = f"[{cmdMap[cmd]}{val}]"
print("Received: [" + mesg.topic.value + "] payload: [" + mesg.payload.decode() + "]")
print("Sending command to Barco: " + barcoCmd)
@ -64,7 +72,7 @@ async def barco_telnet_query_status(writer, select: str):
writer.write(f"[{val}?]" + '\r\n') # TODO test if funny CRLF necessary (it probably gets ignored)
await asyncio.sleep(1) # sleep between writes necessary, otherwise it gets confused.
# simultaneous commands from control could break this? TODO fix later
await asyncio.sleep(1000) # TODO find appropriate period
await asyncio.sleep(10) # TODO find appropriate period
# async def shell(reader, writer):